Esempio n. 1
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (function == "add")
     {
         if (cbbTypeAccount.Text != "" && txtUsername.Text != "" && txtPassWord.Text != "")
         {
             AccountDTO accountDTO = new AccountDTO(txtUsername.Text, txtPassWord.Text, cbbTypeAccount.Text);
             //string password = txtPassWord.Text;
             //accountDTO.TypeAccount = cbbTypeAccount.Text;
             AccountBLL accountBLL = new AccountBLL();
             accountBLL.AddAccount(accountDTO);
         }
     }
     else if (function == "update")
     {
         if (txtUsername.Text != "" && txtPassWord.Text != "")
         {
             if (accountBLL.UpdatePass(txtUsername.Text, txtPassWord.Text) == 1)
             {
                 MessageBox.Show("update thành công");
             }
         }
     }
     txtUsername.ReadOnly = false;
     FillAccountDataGridview();
     pnlAadd.Visible       = false;
     pnlBtnFuntion.Visible = true;
 }
Esempio n. 2
0
        private void btnAccountManagerSave_Click(object sender, EventArgs e)
        {
            LoginBLL lg     = new LoginBLL();
            DicBLL   dic    = new DicBLL();
            string   email  = txtAccountManagerEmail.Text;
            string   name   = txtname.Text;
            int      auth   = int.Parse(cboAccountManagerType.SelectedValue.ToString());
            bool     ad     = false;
            bool     active = false;

            if (checkboxActive.Checked == true)
            {
                active = true;
            }
            if (auth == 1)
            {
                ad = true;
            }

            if (idAc == "")
            {
                if (lg.isvaildEmail(email) == true)
                {
                    if (at.AddAccount(email, name, ad, active) == true)
                    {
                        MessageBox.Show(dic.successAccountMessage("add"));
                        clear();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(dic.errorAccountMessage("else"));
                    }
                }
                else
                {
                    MessageBox.Show(dic.errorAccountMessage("sai email"));
                }
            }
            else
            {
                if (lg.isvaildEmail(email) == true)
                {
                    if (at.EditAccount(idAc, email, name, ad, active) == true)
                    {
                        MessageBox.Show(dic.successAccountMessage("edit"));
                        clear();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(dic.errorAccountMessage("else"));
                    }
                }
                else
                {
                    MessageBox.Show(dic.errorAccountMessage("sai email"));
                }
            }
        }
Esempio n. 3
0
        public bool AddAccountTest(
            [PexAssumeUnderTest] AccountBLL target,
            string user,
            string name,
            bool isadmin,
            bool active
            )
        {
            bool result = target.AddAccount(user, name, isadmin, active);

            return(result);
            // TODO: add assertions to method AccountBLLTest.AddAccountTest(AccountBLL, String, String, Boolean, Boolean)
        }
Esempio n. 4
0
        public JsonResult AccountAdd(string title, string contents)
        {
            JsonResult js = new JsonResult();

            Account loginAccount = membership.GetUser();

            //未登录
            if (loginAccount == null)
            {
                js.Data = "false";
                return(js);
            }

            Account accountModel = new Account();

            accountModel.ID       = Guid.NewGuid();
            accountModel.Mobile   = title;
            accountModel.Password = contents;
            accountModel.RegDate  = DateTime.Now;
            accountBll.AddAccount(accountModel);

            js.Data = "true";
            return(js);
        }