Exemplo n.º 1
0
        public ActionResult DoRegister(string inputad)
        {
            var res = new TRes
            {
                bok = false
            };
            string msg = string.Empty;

            res.bok = SysUserInfo.InsertUserInfo(inputad, ref msg);
            res.msg = msg;
            return(Json(res));
        }
Exemplo n.º 2
0
 private void btnUserSave_Click(object sender, EventArgs e)
 {
     try
     {
         CheckTextValue(new Object[] { txtUserName, txtUserNo, txtPsw });
         if (UserInfo.UserNo == txtUserNo.Text)
         {
             cmn.Show("不能修改自己的信息.\r如需修改,请用其他管理员账号登陆\r如无其他管理员账号,请新增管理员之后,再进行修改.");
             return;
         }
         if (!cmn.Confirm("保存用户信息?"))
         {
             return;
         }
         if (cboRole.SelectedIndex == 0 && !cmn.Confirm("您选择的是管理员角色,该角色能够修改系统设置\r权利较大,请慎重添加\r是否继续?"))
         {
             return;
         }
         int nUserId = 0;
         if (txtUserName.Tag != null && txtUserName.Tag.ToString() != "")
         {
             nUserId = Convert.ToInt32(txtUserName.Tag);
         }
         var query = listUser.Where(c => c.UserId == nUserId);
         if (query.Count() > 0)
         {
             oCtrl.Reset();
             oCtrl.Add(MCtrl.SetUserNo);
             oCtrl.Add(MCtrl.SetUserName);
             oCtrl.Add(MCtrl.SetRoleId);
             oCtrl.Add(MCtrl.SetPsw);
             SysUserInfoModel mUser = new SysUserInfoModel();
             mUser.UserNo          = txtUserNo.Text;
             mUser.UserName        = txtUserName.Text;
             mUser.NewPsw          = MyMD5.MD5Encrypt(txtPsw.Text, "INDEXSFT");
             mUser.RoleInfo.RoleId = int.Parse(cboRole.SelectedValue.ToString());
             mUser.UserId          = query.First().UserId;
             bUser.UpdateUserInfo(mUser, oCtrl);
         }
         else
         {
             query = listUser.Where(c => c.UserNo == txtUserNo.Text);
             if (query.Count() > 0)
             {
                 cmn.Show("该用户编号已经存在,无法新增!");
                 return;
             }
             SysUserInfoModel mUser = new SysUserInfoModel();
             mUser.UserNo                  = txtUserNo.Text;
             mUser.UserName                = txtUserName.Text;
             mUser.UserPassWord            = MyMD5.MD5Encrypt(txtPsw.Text, "INDEXSFT");
             mUser.RoleInfo.RoleId         = int.Parse(cboRole.SelectedValue.ToString());
             mUser.CommonInfo.CreateUserId = UserInfo.UserId;
             mUser.CommonInfo.UpdateUserId = UserInfo.UserId;
             bUser.InsertUserInfo(mUser);
         }
         BindUserList();
         tslblStatus.Text = "保存完毕";
         txtUserNo.Text   = "";
         txtUserName.Text = "";
         txtUserName.Tag  = "";
         txtPsw.Text      = "";
     }
     catch (Exception err)
     {
         tslblStatus.Text = err.Message;
     }
 }