国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

自定義控件的使用例子一

2024-07-21 02:16:45
字體:
來源:轉載
供稿:網友
using system;
using com.joybase.db;
using com.oztime.workshop.codebase;
namespace com.oztime.workshop.codebase.db
{
    /// <summary>
    /// summary description for dbuser.
    /// </summary>
    public class dbuser:user
    {
        private int m_userid;
        private string m_username;
        private string m_password;
        private sex m_usersex;
        private string m_useremail;
        private string m_usertitle;
        public dbuser(string p_username)
        {
            this.m_useremail=p_username;
            this.loadfromdb(0);

        }
        public dbuser(int p_userid)
        {
            this.m_userid=p_userid;
            this.loadfromdb(1);
        }
        public dbuser(string p_username,string p_password)
        {
            this.m_username=p_username;
            this.m_password=p_password;
            this.loadfromdb(2);
        }
        public dbuser(string p_username,string p_password,sex p_usersex,string p_useremail,string p_usertitle)
        {
            this.m_password=p_password;
            this.m_useremail=p_useremail;
            this.m_username=p_username;
            this.m_usersex=p_usersex;
            this.m_usertitle=p_usertitle;
            this.m_userid=this.inserintodb();
        }
        private int inserintodb()
        {
            int result=-1;
            try
            {
                command command=new command(dbglobal.dsn);
                command.commandtext=dbglobal.addnewuser;
                command.parameter["username"]=this.m_username;
                command.parameter["password"]=this.m_password;
                command.parameter["usersex"]=(int)this.m_usersex;
                command.parameter["useremail"]=this.m_useremail;
                command.parameter["usertitle"]=this.m_usertitle;
                command.returntype=resulttype.noresult;
                command.execute();
                command.commandtext=dbglobal.selectcurrentuserid;
                command.returntype=resulttype.datareader;
                system.data.idatareader dr=(system.data.idatareader)command.execute();
                dr.read();
                result=dr.getint32(0);
                dr.close();
            }
            catch
            {
                throw new exception("cannot add new user");
            }
            return result;

        }
        private void loadfromdb(int p_type)
        {
            
            try
            {
                command command=new command(dbglobal.dsn);
                switch(p_type)
                {
                    case 0:
                        command.commandtext=dbglobal.selectuserbyname;
                        command.parameter["username"]=this.m_username;
                        break;
                    case 1:
                        command.commandtext=dbglobal.selectuserbyid;
                        command.parameter["userid"]=this.m_userid;
                        break;
                    case 2:
                        command.commandtext=dbglobal.selectuserbynameandpassword;
                        command.parameter["username"]=this.m_username;
                        command.parameter["password"]=this.m_password;
                        break;
                    default:
                        throw new exception("error invode loadfromdb() method!");
                }

                
                system.data.idatareader dr=(system.data.idatareader)command.execute();
                if(dr.read())
                {
                    this.m_password=dr["password"].tostring();
                    this.m_useremail=dr["useremail"].tostring();
                    this.m_userid=system.convert.toint32(dr["userid"].tostring());
                    this.m_username=dr["username"].tostring();
                    this.m_usersex=(sex)system.convert.toint32(dr["usersex"].tostring());
                    this.m_usertitle=dr["usertitle"].tostring();


                }
                else
                {
                    throw new exception("error to read userinfo!");
                }
                dr.close();
            }
            catch
            {
                throw new exception("error when load user's info");
            }
        }
        public int userid
        {
            get
            {
                return this.m_userid;
            }
            set
            {
                this.m_userid=value;
            }
        }
        public string username
        {
            get
            {
                return this.m_username;
            }
            set
            {
                this.m_username=value;
            }
        }
        public string password
        {
            get
            {
                return this.m_password;
            }
            set
            {
                this.m_password=value;
            }
        }
        public sex usersex
        {
            get
            {
                return this.m_usersex;
            }
            set
            {
                this.m_usersex=value;
            }
        }
        public string useremail
        {
            get
            {
                return this.m_useremail;
            }
            set
            {
                this.m_useremail=value;
            }
        }
        public string usertitle
        {
            get
            {
                return this.m_usertitle;
            }
            set
            {
                this.m_usertitle=value;
            }
        }
        public system.collections.arraylist getmycourse()
        {
            system.collections.arraylist result=null;
            return result;
        }


    }
}
 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 汉中市| 称多县| 平利县| 长寿区| 元江| 平顶山市| 定兴县| 巴彦县| 贵州省| 雷波县| 资讯 | 台南县| 万宁市| 射洪县| 聂荣县| 重庆市| 温泉县| 开阳县| 柳河县| 黄浦区| 龙门县| 泰宁县| 海南省| 手游| 永兴县| 和硕县| 绥滨县| 上高县| 屏南县| 原阳县| 衡东县| 当雄县| 田东县| 汝州市| 驻马店市| 贵南县| 如东县| 潞西市| 兴山县| 全州县| 天柱县|