public ActionResult DocVersions_save() { var parameters = AjaxModel.GetAjaxParameters(HttpContext); var mng = new DocsManager(); var res = false; int 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 decs = AjaxModel.GetValueFromSaveField("decs", fields); var created = DateTime.Now; var item = new doc_docVersions { id = id, createdBy = createdBy, docID = docID, decs = decs, created = created }; mng.SaveDocVersions(item); savedID = item.id; res = true; } catch (Exception ex) { res = false; } return(Json(new { result = res, savedID = savedID, msg = "" }, JsonRequestBehavior.AllowGet)); }
public bool DocLogVersion(int docId, string note) { var mng = new DocsManager(); var res = false; try { var id = 0; var createdBy = Membership.GetUser().UserName; var docID = docId; var decs = note; var created = DateTime.Now; var item = new doc_docVersions { id = id, createdBy = createdBy, docID = docID, decs = decs, created = created }; mng.SaveDocVersions(item); res = true; } catch (Exception ex) { res = false; } return(res); }
public int SaveDocVersion(doc_docVersions item) { try { if (item.id == 0) { db.doc_docVersions.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 doc_docVersions GetDocVersion(int id) { var res = new doc_docVersions(); res = db.GetDocVersion(id); return(res); }
public void SaveDocVersions(doc_docVersions item) { try { db.SaveDocVersion(item); } catch (Exception ex) { RDL.Debug.LogError(ex); } }
public doc_docVersions GetDocVersion(int id) { doc_docVersions res = db.doc_docVersions.FirstOrDefault(x => x.id == id); return(res); }