Exemple #1
0
        private void lblClose_Click(object sender, EventArgs e)
        {
            this.Close();
            frmNhanVien frm = new frmNhanVien();

            frm.Refresh();
        }
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     frmHomePage = new Form1();
     frmNV       = new frmNhanVien();
     Application.Run(new frmDangNhap());
 }
        private void button1_Click(object sender, EventArgs e)
        {
            lblHeader.Text = "Nhân viên";
            indicator.Top  = ((Control)sender).Top;
            frmNhanVien frm = new frmNhanVien();

            openSubForm(frm);
        }
Exemple #4
0
        private void btnNhanVien_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmNhanVien frm = new frmNhanVien();

            frm.ShowDialog();
            this.Dispose();
        }
Exemple #5
0
        private void btnNhanVien_Click(object sender, EventArgs e)
        {
            panelDanhMuc.Controls.Clear();
            panelBottom.Width = btnNhanVien.Width;
            panelBottom.Left  = btnNhanVien.Left;
            frmNhanVien frmNV = new frmNhanVien();

            frmNV.TopLevel = false;
            panelDanhMuc.Controls.Add(frmNV);
            frmNV.Show();
        }
Exemple #6
0
 private void btnNhanVien_Click(object sender, EventArgs e)
 {
     if (NV == null || NV.IsDisposed)
     {
         NV           = new frmNhanVien();
         NV.MdiParent = this;
         NV.Show();
     }
     else
     {
         NV.Activate();
     }
 }
Exemple #7
0
 private void btnNhanvien_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (KiemTraTonTai("frmNhanVien") == null)
     {
         foreach (Form frm1 in MdiChildren)
         {
             frm1.Close();
         }
         frmNhanVien frm = new frmNhanVien();
         frm.MdiParent = this;
         frm.Show();
     }
 }
Exemple #8
0
        private void nhânViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmNhanVien frmNV = new frmNhanVien();

            frmNV.Show();
        }
