Beispiel #1
0
        public bool EditDocumentTypeField(int id, string code,
                                          string value, out string msg)
        {
            bool res     = false;
            var  docType = new udovika_contractType();

            try
            {
                docType = GetDocumentType(id);

                if (docType != null)
                {
                    switch (code)
                    {
                    case "name": docType.name = value;
                        break;
                    }
                    SaveDocumentType(docType);
                    res = true;
                    msg = "Успешно.";
                }
                else
                {
                    msg = "Ошибка. Неизвестный статус.";
                }
            }
            catch (Exception ex)
            {
                _debug(ex, new { }, "");
                msg = "Ошибка. Тип документа не сохранен.";
            }
            return(res);
        }
Beispiel #2
0
 public int SaveDocumentType(udovika_contractType item)
 {
     if (item.id == 0)
     {
         db.udovika_contractType.Add(item);
     }
     else
     {
         db.Entry(item).State = System.Data.Entity.EntityState.Modified;
         Save();
     }
     return(item.id);
 }
Beispiel #3
0
        public int SaveDocumentType(udovika_contractType item)
        {
            var res = 0;

            try
            {
                res = db.SaveDocumentType(item);
            }
            catch (Exception ex)
            {
                _debug(ex, new { item }, "item");
            }
            return(res);
        }
Beispiel #4
0
        public udovika_contractType GetDocumentType(int id)
        {
            var res = new udovika_contractType();

            try
            {
                res = db.GetDocumentTypes().FirstOrDefault(x => x.id == id);
            }
            catch (Exception ex)
            {
                _debug(ex, new { }, "");
            }
            return(res);
        }