private void cap_nhat_gd_cong_tac()
 {
     US_GD_CONG_TAC v_us = new US_GD_CONG_TAC();
     v_us.dcID_NHAN_VIEN = CIPConvert.ToDecimal(m_sle_chon_nhan_vien.EditValue);
     v_us.dcID_DON_VI = CIPConvert.ToDecimal(m_sle_don_vi.EditValue);
     v_us.datNGAY_BAT_DAU = m_dat_ngay_bat_dau.DateTime;
     if (m_dat_ngay_ket_thuc.DateTime != DateTime.MinValue)
         v_us.datNGAY_KET_THUC = m_dat_ngay_ket_thuc.DateTime;
     v_us.datNGAY_LAP = DateTime.Now;
     v_us.strNGUOI_LAP = CAppContext_201.getCurrentUserName();
     v_us.strDA_XOA = "N";
     v_us.dcID_LOAI_CONG_TAC = 157;
     v_us.dcID_VI_TRI = CIPConvert.ToDecimal(m_sle_chuc_vu.EditValue);
     v_us.dcSO_HO_SO = BKI_DichVuMatDat.COMMON.ExecuteFuntion.GetSoHoSoNext(v_us.dcID_DON_VI, v_us.dcID_VI_TRI, v_us.dcID_NHAN_VIEN);
     v_us.UseTransOfUSObject(m_us_gd_hd);
     v_us.Insert();
     v_us.CommitTransaction();
 }
