public int Save(BO.p19Material rec) { if (rec.p20ID == 0) { _db.CurrentUser.AddMessage("Chybí vyplnit měrná jednotka."); return(0); } var p = new DL.Params4Dapper(); p.AddInt("pid", rec.p19ID); p.AddInt("p20ID", rec.p20ID, true); if (rec.j02ID_Owner == 0) { rec.j02ID_Owner = _db.CurrentUser.j02ID; } p.AddInt("j02ID_Owner", rec.j02ID_Owner, true); p.AddInt("p28ID", rec.p28ID, true); if (_db.CurrentUser.j03EnvironmentFlag == 2 && rec.p28ID != _db.CurrentUser.p28ID) { _db.CurrentUser.AddMessage("V klientském režimu se pořizuje materiál na míru klienta. Musíte záznam svázat s klientem s vazbou na váš profil."); return(0); } p.AddEnumInt("p19TypeFlag", rec.p19TypeFlag); p.AddInt("p10ID_Master", rec.p10ID_Master, true); p.AddString("p19Name", rec.p19Name); p.AddString("p19Code", rec.p19Code); p.AddString("p19Memo", rec.p19Memo); p.AddString("p19Supplier", rec.p19Supplier); p.AddString("p19Intrastat", rec.p19Intrastat); p.AddString("p19NameAlias", rec.p19NameAlias); p.AddString("p19ITSINC", rec.p19ITSINC); p.AddString("p19ITSCAS", rec.p19ITSCAS); p.AddString("p19ITSEINECS", rec.p19ITSEINECS); p.AddString("p19Lang1", rec.p19Lang1); p.AddString("p19Lang2", rec.p19Lang2); p.AddString("p19Lang3", rec.p19Lang3); p.AddString("p19Lang4", rec.p19Lang4); p.AddDouble("p19StockActual", rec.p19StockActual); p.AddDouble("p19StockReserve", rec.p19StockReserve); p.AddDateTime("p19StockDate", rec.p19StockDate); return(_db.SaveRecord("p19Material", p.getDynamicDapperPars(), rec)); }
public int Save(BO.p10MasterProduct rec) { if (ValidateBeforeSave(rec) == false) { return(0); } var p = new DL.Params4Dapper(); p.AddInt("pid", rec.p10ID); p.AddInt("p13ID", rec.p13ID, true); if (rec.pid == 0) { rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p10", rec.b02ID); //startovací workflow stav } p.AddInt("b02ID", rec.b02ID, true); p.AddInt("p20ID", rec.p20ID, true); p.AddInt("p20ID_Pro", rec.p20ID_Pro, true); p.AddString("p10Name", rec.p10Name); p.AddString("p10Code", rec.p10Code); p.AddString("p10Memo", rec.p10Memo); p.AddDouble("p10RecalcUnit2Kg", rec.p10RecalcUnit2Kg); p.AddEnumInt("p10TypeFlag", rec.p10TypeFlag); p.AddString("p10PackagingCode", rec.p10PackagingCode); p.AddDouble("p10Davka", rec.p10Davka); p.AddDouble("p10DavkaMin", rec.p10DavkaMin); p.AddDouble("p10DavkaMax", rec.p10DavkaMax); p.AddDouble("p10SalesPerMonth", rec.p10SalesPerMonth); p.AddDouble("p10UnitsPerPalette", rec.p10UnitsPerPalette); int intPID = _db.SaveRecord("p10MasterProduct", p.getDynamicDapperPars(), rec); var recP19 = _mother.p19MaterialBL.LoadByMasterP10ID(intPID); if (rec.p10TypeFlag == BO.ProductTypeEnum.Polotovar || rec.p10TypeFlag == BO.ProductTypeEnum.Vyrobek) //zkopírovat polotovar nebo výrobek do surovin p19 { if (recP19 == null) { recP19 = new BO.p19Material(); } recP19.p10ID_Master = intPID; recP19.p19Name = rec.p10Name; recP19.p19Code = rec.p10Code; recP19.p20ID = rec.p20ID; recP19.p19Memo = rec.p10Memo; if (rec.p10TypeFlag == BO.ProductTypeEnum.Polotovar) { recP19.p19TypeFlag = BO.p19TypeFlagEnum.Polotovar; } if (rec.p10TypeFlag == BO.ProductTypeEnum.Vyrobek) { recP19.p19TypeFlag = BO.p19TypeFlagEnum.Vyrobek; } _mother.p19MaterialBL.Save(recP19); } else { if (recP19 != null) { _mother.CBL.DeleteRecord("p19", recP19.pid); } } return(intPID); }