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 cap_nhat_gd_he_so_lns() { if(m_txt_he_so_lns.EditValue == null) { return; } US_GD_HE_SO_LNS v_us = new US_GD_HE_SO_LNS(); v_us.dcID_NHAN_VIEN = CIPConvert.ToDecimal(m_sle_chon_nhan_vien.EditValue); v_us.datNGAY_BAT_DAU = m_dat_ngay_bat_dau.DateTime.Date; if (m_dat_ngay_ket_thuc.EditValue != null) v_us.datNGAY_KET_THUC = m_dat_ngay_ket_thuc.DateTime.Date; v_us.datNGAY_LAP = DateTime.Now.Date; v_us.strNGUOI_LAP = CAppContext_201.getCurrentUserName(); v_us.dcHE_SO = Convert.ToDecimal(m_txt_he_so_lns.Text); v_us.dcID_HE_SO_LNS = find_id_hs_lns(); v_us.UseTransOfUSObject(m_us_gd_hd); v_us.KetThucLuongNangSuatNhanVien(v_us.dcID_NHAN_VIEN, m_dat_ngay_bat_dau.DateTime.Date); v_us.Insert(); //v_us.CommitTransaction(); }
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; } }