예제 #1
0
        private void frmTextNhanVien_FormClosing(object sender, FormClosingEventArgs e)
        {
            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();

            frmQLNV.Loading_DSNhanVien(frmQLNV.DataTable_DSNhanVien(nv_wcf.GetNhanViens().ToList()));
            frmQLNV.Custom_DataGridView(frmQLNV.dgv_DSNhanVien);
        }
예제 #2
0
        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            if (txtTimKiem.Text.Trim() == "")
            {
                return;
            }
            else
            {
                ////Tách Họ Tên**
                //string[] strTimKiem = txtTimKiem.Text.Split(' ');
                //string ten = strTimKiem[strTimKiem.Count() - 1];
                //string ho = "";

                //for (int i = 0; i < (strTimKiem.Count()-1); i++)
                //{
                //    ho += strTimKiem[i] + " ";
                //}
                ////**

                NhanVien_WCFClient  nv_wcf     = new NhanVien_WCFClient();
                List <NhanVien_Ent> dsNhanVien = nv_wcf.TimKiem_NhanVien_by_HoTen(txtTimKiem.Text.Trim()).ToList();
                Loading_DSNhanVien(DataTable_DSNhanVien(dsNhanVien));
                Custom_DataGridView(dgv_DSNhanVien);
            }
        }
예제 #3
0
        private void frmTextNhanVien_Load(object sender, EventArgs e)
        {
            lbTieuDe.Text = Lb_TitleName;

            //Load Dữ Liệu Thêm Nhân Viên
            if (KieuForm == 1)
            {
                txtHo.Text                  = "Nguyễn Quang";
                txtTen.Text                 = "Hải";
                txtEmail.Text               = "*****@*****.**";
                txtMatKhau.Text             = "123";
                txtNhapLai.Text             = "123";
                cbx_CaLamViec.SelectedIndex = 0;
                cbx_ChucVu.SelectedIndex    = 0;
                cbx_GioiTinh.SelectedIndex  = 0;
            }

            //Load Dữ Liệu Nhân Viên Cần Sửa
            if (KieuForm == 2)
            {
                NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();

                NhanVien_Ent nv_ent = nv_wcf.GetNhanVien_by_ID(Id_NhanVien);
                txtHo.Text    = nv_ent.Ho.Trim();
                txtTen.Text   = nv_ent.Ten.Trim();
                txtEmail.Text = nv_ent.Email.Trim();

                cbx_GioiTinh.Text  = nv_ent.GioiTinh;
                cbx_ChucVu.Text    = nv_ent.ChucVu;
                cbx_CaLamViec.Text = nv_ent.CaLamViec;

                dtp_NgaySinh.Value = nv_ent.NgaySinh;
                old_email          = txtEmail.Text.Trim();
            }
        }
        private void open_frmMain()
        {
            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();
            int id_nv = nv_wcf.GetID_by_Email(email);

            Application.Run(new frmMain(id_nv));
        }
예제 #5
0
        private void InitializeThongTinChung()
        {
            PhieuCheckIn_WCFClient pci_wcf = new PhieuCheckIn_WCFClient();
            NhanVien_WCFClient     nv_wcf  = new NhanVien_WCFClient();

            txtIdPhieu.Text = (pci_wcf.GetPhieuCheckIns()[pci_wcf.GetPhieuCheckIns().Length - 1].Id_phieu_checkin + 1).ToString();
            txtHoTenNV.Text = (nv_wcf.GetHoTen_NhanVien(ID_NV));
        }
예제 #6
0
        private void DoiMatKhauToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();
            string             email  = nv_wcf.GetEmail_by_ID(Id_nhanvien);
            frmDoiMatKhau      fdmk   = new frmDoiMatKhau(email, this);

            fdmk.FormBorderStyle = FormBorderStyle.None;
            fdmk.ShowDialog();
        }
예제 #7
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Custom_Theme();
            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();

            this.lbAccount.Text = "Xin Chào, " + nv_wcf.GetHoTen_NhanVien(Id_nhanvien);
            //this.btnCheckOut.Visible = false;

            open_frmDatPhong();
        }
