日期:2013-09-28  浏览次数:20384 次

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["Pa