Пример #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            string      id1 = id.Text;
            string      pw  = pwAccount.Text;
            string      ids = idstaff.Text;
            string      pos = position.Text;
            Account_DTO acc = new Account_DTO(id1, pw, ids, pos);

            Account_BUS.EditAccount(acc);
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string      id  = idAddAccount.Text;
            string      pw  = pwAccount.Text;
            string      ids = idStaff.Text;
            string      pos = positionAccount.Text;
            Account_DTO acc = new Account_DTO(id, pw, ids, pos);

            Account_BUS.AddAccount(acc);
            MessageBox.Show("Complete");
            this.Close();
        }
Пример #3
0
        private void Login_Load(object sender, EventArgs e)

        {
            login = new List <string[]>();
            dgvLogin.DataSource = Account_BUS.ListAccount();
            for (int i = 0; i < gridLogin.RowCount; i++)
            {
                string[] c = new string[3];
                c[0] = gridLogin.GetDataRow(i)["IDAccount"].ToString().TrimEnd();
                c[1] = gridLogin.GetDataRow(i)["Pass"].ToString().TrimEnd();
                c[2] = gridLogin.GetDataRow(i)["Position"].ToString().TrimEnd();
                login.Add(c);
            }
        }
Пример #4
0
 private void editAccount_Click(object sender, EventArgs e)
 {
     if (gridAccount.RowCount > 0)
     {
         DataRow row = gridAccount.GetDataRow(gridAccount.GetSelectedRows()[0]);
         EditAccount.oldInfo = row;
         EditAccount edit = new EditAccount();
         edit.ShowDialog();
         dgvListAccount.DataSource = Account_BUS.ListAccount();
     }
     else
     {
         MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
Пример #5
0
 private void btnDeleteAccount_Click(object sender, EventArgs e)
 {
     if (gridAccount.RowCount > 0)
     {
         DataRow      row          = gridAccount.GetDataRow(gridAccount.GetSelectedRows()[0]);
         DialogResult dialogResult = MessageBox.Show("Are you sure?", "Delete room", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             Account_BUS.DeleteAccount(row["IDAccount"].ToString());
             MessageBox.Show("Account was deleted", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         dgvListAccount.DataSource = Room_BUS.ListRoom();
     }
     else
     {
         MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
        public string Get(
            int numItemsPerPage,
            GetPaginationType GetPaginationType,
            int?Id             = null,
            string keyBoundary = null
            )
        {
            var Session = HttpContext.Current.Session;

            if (!Session.isAdminSession())
            {
                return("");
            }

            if (Id != null)
            {
                var User = (new Entities()).TaiKhoan.Where(p => p.id == Id).Select(u => new {
                    Email    = u.TenDangNhap,
                    Fullname = u.Ten,
                    State    = u.TrangThai,
                    Id       = u.id,
                    u.LaAdmin,
                });

                return(JsonConvert.SerializeObject(
                           new { data = User }
                           ));
            }

            if (GetPaginationType == GetPaginationType.Next)
            {
                return(JsonConvert.SerializeObject(Account_BUS.getNext(
                                                       keyBoundary,
                                                       numItemsPerPage)));
            }

            else
            {
                return(JsonConvert.SerializeObject(Account_BUS.getPrev(
                                                       keyBoundary,
                                                       numItemsPerPage)));
            }
        }
Пример #7
0
 private void btnChange_Click(object sender, EventArgs e)
 {
     if (oldpass.Text != Manager.pw)
     {
         MessageBox.Show(Manager.pw);
         MessageBox.Show("Old password is wrong");
     }
     else
     {
         if (newpass.Text != confirm.Text)
         {
             MessageBox.Show("New password is not same");
         }
         else
         {
             Account_BUS.ChangePassword(Manager.id, confirm.Text.ToString());
             MessageBox.Show("Complete!");
             this.Close();
         }
     }
 }
Пример #8
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            Account acc = new Account();

            acc.UserName = txtName.Text;
            acc.Password = txtPass.Text;

            if (acc.UserName == "" || acc.Password == "")
            {
                MessageBox.Show("Khong duoc de rong ten dang nhap hoac mat khau", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (account_BUS.login(acc))
            {
                DataRow dataRow = new Account_BUS().GetThongTinAccountByUserName(acc.UserName);
                MaNV = int.Parse(dataRow["MaNV"].ToString());
                DataRow row = new NhanVien_BUS().GetThongTinNhanVienByID(MaNV);
                ChucVu            = row["ChucVu"].ToString();
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Ten dang nhap hoac mat khau sai", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public bool Login([FromBody] NhanVien account)
        {
            Account_BUS account_BUS = new Account_BUS();

            return(account_BUS.Login(account));
        }
        public DataTable Get()
        {
            Account_BUS account_BUS = new Account_BUS();

            return(account_BUS.GetAllAccount());
        }
Пример #11
0
 private void Form_DangNhap_Load(object sender, EventArgs e)
 {
     account_BUS = new Account_BUS();
 }
Пример #12
0
 private void btnSearchShow_Click(object sender, EventArgs e)
 {
     dgvListAccount.DataSource = Account_BUS.FindAccount(searchAccount.Text.ToString());
 }
Пример #13
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     dgvListAccount.DataSource = Account_BUS.ListAccount();
 }
Пример #14
0
 private void ListAccount_Load(object sender, EventArgs e)
 {
     dgvListAccount.DataSource = Account_BUS.ListAccount();
 }