Exemple #1
0
 public int SaveProcessItem(proc_processItems element)
 {
     try
     {
         if (element.id == 0)
         {
             db.proc_processItems.Add(element);
             db.SaveChanges();
         }
         else
         {
             try
             {
                 db.Entry(element).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 RDL.Debug.LogError(ex);
             }
         }
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
     return(element.id);
 }
Exemple #2
0
 public int SaveOrders(crm_orders item)
 {
     try
     {
         if (item.id == 0)
         {
             db.crm_orders.Add(item);
             db.SaveChanges();
         }
         else
         {
             try
             {
                 db.Entry(item).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 RDL.Debug.LogError(ex);
             }
         }
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
     return(item.id);
 }
 public int SaveImage(as_images item)
 {
     try
     {
         if (item.id == 0)
         {
             db.as_images.Add(item);
             db.SaveChanges();
         }
         else
         {
             try
             {
                 db.Entry(item).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 RDL.Debug.LogError(ex);
             }
         }
         CacheManager.PurgeCacheItems("as_images_" + item.typeCode + "_" + item.itemID);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
     return(item.id);
 }
Exemple #4
0
 public int SaveFile(as_files item)
 {
     try
     {
         if (item.id == 0)
         {
             db.as_files.Add(item);
             db.SaveChanges();
         }
         else
         {
             try
             {
                 db.Entry(item).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 Debug.LogError(ex);
             }
         }
         CacheManager.PurgeCacheItems(GetCacheKey(item));
     }
     catch (Exception ex)
     {
         Debug.LogError(ex);
     }
     return(item.id);
 }
 public int SaveTable(SmallDataTest element)
 {
     try
     {
         int res = GetTableItem(element.productID, element.UserName);
         if (res == 0)
         {
             db.SmallDataTest.Add(element);
             db.SaveChanges();
         }
         else
         {
             element.id = res;
             try
             {
                 db.Entry(element).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 RDL.Debug.LogError(ex);
             }
         }
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
     return(1);
 }
 public int SaveItem(as_favorites favorite)
 {
     if (favorite.id == 0)
     {
         db.as_favorites.Add(favorite);
         db.SaveChanges();
     }
     else
     {
         try
         {
             db.Entry(favorite).State = EntityState.Modified;
             db.SaveChanges();
         }
         catch (OptimisticConcurrencyException ex)
         {
             RDL.Debug.LogError(ex);
         }
     }
     return(favorite.id);
 }
Exemple #7
0
        public bool Save()
        {
            bool res = false;

            try
            {
                db.SaveChanges();
                res = true;
            }
            catch (Exception e)
            {
                RDL.Debug.LogError(e);
            }

            return(res);
        }
Exemple #8
0
 public int SaveContract(Mikhailova_contracts item)
 {
     try
     {
         if (item.id == 0)
         {
             db.Mikhailova_contracts.Add(item);
             db.SaveChanges();
         }
         else
         {
             try
             {
                 db.Entry(item).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 RDL.Debug.LogError(ex);
             }
         }
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
     return(item.id);
 }