예제 #1
0
        public ActionResult DocLogs_save()
        {
            var parameters = AjaxModel.GetAjaxParameters(HttpContext);
            var mng        = new DocsManager();
            var res        = false;
            var savedID    = 0;

            try
            {
                var fields     = (parameters["fields"] as ArrayList).ToArray().ToList().Select(x => x as Dictionary <string, object>).ToList();
                var id         = RDL.Convert.StrToInt(AjaxModel.GetValueFromSaveField("id", fields), 0);
                var createdBy  = Membership.GetUser().UserName;
                var docID      = RDL.Convert.StrToInt(AjaxModel.GetValueFromSaveField("name", fields), 0);
                var isDownload = RDL.Convert.StrToBoolean(AjaxModel.GetValueFromSaveField("isDownload", fields));
                var created    = DateTime.Now;
                var item       = new doc_docLogs {
                    id = id, createdBy = createdBy, docID = docID, isDownload = isDownload, created = created
                };


                mng.SaveDocLogs(item);
                savedID = item.id;
                res     = true;
            }
            catch (Exception ex)
            {
                res = false;
            }
            return(Json(new
            {
                result = res,
                savedID = savedID,
                msg = ""
            }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
 public int SaveDocLogs(doc_docLogs item)
 {
     try
     {
         if (item.id == 0)
         {
             db.doc_docLogs.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);
 }
예제 #3
0
        public doc_docLogs GetDocLog(int id)
        {
            var res = new doc_docLogs();

            res = db.GetDocLog(id);
            return(res);
        }
예제 #4
0
 public void SaveDocLogs(doc_docLogs item)
 {
     try
     {
         db.SaveDocLogs(item);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }
예제 #5
0
        public bool DocLog(int docId, bool isDown)
        {
            var mng = new DocsManager();
            var res = false;

            try
            {
                var id         = 0;
                var docID      = docId;
                var createdBy  = Membership.GetUser().UserName;
                var isDownload = isDown;
                var created    = DateTime.Now;
                var item       = new doc_docLogs {
                    id = id, docID = docID, isDownload = isDownload, created = created, createdBy = createdBy
                };

                mng.SaveDocLogs(item);
                res = true;
            }
            catch (Exception ex) {
                RDL.Debug.LogError(ex);
            }
            return(res);
        }