public void EditMSCTTru(int id, string field, string oldvalue, string newvalue, object BangCTMB) { daChiTieu dCT = new daChiTieu(); dCT.MSCT.MSCT = newvalue; daChiTieuMSCT dMSCT = new daChiTieuMSCT(); dMSCT.PT.IDMauBieu = ucChiTieuMB1.IDmauBieu; dMSCT.PT.IDChiTieu = ucChiTieuMB1.IDChiTieu; if (newvalue == "") { dMSCT.PT.MSCT = oldvalue; dMSCT.XoaMSCTTru(); ucChiTieuMB1.MSCTTruOK(id, true); return; } if (dCT.TimMSCT() == null) { ucChiTieuMB1.MSCTTruOK(id, false); X.Msg.Alert("", "Không tìm thấy chỉ tiêu trong STK1 có mã là: " + newvalue).Show(); } else { dMSCT.PT.MSCT = newvalue; dMSCT.ThemMSCTTru(); ucChiTieuMB1.MSCTTruOK(id, true); } }
public void EditDSTru(int id, string field, string oldvalue, string newvalue, object BangCTMB) { daChiTieu dCT = new daChiTieu(); dCT.CTTim.Ma = newvalue; dCT.CTTim.Nhom = Nhom; daChiTieuDanSuat dDS = new daChiTieuDanSuat(); dDS.PT.IDMauBieu = ucChiTieuMB1.IDmauBieu; dDS.PT.IDChiTieu = ucChiTieuMB1.IDChiTieu; if (newvalue == "") { dDS.PT.MaChiTieuDanSuat = oldvalue; dDS.XoaDanSuatTru(); ucChiTieuMB1.DSruOK(id, true); return; } if (dCT.Tim() == null) { ucChiTieuMB1.DSruOK(id, false); X.Msg.Alert("", "Không tìm thấy chỉ tiêu dẫn suất có mã là: " + newvalue).Show(); } else { dDS.PT.IDChiTieuDanSuat = dCT.CTTim.ID; dDS.PT.MaChiTieuDanSuat = newvalue.ToUpper(); dDS.PT.HeSo = 1; dDS.ThemDanSuatTru(); ucChiTieuMB1.DSruOK(id, true); } }
public void EditDSNhan(int id, string field, string oldvalue, string newvalue, object BangCTMB) { if (field != "MaChiTieuDanSuat") { return; } daChiTieu dCT = new daChiTieu(); dCT.CTTim.Ma = newvalue; dCT.CTTim.Nhom = Nhom; daChiTieuDanSuat dDS = new daChiTieuDanSuat(); dDS.PT.IDMauBieu = ucChiTieuMB1.IDmauBieu; dDS.PT.IDChiTieu = ucChiTieuMB1.IDChiTieu; if (newvalue == "") { dDS.PT.MaChiTieuDanSuat = oldvalue; dDS.XoaDanSuatNhan(); ucChiTieuMB1.DSNhanOK(id, true); return; } if (dCT.Tim() == null) { ucChiTieuMB1.DSNhanOK(id, false); X.Msg.Alert("", "Không tìm thấy chỉ tiêu dẫn suất có mã là: " + newvalue).Show(); } else { dDS.PT.IDChiTieuDanSuat = dCT.CTTim.ID; dDS.PT.MaChiTieuDanSuat = newvalue.ToUpper(); Newtonsoft.Json.Linq.JObject node = JSON.Deserialize <Newtonsoft.Json.Linq.JObject>(BangCTMB.ToString()); try { dDS.PT.HeSo = Decimal.Parse(node.Property("HeSo").Value.ToString()); } catch { dDS.PT.HeSo = 1; } dDS.ThemDanSuatNhan(); ucChiTieuMB1.DSNhanOK(id, true); } }