/// <summary> /// Save all catalysts to database (direct) /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { FlCatalystsAddTDS flCatalystsAddChanges = (FlCatalystsAddTDS)Data.GetChanges(); if (flCatalystsAddChanges.FlCatalystsAdd.Rows.Count > 0) { FlCatalystsAddGateway flCatalystsAddGateway = new FlCatalystsAddGateway(flCatalystsAddChanges); foreach (FlCatalystsAddTDS.FlCatalystsAddRow row in (FlCatalystsAddTDS.FlCatalystsAddDataTable)flCatalystsAddChanges.FlCatalystsAdd) { // Insert new catalysts if ((!row.Deleted) && (!row.InDatabase)) { WorkFullLengthLiningCatalysts workFullLengthLiningCatalysts = new WorkFullLengthLiningCatalysts(null); workFullLengthLiningCatalysts.InsertDirect(row.CatalystID, row.Name, row.DefaultPercentageByWeight, row.Deleted, row.COMPANY_ID); } //Update catalysts if ((!row.Deleted) && (row.InDatabase)) { int catalystId = row.CatalystID; bool originalDeleted = false; int originalCompanyId = companyId; // original values string originalName = flCatalystsAddGateway.GetNameOriginal(catalystId); decimal originalDefaultPercentageByWeight = flCatalystsAddGateway.GetDefaultPercentageByWeightOriginal(catalystId); // new values string newName = flCatalystsAddGateway.GetName(catalystId); decimal newDefaultPercentageByWeight = flCatalystsAddGateway.GetDefaultPercentageByWeight(catalystId); WorkFullLengthLiningCatalysts workFullLengthLiningCatalysts = new WorkFullLengthLiningCatalysts(null); workFullLengthLiningCatalysts.UpdateDirect(catalystId, originalName, originalDefaultPercentageByWeight, originalDeleted, originalCompanyId, catalystId, newName, newDefaultPercentageByWeight, originalDeleted, originalCompanyId); } // Deleted catalysts if ((row.Deleted) && (row.InDatabase)) { WorkFullLengthLiningCatalysts workFullLengthLiningCatalysts = new WorkFullLengthLiningCatalysts(null); workFullLengthLiningCatalysts.DeleteDirect(row.CatalystID, row.COMPANY_ID); } } } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// LoadAll /// </summary> /// <param name="companyId">companyId</param> public void LoadAll(int companyId) { FlCatalystsAddGateway flCatalystsAddGateway = new FlCatalystsAddGateway(Data); flCatalystsAddGateway.LoadAll(companyId); }
/// <summary> /// LoadByCatalystId /// </summary> /// <param name="catalystId">catalystId</param> /// <param name="companyId">companyId</param> public void LoadByCatalystId(int catalystId,int companyId) { FlCatalystsAddGateway flCatalystsAddGateway = new FlCatalystsAddGateway(Data); flCatalystsAddGateway.LoadByCatalystId(catalystId, companyId); }