/// <summary>
 /// Create a new stores_data object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="url">Initial value of the url property.</param>
 /// <param name="api_key">Initial value of the api_key property.</param>
 public static stores_data Createstores_data(global::System.Int32 id, global::System.String name, global::System.String url, global::System.String api_key)
 {
     stores_data stores_data = new stores_data();
     stores_data.id = id;
     stores_data.name = name;
     stores_data.url = url;
     stores_data.api_key = api_key;
     return stores_data;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the stores_data EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTostores_data(stores_data stores_data)
 {
     base.AddObject("stores_data", stores_data);
 }
Exemplo n.º 3
0
        public int AddStore(StoreDto store)
        {
            var context = new orderstatusEntities();
            try
            {
                stores_data storeContext = new stores_data();
                storeContext.name = store.Name;
                storeContext.api_key = store.ApiKey;
                storeContext.url = store.Url;
                storeContext.interval = store.Interval;
                storeContext.last_run = DateTime.Now;

                storeContext.dateCreated = DateTime.Now;
                storeContext.dateModified = DateTime.Now;
                storeContext.isActive = 1;
                context.stores_data.AddObject(storeContext);
                context.SaveChanges();
                return storeContext.id;
            }
            catch (InvalidOperationException exc)
            {
                AccessConnectionHandler.log.Error(exc);
                return 0;
            }
            catch (ArgumentNullException exc)
            {
                AccessConnectionHandler.log.Error(exc);
                return 0;
            }
            catch (NullReferenceException exc)
            {
                AccessConnectionHandler.log.Error(exc);
                return 0;
            }
            catch (OptimisticConcurrencyException exc)
            {
                AccessConnectionHandler.log.Error(exc);
                return 0;
            }
            catch (UpdateException exc)
            {
                AccessConnectionHandler.log.Error(exc);
                return 0;
            }
            finally
            {
                context.Dispose();
            }
        }