예제 #8
0
        private void btnReload_Click(object sender, EventArgs e)
        {
            cbx_CaLamViec.SelectedIndex = 0;
            cbx_ChucVu.SelectedIndex    = 0;
            txtTimKiem.Clear();
            NhanVien_WCFClient  nv_wcf     = new NhanVien_WCFClient();
            List <NhanVien_Ent> dsNhanVien = nv_wcf.GetNhanViens().ToList();

            Loading_DSNhanVien(DataTable_DSNhanVien(dsNhanVien));
            Custom_DataGridView(dgv_DSNhanVien);
        }
예제 #9
0
 private void cbx_CaLamViec_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbx_CaLamViec.SelectedIndex == 0)
     {
         return;
     }
     else
     {
         NhanVien_WCFClient  nv_wcf     = new NhanVien_WCFClient();
         List <NhanVien_Ent> dsNhanVien = nv_wcf.SapXepCaLamViec(cbx_CaLamViec.SelectedIndex).ToList();
         Loading_DSNhanVien(DataTable_DSNhanVien(dsNhanVien));
         Custom_DataGridView(dgv_DSNhanVien);
     }
 }
예제 #10
0
 private void btnSuaNV_Click(object sender, EventArgs e)
 {
     if (dgv_DSNhanVien.SelectedRows.Count == 1)
     {
         NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();
         int             id        = nv_wcf.GetID_by_Email(dgv_DSNhanVien.SelectedRows[0].Cells[6].Value.ToString().Trim());
         frmTextNhanVien ftnv      = new frmTextNhanVien(this, "Sửa Nhân Viên", id);
         ftnv.ShowDialog();
     }
     else
     {
         MessageBox.Show("Chọn 1 Nhân Viên Cần Sửa", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         return;
     }
 }
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();

            if (nv_wcf.DangNhapHeThong(txtEmail.Text.Trim(), maHoaMatKhau(txtMatKhau.Text.Trim())))
            {
                email = txtEmail.Text.Trim();
                Thread th = new Thread(open_frmMain);
                th.Start();
                this.Close();
            }
            else
            {
                MessageBox.Show("Đăng Nhập Thất Bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
예제 #12
0
        private void frmQuanLyTaiKhoan_Load(object sender, EventArgs e)
        {
            btnReload.Image = imgs_Button.Images[0];

            NhanVien_WCFClient  nv_wcf     = new NhanVien_WCFClient();
            List <NhanVien_Ent> dsNhanVien = nv_wcf.GetNhanViens().ToList();

            Loading_DSNhanVien(DataTable_DSNhanVien(dsNhanVien));

            Custom_DataGridView(dgv_DSNhanVien);

            Load_AutoCompleteSource();

            string[] CaLamViec = { "Ca Làm Việc", "Sáng", "Chiều", "Tối" };
            cbx_CaLamViec.DataSource = CaLamViec;

            cbx_CaLamViec.SelectedIndex = 0;
            cbx_ChucVu.SelectedIndex    = 0;
        }
예제 #13
0
        //Load AutoComplete Source
        private void Load_AutoCompleteSource()
        {
            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();
            var acsc = new AutoCompleteStringCollection();

            try
            {
                foreach (NhanVien_Ent nv_ent in nv_wcf.GetNhanViens())
                {
                    acsc.Add(nv_ent.Ho + " " + nv_ent.Ten);
                    acsc.Add(nv_ent.Ten);
                }
                this.txtTimKiem.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                this.txtTimKiem.AutoCompleteCustomSource = acsc;
            }
            catch (Exception)
            {
                return;
            }
        }
예제 #14
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (txtMatKhauMoi.Text.Equals("") || txtMatKhauCu.Text.Equals(""))
            {
                return;
            }

            if (!txtMatKhauMoi.Text.Equals(txtNhapLai.Text.Trim()))
            {
                MessageBox.Show("Mật Khẩu Không Trùng Khớp", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();

            string matkhaucu  = maHoaMatKhau(txtMatKhauCu.Text.Trim());
            string matkhaumoi = maHoaMatKhau(txtMatKhauMoi.Text.Trim());

            if (nv_wcf.CapNhatMatKhau(Email, matkhaucu, matkhaumoi))
            {
                MessageBox.Show("Đổi Mật Khẩu Thành Công. Yêu Cầu Đăng Nhập Lại", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Thread th = new Thread(open_backlogin);
                Thread.Sleep(300);
#pragma warning disable CS0618 // Type or member is obsolete
                th.ApartmentState = ApartmentState.STA;
#pragma warning restore CS0618 // Type or member is obsolete
                th.Start();
                this.Close();
                fmain.isDead = true;
                fmain.Close();
            }
            else
            {
                MessageBox.Show("Không Hợp Lệ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
예제 #15
0
        private void btnXoaNV_Click(object sender, EventArgs e)
        {
            string email = "";

            if (dgv_DSNhanVien.SelectedRows.Count == 0)
            {
                return;
            }

            DialogResult dr = MessageBox.Show("Bạn Có Muốn Xóa ?", "XÓA NHÂN VIÊN", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dr == DialogResult.Yes)
            {
                if (dgv_DSNhanVien.SelectedRows.Count >= 1)
                {
                    NhanVien_WCFClient nv_wcf;

                    for (int i = 0; i < dgv_DSNhanVien.SelectedRows.Count; i++)
                    {
                        email  = dgv_DSNhanVien.SelectedRows[i].Cells[6].Value.ToString().Trim();
                        nv_wcf = new NhanVien_WCFClient();
                        if (!nv_wcf.XoaNhanVien_by_Email(email))
                        {
                            break;
                        }
                    }

                    nv_wcf = new NhanVien_WCFClient();
                    Loading_DSNhanVien(DataTable_DSNhanVien(nv_wcf.GetNhanViens().ToList()));
                    Custom_DataGridView(dgv_DSNhanVien);
                }
            }
            else
            {
                return;
            }
        }
예제 #16
0
        private void btnLuuDatPhong_Click(object sender, EventArgs e)
        {
            TimeSpan date = dtpNgayTraPhong.Value - DateTime.Now.Date;

            if (date.Days <= 0)
            {
                MessageBox.Show("Nhập Ngày Lớn Hơn Ngày Hiện Tại", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpNgayTraPhong.Focus();
                return;
            }

            Phong_WCFClient        ph_wcf    = new Phong_WCFClient();
            NhanVien_WCFClient     nv_wcf    = new NhanVien_WCFClient();
            PhieuCheckIn_WCFClient phieu_wcf = new PhieuCheckIn_WCFClient();
            PhieuCheckIn_Ent       p_ent     = new PhieuCheckIn_Ent();

            if (!CheckNull())
            {
                MessageBox.Show("Chưa Nhập Đủ Thông Tin", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            p_ent.Id_khach      = Convert.ToInt32(maKH);
            p_ent.Id_NhanVien   = ID_NV;
            p_ent.Id_Phong      = ph_wcf.getIDPhong(cbx_SoPhong.Text);
            p_ent.Giam_gia      = Convert.ToDouble(txtGiamGia.Text);
            p_ent.SoLuongKhach  = Convert.ToInt32(cbox_SoNguoi.Text);
            p_ent.Ngay_check_in = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            TimeSpan gio_in = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);

            p_ent.Gio_check_in   = gio_in;
            p_ent.Ngay_check_out = Convert.ToDateTime(dtpNgayTraPhong.Text.ToString());
            TimeSpan gio_out = new TimeSpan(14, 00, 00);

            //p_ent.Id_DichVu = 0;

            p_ent.Gio_check_out = gio_out;
            if (phieu_wcf.ThemPhieuCheckIn(p_ent))
            {
                DialogResult ds = MessageBox.Show("Lưu Thành Công, Tiếp Tục ?", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (ds == DialogResult.OK)
                {
                    List <PhieuCheckIn_Ent> list = new List <PhieuCheckIn_Ent>();
                    list = phieu_wcf.lsPhieuCheckIn_ToDate(DateTime.Now.Date).ToList();
                    ph_wcf.update_TinhTrangPhong(p_ent.Id_Phong, 1);
                    Loading_DSP(DataTable_DSP(list));
                    Custom_DataGridView(dgv_DSPhieuCheckIn);
                    return;
                }
            }
            else
            {
                DialogResult ds = MessageBox.Show("Lưu Thất Bại, Thử Lại ?", "Lỗi", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (ds == DialogResult.Yes)
                {
                    return;
                }
                else
                {
                    this.Close();
                }
            }
        }
예제 #17
0
        private void Luu_Them()
        {
            if (!CheckNull())
            {
                MessageBox.Show("Chưa Nhập Đủ Thông Tin", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!txtMatKhau.Text.Trim().Equals(txtNhapLai.Text.Trim()))
            {
                MessageBox.Show("Mật Khẩu Không Giống Nhau", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();

            NhanVien_Ent nv_ent = new NhanVien_Ent();

            nv_ent.Ho  = txtHo.Text.Trim();
            nv_ent.Ten = txtTen.Text.Trim();


            if (cbx_GioiTinh.SelectedIndex == 0)
            {
                nv_ent.GioiTinh = "nam";
            }
            if (cbx_GioiTinh.SelectedIndex == 1)
            {
                nv_ent.GioiTinh = "nu";
            }

            nv_ent.NgaySinh = dtp_NgaySinh.Value;

            if (cbx_ChucVu.SelectedIndex == 0)
            {
                nv_ent.ChucVu = "quanly";
            }
            if (cbx_ChucVu.SelectedIndex == 1)
            {
                nv_ent.ChucVu = "nhanvien";
            }


            if (cbx_CaLamViec.SelectedIndex == 0)
            {
                nv_ent.CaLamViec = "sang";
            }
            if (cbx_CaLamViec.SelectedIndex == 1)
            {
                nv_ent.CaLamViec = "chieu";
            }
            if (cbx_CaLamViec.SelectedIndex == 2)
            {
                nv_ent.CaLamViec = "toi";
            }

            nv_ent.Email = txtEmail.Text.Trim();

            string matKhau = maHoaMatKhau(txtNhapLai.Text.Trim());

            if (nv_wcf.ThemNhanVien(nv_ent, matKhau))
            {
                DialogResult ds = MessageBox.Show("Lưu Thành Công, Tiếp Tục ?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (ds == DialogResult.Yes)
                {
                    Clear_TextBox();
                    return;
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                DialogResult ds = MessageBox.Show("Lưu Thất Bại, Thử Lại ?", "LỖI", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (ds == DialogResult.Yes)
                {
                    return;
                }
                else
                {
                    this.Close();
                }
            }
        }
예제 #18
0
        private void Luu_Sua()
        {
            if (!CheckNull())
            {
                MessageBox.Show("Chưa Nhập Đủ Thông Tin", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient();

            NhanVien_Ent nv_ent = new NhanVien_Ent();

            nv_ent.Ho  = txtHo.Text.Trim();
            nv_ent.Ten = txtTen.Text.Trim();

            //Nam
            if (cbx_GioiTinh.SelectedIndex == 0)
            {
                nv_ent.GioiTinh = "nam";
            }
            //Nữ
            if (cbx_GioiTinh.SelectedIndex == 1)
            {
                nv_ent.GioiTinh = "nu";
            }

            nv_ent.NgaySinh = dtp_NgaySinh.Value;

            //Quản Lý
            if (cbx_ChucVu.SelectedIndex == 0)
            {
                nv_ent.ChucVu = "quanly";
            }
            //Nhân Viên
            if (cbx_ChucVu.SelectedIndex == 1)
            {
                nv_ent.ChucVu = "nhanvien";
            }

            //Sáng
            if (cbx_CaLamViec.SelectedIndex == 0)
            {
                nv_ent.CaLamViec = "sang";
            }
            //Chiều
            if (cbx_CaLamViec.SelectedIndex == 1)
            {
                nv_ent.CaLamViec = "chieu";
            }
            //Tối
            if (cbx_CaLamViec.SelectedIndex == 2)
            {
                nv_ent.CaLamViec = "toi";
            }

            nv_ent.Email = txtEmail.Text.Trim();

            //Xử Lý Update
            if (nv_wcf.CapNhatNhanVien(nv_ent, old_email))
            {
                DialogResult ds = MessageBox.Show("Lưu Thành Công, Tiếp Tục ?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (ds == DialogResult.Yes)
                {
                    return;
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                DialogResult ds = MessageBox.Show("Lưu Thất Bại, Thử Lại ?", "LỖI", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (ds == DialogResult.Yes)
                {
                    return;
                }
                else
                {
                    this.Close();
                }
            }
        }