コード例 #2
0
        private void save_data()
        {
            if(m_grv_cong_tac.RowCount < 1)
            {
                XtraMessageBox.Show("Chưa có dữ liệu để lưu!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if(!check_all_is_ok())
            {
                return;
            }
            SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false);
            US_GD_CONG_TAC v_us_gd_ct = new US_GD_CONG_TAC();
            int v_i_row = 0;
            try
            {

                for(v_i_row = 0; v_i_row < m_grv_cong_tac.RowCount; v_i_row++)
                {
                    v_us_gd_ct.BeginTransaction();
                    v_us_gd_ct.ClearAllFields();
                    var data = m_grv_cong_tac.GetDataRow(v_i_row);
                    grid_to_us_gd_cong_tac(v_us_gd_ct, data);
                    v_us_gd_ct.Insert();
                    v_us_gd_ct.CommitTransaction();
                    SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, (int)((decimal)v_i_row / (decimal)m_grv_cong_tac.RowCount * 100));
                }

                //Sau do phai cap nhat lai so ho so, chua biet lam

                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữ liệu thành công");
            }
            catch(Exception)
            {
                if(v_us_gd_ct.is_having_transaction())
                {
                    v_us_gd_ct.Rollback();
                }
                if(v_i_row >= 1)
                {
                    throw new Exception("Có lỗi xảy ra. Dữ liệu lưu chưa thành công!\nĐã lưu thành công đến dòng thứ " + v_i_row + " với mã nhân viên " + m_grv_cong_tac.GetRowCellValue(v_i_row - 1, ExcelCongTac.MA_NHAN_VIEN).ToString());
                }
                else
                {
                    throw new Exception("Có lỗi xảy ra. Dữ liệu lưu chưa được lưu!");
                }
                throw;
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
コード例 #3
0
        private void save_data()
        {
            US_GD_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            US_GD_CONG_TAC v_us_gd_cong_tac = new US_GD_CONG_TAC();
            US_GD_HE_SO_LNS v_us_gd_hs_lns = new US_GD_HE_SO_LNS();
            try
            {
                for (int i = 0; i < m_grv_hop_dong.RowCount; i++)
                {
                    var data = m_grv_hop_dong.GetDataRow(i);
                    //
                    grid_to_us_gd_hop_dong(v_us_gd_hd, data);
                    grid_to_us_gd_cong_tac(v_us_gd_cong_tac, data);
                    grid_to_us_gd_lns(v_us_gd_hs_lns, data);

                    //decimal v_id_hop_dong = get_id_hop_dong_hien_tai(v_us_gd_hd.dcID_NHAN_VIEN.ToString());

                    //
                    v_us_gd_hd.BeginTransaction();
                    //if (v_id_hop_dong != 0)
                    //{
                    //    ket_thuc_hop_dong_cu(v_id_hop_dong, v_us_gd_hd.datNGAY_BAT_DAU);
                    //}
                    v_us_gd_cong_tac.UseTransOfUSObject(v_us_gd_hd);
                    //v_us_gd_cong_tac.CapNhatHetHieuLucCongTac(v_us_gd_hd.dcID_NHAN_VIEN, v_us_gd_hd.datNGAY_BAT_DAU);
                    v_us_gd_hs_lns.UseTransOfUSObject(v_us_gd_hd);
                    //v_us_gd_hs_lns.KetThucLuongNangSuatNhanVien(v_us_gd_hd.dcID_NHAN_VIEN, v_us_gd_hd.datNGAY_BAT_DAU);
                    v_us_gd_hs_lns.Insert();
                    v_us_gd_hd.Insert();
                    v_us_gd_cong_tac.Insert();
                    v_us_gd_hd.CommitTransaction();
                }
                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữu liệu thành công");
            }
            catch (Exception)
            {
                if (v_us_gd_hd.is_having_transaction())
                {
                    v_us_gd_hd.Rollback();
                }
                throw;
            }
        }
 private void save_for_lam_thoi_cong_tac(US_GD_CONG_TAC ip_us_ct_lam_thoi)
 {
     try
     {
         ip_us_ct_lam_thoi.BeginTransaction();
         ip_us_ct_lam_thoi.CapNhatHetHieuLucCongTacChinhThucHoacLamThoi(ip_us_ct_lam_thoi.dcID_NHAN_VIEN, ip_us_ct_lam_thoi.datNGAY_BAT_DAU.AddDays(-1));
         ip_us_ct_lam_thoi.Insert();
         ip_us_ct_lam_thoi.CommitTransaction();
         CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
         Close();
     }
     catch(Exception)
     {
         if(ip_us_ct_lam_thoi.is_having_transaction())
         {
             ip_us_ct_lam_thoi.Rollback();
         }
         throw;
     }
 }
 private void save_for_kiem_nhiem_cong_tac(US_GD_CONG_TAC ip_us_ct_lam_thoi)
 {
     try
     {
         ip_us_ct_lam_thoi.BeginTransaction();
         ip_us_ct_lam_thoi.Insert();
         ip_us_ct_lam_thoi.CommitTransaction();
         CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
         Close();
     }
     catch(Exception)
     {
         if(ip_us_ct_lam_thoi.is_having_transaction())
         {
             ip_us_ct_lam_thoi.Rollback();
         }
         throw;
     }
 }
 private void save_for_chuyen_cong_tac(US_GD_CONG_TAC ip_us_ct_hien_tai)
 {
     try
     {
         if(ip_us_ct_hien_tai.KiemTraNhanVienCoCongTacChua(ip_us_ct_hien_tai.dcID_NHAN_VIEN, ip_us_ct_hien_tai.dcID_DON_VI))
         {
             XtraMessageBox.Show("Nhân viên đang làm việc ở đơn vị này rồi!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         ip_us_ct_hien_tai.BeginTransaction();
         ip_us_ct_hien_tai.CapNhatHetHieuLucCongTacChinhThucHoacLamThoi(ip_us_ct_hien_tai.dcID_NHAN_VIEN, ip_us_ct_hien_tai.datNGAY_BAT_DAU.AddDays(-1));
         ip_us_ct_hien_tai.Insert();
         ip_us_ct_hien_tai.CommitTransaction();
         CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
         Close();
     }
     catch(Exception)
     {
         if(ip_us_ct_hien_tai.is_having_transaction())
         {
             ip_us_ct_hien_tai.Rollback();
         }
         throw;
     }
 }
 private void save_data()
 {
     US_GD_CONG_TAC v_us_gd_ct = new US_GD_CONG_TAC();
     form_2_us_gd_cong_tac(ref v_us_gd_ct);
     try
     {
         switch(m_e_loai_cap_nhat)
         {
             case e_loai_cap_nhat.THEM_MOI_CONG_TAC:
                 v_us_gd_ct.Insert();
                 CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
                 break;
             case e_loai_cap_nhat.LAM_THOI_CONG_TAC:
                 save_for_lam_thoi_cong_tac(v_us_gd_ct);
                 break;
             case e_loai_cap_nhat.KIEM_NHIEM_CONG_TAC:
                 save_for_kiem_nhiem_cong_tac(v_us_gd_ct);
                 break;
             case e_loai_cap_nhat.CHUYEN_CONG_TAC:
                 save_for_chuyen_cong_tac(v_us_gd_ct);
                 break;
             case e_loai_cap_nhat.CHAM_DUT_CONG_TAC:
                 save_for_cham_dut_cong_tac(v_us_gd_ct);
                 break;
             case e_loai_cap_nhat.UPDATE:
                 v_us_gd_ct.Update();
                 break;
             default:
                 break;
         }
     }
     catch(Exception v_e)
     {
         v_us_gd_ct.Rollback();
         CSystemLog_301.ExceptionHandle(v_e);
     }
 }
        private void save_data()
        {
            US_GD_CONG_TAC v_us_gd_ct = new US_GD_CONG_TAC();
            form_2_us_gd_cong_tac(v_us_gd_ct);
            try
            {
                switch (m_e_form_mode)
                {
                    case DataEntryFormMode.InsertDataState:
                        if (m_id_gd_ct != -1)
                        {
                            //Nhan vien da co GD cong tac
                            if (m_loai_ctac_cthuc == true && CIPConvert.ToDecimal(m_sle_chon_loai_cong_tac.EditValue) == CONST_ID_LOAI_CONG_TAC.CHINH_THUC)
                            {
                                cho_gd_ct_da_xoa_Y();
                            }
                        }

                        v_us_gd_ct.BeginTransaction();
                        v_us_gd_ct.Insert();
                        v_us_gd_ct.CommitTransaction();
                        break;
                    case DataEntryFormMode.UpdateDataState:
                        v_us_gd_ct.BeginTransaction();
                        v_us_gd_ct.Update();
                        v_us_gd_ct.CommitTransaction();
                        break;
                    default:
                        break;
                }
            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
            }
        }
        private void save_data()
        {
            if(check_hop_le())
            {
                form_to_us_hd();
                switch(m_e_form_mode)
                {
                    case DataEntryFormMode.InsertDataState:
                        m_us_gd_hd.BeginTransaction();
                        m_us_gd_hd.Insert();

                        //var v_dlg = XtraMessageBox.Show("Thêm hợp đồng mới thành công.\nBạn có muốn cập nhật công tác cho nhân viên này?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        //if(v_dlg == System.Windows.Forms.DialogResult.Yes)
                        //{
                        //    f309_quan_ly_cong_tac v_frm = new f309_quan_ly_cong_tac();
                        //    v_frm.display_after_insert_hop_dong(ExecuteFuntion.LayMaNhanVien(m_us_gd_hd.dcID_NHAN_VIEN));
                        //}
                        if(!ExecuteFuntion.KiemTraNhanVienCoCongTac(m_us_gd_hd.dcID_NHAN_VIEN))
                        {
                            XtraMessageBox.Show("Nhân viên chưa có công tác, hệ thống sẽ tự động cập nhật công tác theo hợp đồng!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            US_GD_CONG_TAC v_us = new US_GD_CONG_TAC();
                            v_us.dcID_DON_VI = m_us_gd_hd.dcID_DON_VI;
                            v_us.dcID_LOAI_CONG_TAC = CONST_ID_LOAI_CONG_TAC.CHINH_THUC;
                            v_us.dcID_NHAN_VIEN = m_us_gd_hd.dcID_NHAN_VIEN;
                            v_us.dcID_VI_TRI = m_us_gd_hd.dcID_CHUC_VU;
                            v_us.dcSO_HO_SO = ExecuteFuntion.GetSoHoSoNext(m_us_gd_hd.dcID_DON_VI, m_us_gd_hd.dcID_CHUC_VU, m_us_gd_hd.dcID_NHAN_VIEN);
                            v_us.strDA_XOA = "N";
                            v_us.strNGUOI_LAP = CAppContext_201.getCurrentUserName();
                            v_us.datNGAY_LAP = DateTime.Now.Date;
                            v_us.datNGAY_BAT_DAU = m_us_gd_hd.datNGAY_BAT_DAU;
                            v_us.UseTransOfUSObject(m_us_gd_hd);
                            v_us.Insert();
                        }
                        m_us_gd_hd.CommitTransaction();
                        XtraMessageBox.Show("Thêm hợp đồng mới thành công!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        break;
                    case DataEntryFormMode.UpdateDataState:
                        m_us_gd_hd.Update();
                        //var v_dlg_update = XtraMessageBox.Show("Sửa hợp đồng thành công.\nBạn có muốn cập nhật công tác cho nhân viên này?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        //if(v_dlg_update == System.Windows.Forms.DialogResult.Yes)
                        //{
                        //    f309_quan_ly_cong_tac v_frm = new f309_quan_ly_cong_tac();
                        //    v_frm.display_after_insert_hop_dong(ExecuteFuntion.LayMaNhanVien(m_us_gd_hd.dcID_NHAN_VIEN));
                        //}
                        XtraMessageBox.Show("Sửa hợp đồng thành công!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        break;
                    default:
                        break;
                }
                Close();
            }
        }
コード例 #10
0
        private void save_data()
        {
            if(m_grv_hop_dong.RowCount < 1)
            {
                XtraMessageBox.Show("Chưa có dữ liệu để lưu!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if(!check_all_is_ok())
            {
                return;
            }
            SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false);
            US_GD_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            int v_i_row = 0;
            try
            {
                for(v_i_row = 0; v_i_row < m_grv_hop_dong.RowCount; v_i_row++)
                {
                    v_us_gd_hd.ClearAllFields();
                    var data = m_grv_hop_dong.GetDataRow(v_i_row);
                    grid_to_us_gd_hop_dong(v_us_gd_hd, data);
                    v_us_gd_hd.BeginTransaction();
                    v_us_gd_hd.Insert();
                    if(!ExecuteFuntion.KiemTraNhanVienCoCongTac(v_us_gd_hd.dcID_NHAN_VIEN))
                    {
                        US_GD_CONG_TAC v_us = new US_GD_CONG_TAC();
                        v_us.dcID_DON_VI = v_us_gd_hd.dcID_DON_VI;
                        v_us.dcID_LOAI_CONG_TAC = CONST_ID_LOAI_CONG_TAC.CHINH_THUC;
                        v_us.dcID_NHAN_VIEN = v_us_gd_hd.dcID_NHAN_VIEN;
                        v_us.dcID_VI_TRI = v_us_gd_hd.dcID_CHUC_VU;
                        v_us.dcSO_HO_SO = ExecuteFuntion.GetSoHoSoNext(v_us_gd_hd.dcID_DON_VI, v_us_gd_hd.dcID_CHUC_VU, v_us_gd_hd.dcID_NHAN_VIEN);
                        v_us.strDA_XOA = "N";
                        v_us.strNGUOI_LAP = CAppContext_201.getCurrentUserName();
                        v_us.datNGAY_LAP = DateTime.Now.Date;
                        v_us.datNGAY_BAT_DAU = v_us_gd_hd.datNGAY_BAT_DAU;
                        v_us.UseTransOfUSObject(v_us_gd_hd);
                        v_us.Insert();
                    }
                    v_us_gd_hd.CommitTransaction();
                    SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, (int)((decimal)v_i_row / (decimal)m_grv_hop_dong.RowCount * 100));
                }

                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữ liệu thành công");
            }
            catch(Exception)
            {
                if(v_us_gd_hd.is_having_transaction())
                {
                    v_us_gd_hd.Rollback();
                }
                if(v_i_row >= 1)
                {
                    throw new Exception("Có lỗi xảy ra. Dữ liệu lưu chưa thành công!\nĐã lưu thành công đến dòng thứ " + v_i_row + " với mã nhân viên " + m_grv_hop_dong.GetRowCellValue(v_i_row - 1, ExcelHopDong.MA_NHAN_VIEN).ToString());
                }
                else
                {
                    throw new Exception("Có lỗi xảy ra. Dữ liệu lưu chưa được lưu!");
                }
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
        private void save_data()
        {
            US_GD_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            US_GD_CONG_TAC v_us_gd_cong_tac = new US_GD_CONG_TAC();
            US_GD_HE_SO_LNS v_us_gd_hs_lns = new US_GD_HE_SO_LNS();
            try
            {
                for(int i = 0; i < m_grv_hop_dong.RowCount; i++)
                {
                    var data = m_grv_hop_dong.GetDataRow(i);
                    //
                    grid_to_us_gd_hop_dong(v_us_gd_hd, data);
                    grid_to_us_gd_cong_tac(v_us_gd_cong_tac, data);
                    grid_to_us_gd_lns(v_us_gd_hs_lns, data);

                    v_us_gd_hd.BeginTransaction();
                    v_us_gd_cong_tac.UseTransOfUSObject(v_us_gd_hd);
                    v_us_gd_cong_tac.Insert();
                    v_us_gd_hs_lns.UseTransOfUSObject(v_us_gd_hd);
                    v_us_gd_hs_lns.Insert();
                    v_us_gd_hd.Insert();

                    v_us_gd_hd.CommitTransaction();
                }
                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữu liệu thành công");
            }
            catch(Exception)
            {
                if(v_us_gd_hd.is_having_transaction())
                {
                    v_us_gd_hd.Rollback();
                }
                throw;
            }
        }