Exemple #1
0
        public Mikhailova_statuses_contracts GetStatusContract(int id)
        {
            var res = new Mikhailova_statuses_contracts();

            res = db.GetStatusContract(id);
            return(res);
        }
Exemple #2
0
 public int SaveStatusContract(Mikhailova_statuses_contracts item)
 {
     try
     {
         if (item.id == 0)
         {
             db.Mikhailova_statuses_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);
 }
Exemple #3
0
 public void SaveStatusContract(Mikhailova_statuses_contracts item)
 {
     try
     {
         db.SaveStatusContract(item);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }
Exemple #4
0
        public int SaveStatusContract(Mikhailova_statuses_contracts item, bool withSave = true)
        {
            var res = 0;

            try
            {
                res = _db.SaveStatusContract(item);
            }
            catch (Exception ex)
            {
                _debug(ex, new { item }, "item");
            }
            return(res);
        }
Exemple #5
0
 public int SaveStatusContract(Mikhailova_statuses_contracts element, bool withSave = true)
 {
     if (element.id == 0)
     {
         db.Mikhailova_statuses_contracts.Add(element);
     }
     else
     {
         db.Entry(element).State = EntityState.Modified;
     }
     if (withSave)
     {
         Save();
     }
     return(element.id);
 }
Exemple #6
0
        public bool EditDocumentStatusField(aspnet_Users user, int id, string code, string value, out string msg)
        {
            bool res            = false;
            var  documentStatus = new Mikhailova_statuses_contracts();

            try
            {
                if (!_IsCanUserChange(user))
                {
                    msg = "Недостаточна прав для редактирования!";
                }
                else
                {
                    documentStatus = GetStatusContract(id);

                    if (documentStatus != null)
                    {
                        switch (code)
                        {
                        case "name": documentStatus.name = value;
                            break;

                        case "code": documentStatus.code = value;
                            break;
                        }
                        SaveStatusContract(documentStatus);
                        res = true;
                        msg = "Успешно";
                    }
                    else
                    {
                        msg = "Не удалось найти статус документ";
                    }
                }
            }
            catch (Exception ex)
            {
                _debug(ex, new { }, "");
                msg = "Произошла ошибка, поле не изменено";
            }
            return(res);
        }
Exemple #7
0
        public Mikhailova_statuses_contracts GetStatusContract(int id)
        {
            var res = new Mikhailova_statuses_contracts();
            var key = "gl_docStatuses" + id;

            if (CacheManager.EnableCaching && CacheManager.Cache[key] != null)
            {
                res = (Mikhailova_statuses_contracts)CacheManager.Cache[key];
            }
            else
            {
                try
                {
                    res = _db.GetStatusesContract().FirstOrDefault(x => x.id == id);
                    CacheManager.CacheData(key, res);
                }
                catch (Exception ex)
                {
                    _debug(ex, new { id }, "id");
                }
            }
            return(res);
        }