public int SaveDocs(doc_docs item)
 {
     try
     {
         if (item.id == 0)
         {
             db.doc_docs.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 #2
0
        public doc_docs GetDoc(int id)
        {
            var res = new doc_docs();

            res = db.GetDoc(id);
            return(res);
        }
Exemple #3
0
        public ActionResult DocEdit(doc_docs item)
        {
            var mng = new DocsManager();

            mng.SaveDoc(item);

            return(Json(new { result = true }));
        }
Exemple #4
0
 public void SaveDoc(doc_docs item)
 {
     try
     {
         db.SaveDocs(item);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }
Exemple #5
0
        public ActionResult CreateDoc(string name, string number, string path, int typeID, int projectID, int contragentID)
        {
            var mng      = new DocsManager();
            int statusID = 1;
            var item     = new doc_docs {
                id           = 0,
                name         = name,
                number       = number,
                path         = path,
                typeID       = typeID,
                statusID     = statusID,
                projectID    = projectID,
                contragentID = contragentID,
                created      = DateTime.Now.Date,
                createdBy    = new BLL.Core.CoreManager().GetUserGuid()
            };

            mng.SaveDoc(item);
            return(Json(new
            {
                result = item.id > 0,
                savedID = item.id,
            }, JsonRequestBehavior.AllowGet));
        }