コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (CheckUserInput() && !BLLDB.GLB.CheckADNAME(txtUSER.Text))
            {
                string pd = Interaction.InputBox("请输入密码", "输入密码", "", -1, -1);

                GLB model = new GLB()
                {
                    SKID       = cbxSKID.Text,
                    ADSEX      = cbxSex.Text,
                    ADPASSWORD = pd,
                    ADUSERNAME = txtUSER.Text,
                    ADYNAME    = txtName.Text
                };
                if (BLLDB.GLB.Add(model) == true)
                {
                    MessageBox.Show("添加成功");
                    BindData();
                    ClearInput();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
        }
コード例 #2
0
        public ActionResult Login()
        {
            userService = ServiceBuilder.BuildUserService();
            UserStatus     us        = null;
            ResponseStatus rspStatus = userService.Login(Request, conTa_status, ref us);

            if (rspStatus == ResponseStatus.SUCCESS)
            {
                CookieFactory cf = CookieFactory.Instance();
                cf.CreateCookie(GLB.userId, us.UserID, DateTime.Now.AddYears(1), Response);
                cf.CreateCookie(GLB.userName, us.UserName, DateTime.Now.AddYears(1), Response);
                cf.CreateCookie(GLB.id, us.ID.ToString(), DateTime.Now.AddYears(1), Response);
                cf.CreateCookie(GLB.depId, us.Dep.ID.ToString(), DateTime.Now.AddYears(1), Response);
                GLB.Instance().GetActivitiesIdCookies(Response, DateTime.Now.AddYears(1));
                return(RedirectToAction("PersonalHome"));
            }
            else if (rspStatus == ResponseStatus.NOT_PASS)
            {
                return(RedirectToAction("Message", "Other", new { msg = Msg.NotPass }));
            }
            else if (rspStatus == ResponseStatus.NOT_REGISTER)
            {
                return(RedirectToAction("Message", "Other", new { msg = Msg.NotReg }));
            }
            else if (rspStatus == ResponseStatus.REQFORM_COUNT_ISZERO)
            {
                return(View());
            }
            return(View());
        }
コード例 #3
0
        public bool CheckUser(string username, string password)
        {
            GLB model = this.GetModel(username);

            if (model == null || model.ADPASSWORD != password)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #4
0
 private bool CheckModelChanged()
 {
     if (dgvData.SelectedRows.Count == 1)
     {
         GLB model = (GLB)dgvData.SelectedRows[0].DataBoundItem;
         return(model.ADYNAME == txtName.Text &&
                model.ADSEX == cbxSex.Text &&
                model.SKID == cbxSKID.Text);
     }
     else
     {
         return(false);
     }
 }
コード例 #5
0
        private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvData.SelectedRows.Count == 1)
            {
                GLB model = (GLB)dgvData.SelectedRows[0].DataBoundItem;
                txtName.Text = model.ADYNAME;
                txtUSER.Text = model.ADUSERNAME;

                SelectedSex(model.ADSEX);
                cbxSKID.Text = model.SKID;

                txtUSER.ReadOnly  = true;
                btnDelete.Enabled = true;
                btnAdd.Enabled    = false;
            }
        }
コード例 #6
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     if (CheckUserInput() && !CheckModelChanged())
     {
         GLB model = new GLB()
         {
             SKID       = cbxSKID.Text,
             ADSEX      = cbxSex.Text,
             ADUSERNAME = txtUSER.Text,
             ADYNAME    = txtName.Text,
             ADPASSWORD = BLLDB.GLB.GetPassword(txtUSER.Text)
         };
         if (BLLDB.GLB.Update(model) == true)
         {
             MessageBox.Show("更新成功");
             BindData();
             ClearInput();
         }
         else
         {
             MessageBox.Show("更新失败");
         }
     }
 }
コード例 #7
0
        public string GetPassword(string username)
        {
            GLB model = this.GetModel(username);

            return(model.ADPASSWORD);
        }