public Error InsertOrUpdateProductCompliance(ProductComplianceModel productCompliance, string lockGuid) { Error error = ValidateModel(productCompliance); if (!error.IsError) { // Check that the lock is still current if (!db.IsLockStillValid(typeof(ProductCompliance).ToString(), productCompliance.Id, lockGuid)) { error.SetError(EvolutionResources.errRecordChangedByAnotherUser, "ComplianceCategoryId"); } else { ProductCompliance temp = null; if (productCompliance.Id != 0) { temp = db.FindProductCompliance(productCompliance.Id); } if (temp == null) { temp = new ProductCompliance(); } Mapper.Map(productCompliance, temp); db.InsertOrUpdateProductCompliance(temp); productCompliance.Id = temp.Id; } } return(error); }
private ProductComplianceModel createProductCompliance(CompanyModel testCompany, ProductModel product) { var cc = LookupService.FindLOVItemsModel(testCompany, LOVName.ComplianceCategory).FirstOrDefault(); var market = LookupService.FindLOVItemsModel(testCompany, LOVName.MarketingLocation).FirstOrDefault(); var model = new ProductComplianceModel(); model.ProductId = product.Id; model.ComplianceCategoryId = cc.Id; model.ComplianceCategoryText = cc.ItemText; model.MarketId = market.Id; model.MarketNameText = market.ItemText; return(model); }
public ProductComplianceModel FindProductComplianceModel(int id, int productId, bool bCreateEmptyIfNotfound = true) { ProductComplianceModel model = null; var p = db.FindProductCompliance(id); if (p == null) { if (bCreateEmptyIfNotfound) { model = new ProductComplianceModel { ProductId = productId } } ; } else { model = MapToModel(p); } return(model); }
public Error ValidateModel(ProductComplianceModel model) { var error = new Error(); return(error); }
public string LockProductCompliance(ProductComplianceModel model) { return(db.LockRecord(typeof(ProductCompliance).ToString(), model.Id)); }
public void AddMediaToProductCompliance(ProductComplianceModel productCompliance, MediaModel media) { db.AddMediaToProductCompliance(productCompliance.Id, media.Id); }