public Procurementcontract CreateProcurementcontract(Procurementcontract info, List<Procurementcontractdetail> detailInfos) { var coderuleManagement = new CoderuleManagement(Management); info.Contractid = coderuleManagement.GenerateCodeRule(Procurementcontract.RuleCode+DateTime.Today.ToString("yyyyMM"), false); foreach (var detailInfo in detailInfos) { detailInfo.Contractid = info.Contractid; } var detailManagement = new ProcurementcontractdetailManagement(Management); try { Management.BeginTransaction(); Management.CreateProcurementcontract(info); foreach (var detailInfo in detailInfos) { detailManagement.CreateProcurementcontractdetail(detailInfo); } Management.Commit(); } catch { Management.Rollback(); throw; } return info; }
public Assetscrapped CreateAssetscrapped(Assetscrapped info) { try { var coderuleManagement = new CoderuleManagement(Management); info.Assetscrappedid = coderuleManagement.GenerateCodeRule(Assetscrapped.ScrappedRuleCode + DateTime.Today.ToString("yyyyMM"), false); Management.BeginTransaction(); Management.CreateAssetscrapped(info); Management.Commit(); } catch { Management.Rollback(); throw; } return info; }