Exemple #9
0
        private void btnThemNhanVien_Click(object sender, EventArgs e)
        {
            int      id_kho   = int.Parse(cboKho.SelectedValue.ToString());
            string   id       = txtUsername.Text;
            string   ten      = txtHoVaTen.Text;
            string   sdt      = txtSoDT.Text;
            string   diachi   = txtDiaChi.Text;
            DateTime ngaysinh = dateNgaySinh.Value;
            string   pass     = txtPass.Text;
            string   picture  = "";

            if (lblFileAnh.Text == "")
            {
                picture = null;
            }
            else
            {
                picture = lblFileAnh.Text;
            }
            if (txtUsername.Text == "")
            {
                this.Alert("Không được để trống Username!", frmNotificationCustom.enmType.Warning);
                txtUsername.Focus();
            }
            else if (txtHoVaTen.Text == "")
            {
                this.Alert("Không được để trống họ và tên!", frmNotificationCustom.enmType.Warning);
                txtHoVaTen.Focus();
            }
            else if (txtSoDT.Text == "")
            {
                this.Alert("Không được để trống số điện thoại!", frmNotificationCustom.enmType.Warning);
                txtSoDT.Focus();
            }
            else if (txtDiaChi.Text == "")
            {
                this.Alert("Không được để trống địa chỉ!", frmNotificationCustom.enmType.Warning);
                txtDiaChi.Focus();
            }
            else if (txtPass.Text == "")
            {
                this.Alert("Không được để trống mật khẩu!", frmNotificationCustom.enmType.Warning);
                txtPass.Focus();
            }
            else
            {
                if (kiemTraTuoi(dateNgaySinh.Value) == false)
                {
                    this.Alert("Phải đủ 18 tuổi trở lên!", frmNotificationCustom.enmType.Warning);
                }
                else
                {
                    string gioitinh = "";
                    if (rdoNam.Checked)
                    {
                        gioitinh = "Nam";
                        if (nv.themNguoiDung(id_kho, id, ten, sdt, diachi, ngaysinh, gioitinh, pass, picture) == true)
                        {
                            frmNhanVien frm = new frmNhanVien();
                            frm.grvNhanVien.DataSource = nv.loadDataNguoiDung();
                            frm.grvNhanVien.Refresh();
                            this.Alert("Thêm thành công!", frmNotificationCustom.enmType.Success);
                            try
                            {
                                File.Copy(lblFullPath.Text, Application.StartupPath + "\\img\\" + lblFileAnh.Text, true);
                            }
                            catch
                            {
                                this.Alert("Không thể lưu file ảnh này!!", frmNotificationCustom.enmType.Warning);
                            }
                        }
                        else
                        {
                            this.Alert("Thêm thất bại!", frmNotificationCustom.enmType.Error);
                        }
                    }
                    else
                    {
                        gioitinh = "Nữ";
                        if (nv.themNguoiDung(id_kho, id, ten, sdt, diachi, ngaysinh, gioitinh, pass, picture) == true)
                        {
                            frmNhanVien frm = new frmNhanVien();
                            frm.grvNhanVien.DataSource = nv.loadDataNguoiDung();
                            frm.grvNhanVien.Refresh();
                            this.Alert("Thêm thành công!", frmNotificationCustom.enmType.Success);
                            try
                            {
                                File.Copy(lblFullPath.Text, Application.StartupPath + "\\img\\" + lblFileAnh.Text, true);
                            }
                            catch
                            {
                                this.Alert("Không thể lưu file ảnh này!!", frmNotificationCustom.enmType.Warning);
                            }
                        }
                        else
                        {
                            this.Alert("Thêm thất bại!", frmNotificationCustom.enmType.Error);
                        }
                    }
                }
            }
        }
        private void btnThemNhanVien_Click(object sender, EventArgs e)
        {
            frmNhanVien frm      = new frmNhanVien();
            string      id       = txtUsername.Text;
            string      ten      = txtHoVaTen.Text.ToString();
            string      sdt      = txtSoDT.Text.ToString();
            DateTime    ngaysinh = dateNgaySinh.Value;
            string      diachi   = txtDiaChi.Text.ToString();
            string      pass     = txtPass.Text.ToString();
            string      picture  = "";

            if (lblFileAnh.Text == "")
            {
                picture = null;
            }
            else
            {
                picture = lblFileAnh.Text;
            }


            string gioitinh = "";

            if (rdoNam.Checked)
            {
                gioitinh = "Nam";
                if (nv.updateInfo(id, ten, sdt, diachi, ngaysinh, gioitinh, pass, picture) == true)
                {
                    frm.grvNhanVien.DataSource = nv.loadDataNguoiDung();
                    frm.grvNhanVien.Refresh();
                    this.Alert("Sửa thành công!", frmNotificationCustom.enmType.Success);
                    try
                    {
                        File.Copy(lblFullPath.Text, Application.StartupPath + "\\img\\" + lblFileAnh.Text, true);
                    }
                    catch
                    {
                        this.Alert("Không thể lưu file ảnh này!", frmNotificationCustom.enmType.Warning);
                    }
                }
                else
                {
                    this.Alert("Sửa thất bại!", frmNotificationCustom.enmType.Error);
                }
            }
            else
            {
                gioitinh = "Nữ";
                if (nv.updateInfo(id, ten, sdt, diachi, ngaysinh, gioitinh, pass, picture) == true)
                {
                    frm.grvNhanVien.DataSource = nv.loadDataNguoiDung();
                    frm.grvNhanVien.Refresh();
                    this.Alert("Sửa thành công!", frmNotificationCustom.enmType.Success);
                    try
                    {
                        File.Copy(lblFullPath.Text, Application.StartupPath + "\\img\\" + lblFileAnh.Text, true);
                    }
                    catch
                    {
                        this.Alert("Không thể lưu file ảnh này!", frmNotificationCustom.enmType.Warning);
                    }
                }
                else
                {
                    this.Alert("Sửa thất bại!", frmNotificationCustom.enmType.Error);
                }
            }
        }