示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        static public UserClass CreateUser(int userID)
        {
            DataTable tbl = UserDBI.GetUserDataTable(userID);

            if (tbl.Rows.Count > 0)
            {
                DataRow row          = tbl.Rows[0];
                string  name         = row[DBNames.tb_User.Name].ToString();
                string  pwd          = row[DBNames.tb_User.Password].ToString();
                int     waterUserID  = Convert.ToInt32(row[DBNames.tb_User.WaterUserID]);
                int     rolevalue    = Convert.ToInt32(row["role"]);
                bool    allowEdit    = Convert.ToBoolean(row["allowEdit"]);
                string  editPassword = row["EditPassword"].ToString();

                UserClass u = new UserClass();
                u.UserID        = userID;
                u.Name          = name;
                u.Pwd           = pwd;
                u.WaterUserID   = waterUserID;
                u.Role          = new RoleClass(rolevalue);
                u.AllowEditData = allowEdit;
                u.EditPassword  = editPassword;

                return(u);
            }
            return(null);
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 public void Save()
 {
     if (IsAdd())
     {
         this.UserID = UserDBI.AddUser(this.Name, this.Pwd, this.WaterUserID,
                                       this.Role.RoleValue, this.AllowEditData, this.EditPassword);
     }
     else
     {
         UserDBI.UpdateUser(this.UserID, this.Name, this.Pwd, this.WaterUserID,
                            this.Role.RoleValue, this.AllowEditData, this.EditPassword);
     }
 }