Пример #1
0
        void EditEmployee(enuEdit enuNew_Edit)
        {
            if (bdsEmployee.Position < 0 && enuNew_Edit == enuEdit.Edit)
            {
                return;
            }

            //Copy hang hien tai
            if (bdsEmployee.Position >= 0)
            {
                Common.CopyDataRow(((DataRowView)bdsEmployee.Current).Row, ref drCurrent);
            }
            else
            {
                drCurrent = dtEmployee.NewRow();
            }

            frmEmployee_Edit frmEdit = new frmEmployee_Edit();

            frmEdit.Load(enuNew_Edit, drCurrent);

            //Accept
            if (frmEdit.isAccept)
            {
                if (enuNew_Edit == enuEdit.New)
                {
                    if (bdsEmployee.Position >= 0)
                    {
                        dtEmployee.ImportRow(drCurrent);
                    }
                    else
                    {
                        dtEmployee.Rows.Add(drCurrent);
                    }
                    dtEmployee             = HRMCommon.GetCustomerTable("MA_KV");
                    bdsEmployee.DataSource = dtEmployee;
                    tlDmCbNv.DataSource    = bdsEmployee;
                    bdsEmployee.Position   = bdsEmployee.Find("MA_CBNV", drCurrent["MA_CBNV"]);
                }
                else
                {
                    Common.CopyDataRow(drCurrent, ((DataRowView)bdsEmployee.Current).Row);
                }

                dtEmployee.AcceptChanges();
            }
        }
Пример #2
0
        //void btNew_Click(object sender, EventArgs e)
        //{
        //    if (tabEmployee.Focused || pageEmployee.Focused || tlDmCbNv.Focused)
        //        this.EditEmployee(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageGiaDinh || dgvGiaDinh.Focused)
        //        this.EditGiaDinh(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageDaoTao || dgvDaoTao.Focused)
        //        this.EditDaoTao(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageCongTac || dgvCongTac.Focused)
        //        this.EditCongTac(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageKhenThuong || dgvKhenThuong.Focused)
        //        this.EditKhenThuong(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageHopDong || dgvHopDong.Focused)
        //        this.EditHopDong(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageNghiPhep || dgvNghiPhep.Focused)
        //        this.EditNghiPhep(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageBaoHiem || dgvBaoHiem.Focused)
        //        this.EditBaoHiem(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageDanhGia || dgvDanhGia.Focused)
        //        this.EditDanhGia(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageKinhNghiem || dgvKinhNghiem.Focused)
        //        this.EditKinhNghiem(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageKyNang || dgvKyNang.Focused)
        //        this.EditKyNang(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageTuyenDung || dgvTuyenDung.Focused)
        //        this.EditTuyenDung(enuEdit.New);
        //    else if (tabDetail.SelectedTab == pageThue || dgvThue.Focused)
        //        this.EditThue(enuEdit.New);
        //}
        //void btEdit_Click(object sender, EventArgs e)
        //{
        //    if (tabEmployee.Focused || pageEmployee.Focused || tlDmCbNv.Focused)
        //        this.EditEmployee(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageGiaDinh || dgvGiaDinh.Focused)
        //        this.EditGiaDinh(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageDaoTao || dgvDaoTao.Focused)
        //        this.EditDaoTao(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageCongTac || dgvCongTac.Focused)
        //        this.EditCongTac(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageKhenThuong || dgvKhenThuong.Focused)
        //        this.EditKhenThuong(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageHopDong || dgvHopDong.Focused)
        //        this.EditHopDong(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageNghiPhep || dgvNghiPhep.Focused)
        //        this.EditNghiPhep(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageBaoHiem || dgvBaoHiem.Focused)
        //        this.EditBaoHiem(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageDanhGia || dgvDanhGia.Focused)
        //        this.EditDanhGia(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageKinhNghiem || dgvKinhNghiem.Focused)
        //        this.EditKinhNghiem(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageKyNang || dgvKyNang.Focused)
        //        this.EditKyNang(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageTuyenDung || dgvTuyenDung.Focused)
        //        this.EditTuyenDung(enuEdit.Edit);
        //    else if (tabDetail.SelectedTab == pageThue || dgvThue.Focused)
        //        this.EditThue(enuEdit.Edit);
        //}

        //void btDelete_Click(object sender, EventArgs e)
        //{
        //    if (tabEmployee.Focused || pageEmployee.Focused || tlDmCbNv.Focused)
        //        this.DeleteEmployee();
        //    else if (tabDetail.SelectedTab == pageGiaDinh || dgvGiaDinh.Focused)
        //        this.DeleteGiaDinh();
        //    else if (tabDetail.SelectedTab == pageDaoTao || dgvDaoTao.Focused)
        //        this.DeleteDaoTao();
        //    else if (tabDetail.SelectedTab == pageCongTac || dgvCongTac.Focused)
        //        this.DeleteCongTac();
        //    else if (tabDetail.SelectedTab == pageKhenThuong || dgvKhenThuong.Focused)
        //        this.DeleteKhenThuong();
        //    else if (tabDetail.SelectedTab == pageHopDong || dgvHopDong.Focused)
        //        this.DeleteHopDong();
        //    else if (tabDetail.SelectedTab == pageNghiPhep || dgvNghiPhep.Focused)
        //        this.DeleteNghiPhep();
        //    else if (tabDetail.SelectedTab == pageBaoHiem || dgvBaoHiem.Focused)
        //        this.DeleteBaoHiem();
        //    else if (tabDetail.SelectedTab == pageDanhGia || dgvDanhGia.Focused)
        //        this.DeleteDanhGia();
        //    else if (tabDetail.SelectedTab == pageKinhNghiem || dgvKinhNghiem.Focused)
        //        this.DeleteKinhNghiem();
        //    else if (tabDetail.SelectedTab == pageKyNang || dgvKyNang.Focused)
        //        this.DeleteKyNang();
        //    else if (tabDetail.SelectedTab == pageTuyenDung || dgvTuyenDung.Focused)
        //        this.DeleteTuyenDung();
        //    else if (tabDetail.SelectedTab == pageThue || dgvThue.Focused)
        //        this.DeleteThue();
        //}

        void EditEmployee(enuEdit enuNew_Edit)
        {
            if (bdsEmployee.Position < 0 && enuNew_Edit == enuEdit.Edit)
            {
                return;
            }

            //Copy hang hien tai
            if (bdsEmployee.Position >= 0)
            {
                Common.CopyDataRow(((DataRowView)bdsEmployee.Current).Row, ref drCurrent);
            }
            else
            {
                drCurrent = dtEmployee.NewRow();
            }

            frmEmployee_Edit frmEdit = new frmEmployee_Edit();

            frmEdit.Load(enuNew_Edit, drCurrent);

            //Người dùng chọn chấp nhận
            if (frmEdit.isAccept)
            {
                if (enuNew_Edit == enuEdit.New)
                {
                    if (bdsEmployee.Position >= 0)
                    {
                        dtEmployee.ImportRow(drCurrent);
                    }
                    else
                    {
                        dtEmployee.Rows.Add(drCurrent);
                    }

                    bdsEmployee.Position = bdsEmployee.Find("MA_CBNV", drCurrent["MA_CBNV"]);
                }
                else
                {
                    Common.CopyDataRow(drCurrent, ((DataRowView)bdsEmployee.Current).Row);
                }

                dtEmployee.AcceptChanges();
            }
        }