/// <summary> /// Deprecated Method for adding a new object to the custom_shipments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTocustom_shipments(custom_shipments custom_shipments) { base.AddObject("custom_shipments", custom_shipments); }
/// <summary> /// Create a new custom_shipments object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="storeId">Initial value of the storeId property.</param> public static custom_shipments Createcustom_shipments(global::System.Int32 id, global::System.Int32 storeId) { custom_shipments custom_shipments = new custom_shipments(); custom_shipments.id = id; custom_shipments.storeId = storeId; return custom_shipments; }
public void CreateCustomShipments(List<string> names, int storeId) { var context = new orderstatusEntities(); try { foreach (var name in names) { custom_shipments customShipments = new custom_shipments(); customShipments.name = name; customShipments.storeId = storeId; customShipments.dateCreated = DateTime.Now; customShipments.dateModified = DateTime.Now; customShipments.isActive = 1; context.custom_shipments.AddObject(customShipments); context.SaveChanges(); } } catch (InvalidOperationException exc) { AccessConnectionHandler.log.Error(exc); } catch (ArgumentNullException exc) { AccessConnectionHandler.log.Error(exc); } catch (NullReferenceException exc) { AccessConnectionHandler.log.Error(exc); } catch (OptimisticConcurrencyException exc) { AccessConnectionHandler.log.Error(exc); } catch (UpdateException exc) { AccessConnectionHandler.log.Error(exc); } finally { context.Dispose(); } }