/// <summary> /// Save /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { MaterialsInformationTDS materialsInformationChanges = (MaterialsInformationTDS)Data.GetChanges(); if (materialsInformationChanges.BasicInformation.Rows.Count > 0) { MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGateway = new MaterialsInformationBasicInformationGateway(materialsInformationChanges); // Update services foreach (MaterialsInformationTDS.BasicInformationRow basicInformationRow in (MaterialsInformationTDS.BasicInformationDataTable)materialsInformationChanges.BasicInformation) { // Unchanged values int materialId = basicInformationRow.MaterialID; bool deleted = basicInformationRow.Deleted; // Original values string originalDescription = materialsInformationBasicInformationGateway.GetDescriptionOriginal(materialId); string originalSize = materialsInformationBasicInformationGateway.GetSizeOriginal(materialId); string originalLength = materialsInformationBasicInformationGateway.GetLengthOriginal(materialId); string originalThickness = materialsInformationBasicInformationGateway.GetThicknessOriginal(materialId); string originalType = materialsInformationBasicInformationGateway.GetTypeOriginal(materialId); string originalState = materialsInformationBasicInformationGateway.GetStateOriginal(materialId); // New variables string newDescription = materialsInformationBasicInformationGateway.GetDescription(materialId); string newSize = materialsInformationBasicInformationGateway.GetSize(materialId); string newLength = materialsInformationBasicInformationGateway.GetLength(materialId); string newThickness = materialsInformationBasicInformationGateway.GetThickness(materialId); string newType = materialsInformationBasicInformationGateway.GetType(materialId); string newState = materialsInformationBasicInformationGateway.GetState(materialId); // ... Update Materials materials = new Materials(null); materials.UpdateDirect(materialId, originalDescription, originalSize, originalLength, originalThickness, originalType, originalState, deleted, companyId, materialId, newDescription, newSize, newLength, newThickness, newType, newState, deleted, companyId); } } }