示例#1
0
        private void frmAddAcc_Load(object sender, EventArgs e)
        {
            botro.ApplyElipse(txtCMND, 40);
            if (key != 0)
            {
                DTO_Account acc = BUS_Account.GetAccount(key);
                txtCMND.Text        = acc.CMND.ToString();
                txtTenDangNhap.Text = acc.TenDangNhap;
                string chucvu = acc.ChucVu;

                switch (chucvu)
                {
                case "Admin":
                    cbbChucVu.selectedIndex = 0;
                    break;

                case "Lễ Tân":
                    cbbChucVu.selectedIndex = 1;
                    break;

                case "Kinh Doanh":
                    cbbChucVu.selectedIndex = 2;
                    break;
                }
                txtPass.Text = null;
                txtPass.Focus();
                txtPassRepeat.Text = null;
                msg = "Sửa thành công";
            }
        }
示例#2
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection r = dgvListAcc.SelectedRows;
            if (r.Count == 1)
            {
                int key = Convert.ToInt32(r[0].Cells["Column1"].Value.ToString());
                try
                {
                    BUS_Account.Delete(key);
                    Alert("Đã xóa thành công ^^", frmAlert.Type.Success);
                    dgvListAcc.DataSource = BUS_Account.GetAllAccount();

                }
                catch (Exception)
                {
                    Alert("Đã xảy ra lỗi !!", frmAlert.Type.Error);
                }
            }
            else
            {
                Alert("Vui lòng chọn dòng cần xóa !", frmAlert.Type.Info);
            }


        }
示例#3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPass.Text == "")
            {
                Alert("Bạn Chưa Nhập Pass", frmAlert.Type.Warning);
            }
            else
            {
                bool check = false;
                for (int i = 0; i < lst.Count(); i++)
                {
                    if (txtTen.Text == lst[i].TenDangNhap.ToString())
                    {
                        check = true;
                        if (lst[i].MatKhau.ToString() == BUS_Account.MaHoa(txtPass.Text))
                        {
                            Alert("Đăng nhập thành công !", frmAlert.Type.Success);
                            if (lst[i].ChucVu == "Admin")
                            {
                                this.Hide();
                                var frm = new frmAdmin(lst[i].STT);
                                frm.ShowDialog();
                                Alert("Đã đăng xuất!", frmAlert.Type.Info);

                                this.Show();
                                lst = BUS_Account.GetAllAccount();

                                txtPass.Text = null;
                            }
                            if (lst[i].ChucVu == "Lễ Tân")
                            {
                                this.Hide();
                                var frm = new frmLeTan(lst[i].STT);
                                frm.ShowDialog();
                                Alert("Đã đăng xuất!", frmAlert.Type.Info);
                                this.Show();

                                txtPass.Text = null;
                            }
                            break;
                        }
                        else
                        {
                            Alert("Nhập Sai Pass Rồi !", frmAlert.Type.Error);
                            break;
                        }
                    }
                    else
                    {
                        check = false;
                    }
                }
                if (!check)
                {
                    Alert("Sai tên đăng nhập !", frmAlert.Type.Error);
                }
            }
        }
示例#4
0
 private void txtTenDangNhap_OnValueChanged(object sender, EventArgs e)
 {
     if (key == 0)
     {
         errorProvider1.SetError(txtTenDangNhap, "");
         if (BUS_Account.GetAllAccount().SingleOrDefault(p => p.TenDangNhap == txtTenDangNhap.Text) != null)
         {
             errorProvider1.SetError(txtTenDangNhap, "Tên đăng nhập đã tồn tại, xin nhập lại !");
         }
     }
 }
示例#5
0
        private void frmLeTan_Load(object sender, EventArgs e)
        {
            a = BUS_Account.GetAccount(id);

            lbNameWelCome.Text = BUS_User.GetUser(a.CMND).HoTen;
            MoveSidePanel(btnAccount);

            UCInfo.Instance.Dock = DockStyle.Fill;
            panelNV.Controls.Add(UCInfo.Instance);
            UCInfo.Instance.ShowInfo(a.CMND);
        }
示例#6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {


            var frm = new frmAddAcc(0);
            this.ParentForm.Opacity = .55;
            frm.ShowDialog();
            this.ParentForm.Opacity = 1;
            dgvListAcc.DataSource = BUS_Account.GetAllAccount();


        }
