// This partial method gives us a way to access an object after it has been updated in the system. static partial void OnUpdated(Helpers.ApiContext apiContext, Entities.EventStatus eventStatus, bool isBulkUpdate);
/// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="apiContext"></param> /// <param name="product_Service_ImagesList"></param> /// <returns></returns> public static Helpers.ActionResult Update(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.Product_Service_Images> product_Service_ImagesList) { return(Update(apiContext, product_Service_ImagesList, false)); }
/// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="apiContext"></param> /// <param name="product_Service_ImagesList"></param> /// <param name="clientWins">if true system properties will not be overwritten by Api</param> /// <returns></returns> public static Helpers.ActionResult Update(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.Product_Service_Images> product_Service_ImagesList, System.Boolean clientWins) { // API doesn't allow null parameters. This method requires at least 1 item in the collection. if (apiContext == null) { throw new System.ArgumentNullException("apiContext"); } if (product_Service_ImagesList == null) { throw new System.ArgumentNullException("product_Service_ImagesList"); } if (product_Service_ImagesList.Count() == 0) { throw new System.ArgumentOutOfRangeException("product_Service_ImagesList"); } // Verify user is authorized to perform action, otherwise throw exception. Security.SecurityHandler.SetApiContext(apiContext); Helpers.ActionResult result = Helpers.ActionResult.Factory(true); try { Model.OrmsContext context = (Model.OrmsContext)apiContext.CurrentContext; foreach (Entities.Product_Service_Images product_Service_Images in product_Service_ImagesList) { OnUpdating(apiContext, product_Service_Images, false); // ATTACH object AttachObject(apiContext, "Product_Service_Images", product_Service_Images); if (!clientWins) { // SET system level properties SetSystemProperties(apiContext, product_Service_Images); } // SET modified SetModified(apiContext, product_Service_Images); } if (clientWins) { context.Refresh(System.Data.Objects.RefreshMode.ClientWins, product_Service_ImagesList); } context.SaveChanges(); // Save Changes DetachObjects(apiContext, product_Service_ImagesList); // Clean ObjectState cache foreach (Entities.Product_Service_Images product_Service_Images in product_Service_ImagesList) { OnUpdated(apiContext, product_Service_Images, false); } } catch (System.Data.OptimisticConcurrencyException ex) { object forDebugging = ex; HandleOptimisticConcurrencyException(apiContext, product_Service_ImagesList, ex, ref result); //throw Helpers.Exceptions.OptimisticConcurrencyException.Factory(ex); } catch (System.Exception ex) { object forDebugging = ex; throw; // Helpers.Exceptions.UpdateEntityException.Factory(ex); } return(result); }
/// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="apiContext"></param> /// <param name="warrantyCards"></param> /// <returns></returns> public static Helpers.ActionResult BulkUpdate(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.WarrantyCard> warrantyCards) { // API doesn't allow null parameters. This method requires at least 1 item in the collection. if (apiContext == null) { throw new System.ArgumentNullException("apiContext"); } if (warrantyCards == null) { throw new System.ArgumentNullException("warrantyCards"); } if (warrantyCards.Count() == 0) { throw new System.ArgumentOutOfRangeException("warrantyCards"); } // Verify user is authorized to perform action, otherwise throw exception. Security.SecurityHandler.SetApiContext(apiContext); Helpers.ActionResult result = Helpers.ActionResult.Factory(true); try { Model.OrmsContext context = (Model.OrmsContext)apiContext.CurrentContext; OnBulkUpdating(apiContext, warrantyCards); foreach (Entities.WarrantyCard warrantyCard in warrantyCards) { OnUpdating(apiContext, warrantyCard, true); // ATTACH object AttachObject(apiContext, "WarrantyCards", warrantyCard); // SET system level properties SetSystemProperties(apiContext, warrantyCard); SetSystemPropertiesModified(apiContext, warrantyCard); // PARTIAL update OnPartialUpdate(apiContext, warrantyCard); } context.SaveChanges(); // Save Changes DetachObjects(apiContext, warrantyCards); // Clean ObjectState cache foreach (Entities.WarrantyCard warrantyCard in warrantyCards) { OnUpdated(apiContext, warrantyCard, true); } OnBulkUpdated(apiContext, warrantyCards); } catch (System.Data.OptimisticConcurrencyException ex) { object forDebugging = ex; HandleOptimisticConcurrencyException(apiContext, warrantyCards, ex, ref result); //throw Helpers.Exceptions.OptimisticConcurrencyException.Factory(ex); } catch (System.Exception ex) { object forDebugging = ex; throw; // Helpers.Exceptions.UpdateEntityException.Factory(ex); } return(result); }
/// <summary> /// HandleOptimisticConcurrencyException /// </summary> /// <param name="apiContext"></param> /// <param name="product_Service_ImagesList"></param> /// <param name="exception"></param> /// <param name="result"></param> public static void HandleOptimisticConcurrencyException(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.Product_Service_Images> product_Service_ImagesList, System.Exception exception, ref Helpers.ActionResult result) { result.Messages.Add(Helpers.ActionResultMessage.Factory(null, Helpers.ActionResultMessageCode.VLD_013, Helpers.ActionResultMessageType.Error)); result.WasSuccessful = false; }
// This partial method gives us a way to update an object before it is imported into the system. static partial void OnImporting(Helpers.ApiContext apiContext, Entities.WarrantyCard warrantyCard);
// This partial method gives us a way to access an object during it is bulk updated in the system. static partial void OnPartialUpdate(Helpers.ApiContext apiContext, Entities.WarrantyCard warrantyCard);
/// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="apiContext"></param> /// <param name="system_Social_UsersAssociationList"></param> /// <returns></returns> public static Helpers.ActionResult Update(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.System_Social_UsersAssociation> system_Social_UsersAssociationList) { return(Update(apiContext, system_Social_UsersAssociationList, false)); }
// This partial method gives us a way to access an object after it has been updated in the system. static partial void OnUpdated(Helpers.ApiContext apiContext, Entities.System_Social_UsersAssociation system_Social_UsersAssociation, bool isBulkUpdate);
// This partial method gives us a way to access an object after it has been validated in the system. static partial void OnValidated(Helpers.ApiContext apiContext, Entities.EventStatus eventStatus, ref Helpers.ActionResult result);
// This partial method gives us a way to access an object after it has been purged from the system. static partial void OnPurged(Helpers.ApiContext apiContext, Entities.EventStatus eventStatus);
// This partial method gives us a way to access an object during it is bulk updated in the system. static partial void OnPartialUpdate(Helpers.ApiContext apiContext, Entities.EventStatus eventStatus);
// This partial method gives us a way to access an object after it has been bulk updated in the system. static partial void OnBulkUpdated(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.EventStatus> eventStatuses);
// This partial method gives us a way to update an object before it is imported into the system. static partial void OnImporting(Helpers.ApiContext apiContext, Entities.EventStatus eventStatus);
/// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="apiContext"></param> /// <param name="warrantyCards"></param> /// <returns></returns> public static Helpers.ActionResult Update(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.WarrantyCard> warrantyCards) { return(Update(apiContext, warrantyCards, false)); }
// This partial method gives us a way to access an object after it has been bulk updated in the system. static partial void OnBulkUpdated(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.System_Social_UsersAssociation> system_Social_UsersAssociationList);
// This partial method gives us a way to access an object after it has been updated in the system. static partial void OnUpdated(Helpers.ApiContext apiContext, Entities.WarrantyCard warrantyCard, bool isBulkUpdate);
// This partial method gives us a way to access an object after it has been validated in the system. static partial void OnValidated(Helpers.ApiContext apiContext, Entities.System_Social_UsersAssociation system_Social_UsersAssociation, ref Helpers.ActionResult result);
// This partial method gives us a way to access an object after it has been bulk updated in the system. static partial void OnBulkUpdated(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.WarrantyCard> warrantyCards);
// This partial method gives us a way to access an object after it has been purged from the system. static partial void OnPurged(Helpers.ApiContext apiContext, Entities.System_Social_UsersAssociation system_Social_UsersAssociation);
// This partial method gives us a way to access an object after it has been validated in the system. static partial void OnValidated(Helpers.ApiContext apiContext, Entities.WarrantyCard warrantyCard, ref Helpers.ActionResult result);
// This partial method gives us a way to update an object before it is imported into the system. static partial void OnImporting(Helpers.ApiContext apiContext, Entities.Products_Services products_Services);
// This partial method gives us a way to access an object after it has been purged from the system. static partial void OnPurged(Helpers.ApiContext apiContext, Entities.WarrantyCard warrantyCard);
// This partial method gives us a way to access an object after it has been bulk updated in the system. static partial void OnBulkUpdated(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.Products_Services> products_ServicesList);
/// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="apiContext"></param> /// <param name="product_Service_ImagesList"></param> /// <param name="columnExpression"></param> /// <returns></returns> public static Helpers.ActionResult PartialUpdate(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.Product_Service_Images> product_Service_ImagesList, params System.Linq.Expressions.Expression <System.Func <Entities.Product_Service_Images, object> >[] columnExpression) { // API doesn't allow null parameters. This method requires at least 1 item in the collection. if (apiContext == null) { throw new System.ArgumentNullException("apiContext"); } if (product_Service_ImagesList == null) { throw new System.ArgumentNullException("product_Service_ImagesList"); } if (product_Service_ImagesList.Count() == 0) { throw new System.ArgumentOutOfRangeException("product_Service_ImagesList"); } if (columnExpression == null) { throw new System.ArgumentNullException("columnExpression"); } if (columnExpression.Count() == 0) { throw new System.ArgumentOutOfRangeException("columnExpression"); } ValidateColumnExpression <Entities.Product_Service_Images>(columnExpression); Helpers.ActionResult result = Helpers.ActionResult.Factory(true); try { Model.OrmsContext context = (Model.OrmsContext)apiContext.CurrentContext; foreach (Entities.Product_Service_Images product_Service_Images in product_Service_ImagesList) { // ATTACH object AttachObject(apiContext, "Product_Service_Images", product_Service_Images); // SET system level properties SetSystemProperties(apiContext, product_Service_Images); SetSystemPropertiesModified(apiContext, product_Service_Images); // SET IsActive property modified System.Data.Objects.ObjectStateEntry ose = apiContext.CurrentContext.ObjectStateManager.GetObjectStateEntry(product_Service_Images); foreach (var item in columnExpression) { ose.SetModifiedProperty(item.GetPropertyName()); } } context.SaveChanges(); // Save Changes DetachObjects(apiContext, product_Service_ImagesList); // Clean ObjectState cache } catch (System.Data.OptimisticConcurrencyException ex) { object forDebugging = ex; HandleOptimisticConcurrencyException(apiContext, product_Service_ImagesList, ex, ref result); } catch (System.Exception ex) { object forDebugging = ex; throw; // Helpers.Exceptions.UpdateEntityException.Factory(ex); } return(result); }
// This partial method gives us a way to access an object after it has been validated in the system. static partial void OnValidated(Helpers.ApiContext apiContext, Entities.Products_Services products_Services, ref Helpers.ActionResult result);
// This partial method gives us a way to access an object after it has been added to the system. static partial void OnAdded(Helpers.ApiContext apiContext, Entities.Product_Service_Images product_Service_Images);
// This partial method gives us a way to access an object after it has been purged from the system. static partial void OnPurged(Helpers.ApiContext apiContext, Entities.Products_Services products_Services);
// This partial method gives us a way to update an object before it is updated in the system. static partial void OnUpdating(Helpers.ApiContext apiContext, Entities.Product_Service_Images product_Service_Images, bool isBulkUpdate);
/// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="apiContext"></param> /// <param name="eventStatuses"></param> /// <returns></returns> public static Helpers.ActionResult Update(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.EventStatus> eventStatuses) { return(Update(apiContext, eventStatuses, false)); }