public void SaveDocument(rosh_documents res, aspnet_Users user, out string msg) { msg = ""; try { if (!_CanChangeDocument(user)) { msg = "Нет прав для данной операции"; } else { db.SaveDocument(res); msg = "Документ успешно сохранен!"; int savedDocID = res.id; //ChangeDocument(savedDocID); } } catch (Exception ex) { //RDL.Debug.LogError(ex); _debug(ex, new { res }, ""); } }
public rosh_documents GetDocument(int id) { var res = new rosh_documents(); res = db.rosh_documents.FirstOrDefault(o => o.id == id); return(res); }
public int SaveDocument(rosh_documents res) { try { if (res.id == 0) { db.rosh_documents.Add(res); db.SaveChanges(); } else { try { db.Entry(res).State = EntityState.Modified; db.SaveChanges(); } catch (OptimisticConcurrencyException ex) { RDL.Debug.LogError(ex); } } } catch (Exception ex) { RDL.Debug.LogError(ex); } return(res.id); }
public ActionResult Documents_createItem(int docTypeID, string docNumber, int contragentID, int docStatusID, string amount, string description) { string msg = ""; var user = mng.GetUser(); var item = new rosh_documents { id = 0, docDate = DateTime.Now.Date, docTypeID = docTypeID, docNumber = docNumber, contragentID = contragentID, docStatusID = docStatusID, amount = Convert.ToDecimal(amount), description = description, }; mng.Documents.SaveDocument(item, user, out msg); return(Json(new { result = item.id > 0, savedID = item.id, msg = msg }, JsonRequestBehavior.AllowGet)); }
public rosh_documents GetDocument(int id) { var res = new rosh_documents(); try { res = db.GetDocument(id); } catch (Exception ex) { _debug(ex, new { id }, ""); } return(res); }