Example #1
0
        public int Update(SiteUserInfo model, DbTransaction tran)
        {
            string strSql = SQL_UPDATE + PK_PARA_SET;

            DbParameter[] para = makeParameterForUpdate(model);
            return(Db.Helper.ExecuteNonQuery(tran, strSql, para));
        }
Example #2
0
        public int Update(SiteUserInfo model)
        {
            string strSql = SQL_UPDATE + PK_PARA_SET;

            DbParameter[] paras = makeParameterForUpdate(model);
            return(Db.Helper.ExecuteNonQuery(strSql, paras));
        }
Example #3
0
 private void fillModel(DbDataReader dr, SiteUserInfo model)
 {
     model.Name          = dr.GetString(0);
     model.Pwd           = dr.GetString(1);
     model.RealName      = dr.GetString(2);
     model.RoleIDs       = dr.GetString(3);
     model.LastLoginTime = dr.GetDateTime(4);
     model.LastLoginIP   = dr.GetString(5);
     model.ThisLoginTime = dr.GetDateTime(6);
     model.ThisLoginIP   = dr.GetString(7);
     model.InviteNum     = dr.GetString(8);
     model.Remarks       = dr.GetString(9);
     model.UserStatus    = dr.GetString(10);
     model.ExtraFields   = FieldsHelper.XmlDeserialize(dr.GetString(11));
 }
Example #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string userName  = tbUserName.Text.Trim();
        string pwd       = tbPwd.Text.Trim();
        string realName  = tbRealName.Text.Trim();
        string inviteNum = tbInviteNum.Text.Trim();

        string[] arr  = { userName, pwd, realName, inviteNum };
        string[] name = { "用户名", "密码", "真名", "邀请码" };

        if (arr.ValidateHasNullOrEmptyString(name))
        {
            return;
        }

        //判断用户名和邀请码是否唯一
        var user = SiteUserBLL.Select(userName);

        if (user.ValidateIsNotNull("该用户名已存在!请选择其他用户名!"))
        {
            return;
        }

        if (SiteUserBLL.InviteNumExist(inviteNum))
        {
            MessageBox.Show("该邀请码已存在!请选择其他验证码!");
            return;
        }

        TMS.SiteUserInfo model = new TMS.SiteUserInfo();
        model.InviteNum     = inviteNum;
        model.LastLoginIP   = "127.0.0.1";
        model.LastLoginTime = DateTime.Now;
        model.Name          = userName;
        model.Pwd           = SiteUserBLL.AdminEncrypt(pwd);
        model.RealName      = realName;
        model.Remarks       = "";
        model.RoleIDs       = "1";
        model.ThisLoginIP   = "127.0.0.1";
        model.ThisLoginTime = DateTime.Now;
        model.UserStatus    = AdminStatus.Enable;

        SiteUserBLL.Add(model);

        MessageBox.Show("添加成功!", "AdminEdit.aspx");
    }
Example #5
0
 private DbParameter[] makeParameterForUpdate(SiteUserInfo model)
 {
     DbParameter[] paras =
     {
         Db.Helper.MakeInParameter("@Pwd",           model.Pwd),
         Db.Helper.MakeInParameter("@RealName",      model.RealName),
         Db.Helper.MakeInParameter("@RoleIDs",       model.RoleIDs),
         Db.Helper.MakeInParameter("@LastLoginTime", model.LastLoginTime),
         Db.Helper.MakeInParameter("@LastLoginIP",   model.LastLoginIP),
         Db.Helper.MakeInParameter("@ThisLoginTime", model.ThisLoginTime),
         Db.Helper.MakeInParameter("@ThisLoginIP",   model.ThisLoginIP),
         Db.Helper.MakeInParameter("@InviteNum",     model.InviteNum),
         Db.Helper.MakeInParameter("@Remarks",       model.Remarks),
         Db.Helper.MakeInParameter("@UserStatus",    model.UserStatus),
         Db.Helper.MakeInParameter("@ExtraFields",   FieldsHelper.XmlSerialize(model.ExtraFields)),
         Db.Helper.MakeInParameter("@Name",          model.Name)
     };
     return(paras);
 }
Example #6
0
 public int Add(SiteUserInfo model)
 {
     DbParameter[] paras = makeParameterForAdd(model);
     return(Db.Helper.ExecuteNonQuery(SQL_ADD, paras));
 }
Example #7
0
 public int Add(SiteUserInfo model, DbTransaction tran)
 {
     DbParameter[] para = makeParameterForAdd(model);
     return(Db.Helper.ExecuteNonQuery(tran, SQL_ADD, para));
 }