示例#7
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (circleSLTaiKhoan.Value == 20)
     {
         timer1.Interval = 5000;
     }
     if (circleSLTaiKhoan.Value == 100)
     {
         circleSLTaiKhoan.Value = 0;
     }
     circleSLTaiKhoan.Value += 20;
     txtSLNhanVien.Text      = BUS_User.GetAllUser().Count().ToString();
     txtSLAdmin.Text         = BUS_Account.GetAllAccount().Where(p => p.ChucVu == "Admin").ToList().Count().ToString();
     txtSLLeTan.Text         = BUS_Account.GetAllAccount().Where(p => p.ChucVu == "Lễ Tân").ToList().Count().ToString();
     txtSLKinhDoanh.Text     = BUS_Account.GetAllAccount().Where(p => p.ChucVu == "Kinh Doanh").ToList().Count().ToString();
     txtSLTK.Text            = BUS_Account.GetAllAccount().Count().ToString();
 }
示例#8
0
 private void btnAccept_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCMND.Text == "" || txtPass.Text == "" || txtTenDangNhap.Text == "")
         {
             Alert("Vui lòng điền đầy đủ", frmAlert.Type.Info);
         }
         if (txtPass.Text.Equals(txtPassRepeat.Text) && txtPassRepeat.Text != "")
         {
             DTO_Account acc = new DTO_Account();
             int         stt = BUS_Account.GetAllAccount().Count();
             if (key != 0)
             {
                 acc.STT = stt;
             }
             else
             {
                 acc.STT = stt + 1;
             }
             acc.CMND        = Convert.ToInt32(txtCMND.Text);
             acc.TenDangNhap = txtTenDangNhap.Text;
             acc.MatKhau     = BUS_Account.MaHoa(txtPassRepeat.Text);
             acc.ChucVu      = cbbChucVu.selectedValue.ToString();
             if (key != 0)
             {
                 acc.TenDangNhap = txtTenDangNhap.Text;
                 acc.MatKhau     = BUS_Account.MaHoa(txtPassRepeat.Text);
                 acc.ChucVu      = cbbChucVu.selectedValue.ToString();
                 BUS_Account.InsertUpdate(acc);
                 Alert(msg, frmAlert.Type.Success);
             }
             else
             {
                 BUS_Account.InsertUpdate(acc);
                 msg = "Đã thêm thành công ^^";
                 Alert(msg, frmAlert.Type.Success);
             }
         }
     }
     catch (Exception)
     {
         Alert("Hãy thêm hồ sơ người này trước!", frmAlert.Type.Error);
     }
 }
示例#9
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection r = dgvListAcc.SelectedRows;
            if (r.Count == 1)
            {
                int key = Convert.ToInt32(r[0].Cells["Column1"].Value.ToString());
                var frm = new frmAddAcc(key);
                this.ParentForm.Opacity = .55;
                frm.ShowDialog();
                this.ParentForm.Opacity = 1;
                dgvListAcc.DataSource = BUS_Account.GetAllAccount();


            }
            else
            {
                Alert("Hãy chọn dòng cần sửa", frmAlert.Type.Info);
            }


        }
示例#10
0
        private void UCListAcc_Load(object sender, EventArgs e)
        {
            dgvListAcc.DataSource = BUS_Account.GetAllAccount();


        }
示例#11
0
 public frmAdmin(int stt)
 {
     this.stt     = stt;
     this.thisacc = BUS_Account.GetAccount(stt);
     InitializeComponent();
 }
示例#12
0
 private void frmLogin_Load(object sender, EventArgs e)
 {
     this.Hide();
     lst = BUS_Account.GetAllAccount();
 }
示例#13
0
 public frmChangeAccount(DataRow row)
 {
     InitializeComponent();
     rowACCOUNT = row;
     busACCOUNT = new BUS_Account();
 }
示例#14
0
 public frmAccount()
 {
     InitializeComponent();
     busACCOUNT = new BUS_Account();
 }
示例#15
0
 public frmLogin()
 {
     InitializeComponent();
     busACCOUNT = new BUS_Account();
     KHOITAO();
 }