public ActionResult CreateReclamation(string name, int statusID, string customerText, int haveWOW, int projectID, string reportDate) { var mng = new CRMManager(); int y = Convert.ToInt32(reportDate.Substring(6)); int m = Convert.ToInt32(reportDate.Substring(3, 2)); int d = Convert.ToInt32(reportDate.Substring(0, 2)); var item = new recl_items { id = 0, addedBy = User.Identity.Name, name = name, statusID = statusID, created = DateTime.Now.Date, haveWOW = haveWOW == 1 ? true : false, customerText = customerText, projectID = projectID, reportDate = new DateTime(y, m, d) }; mng.SaveReclamation(item); return Json(new { result = item.id > 0, savedID = item.id, }, JsonRequestBehavior.AllowGet); }
public int SaveReclamation(recl_items element) { try { if (element.id == 0) { db.recl_items.Add(element); db.SaveChanges(); } else { try { db.Entry(element).State = EntityState.Modified; db.SaveChanges(); } catch (OptimisticConcurrencyException ex) { RDL.Debug.LogError(ex); } } } catch (Exception ex) { RDL.Debug.LogError(ex); } return(element.id); }
public recl_items GetReclamation(int id) { var res = new recl_items(); res = db.recl_items.FirstOrDefault(x => x.id == id); return(res); }
public ActionResult ReclamationsGetText(int id, string code) { var res = false; var text = ""; var mng = new CRMManager(); var r = new recl_items(); try { r = mng.GetReclamation(id); switch (code) { case "customerText": text = r.customerText; break; case "whatToDo": text = r.whatToDo; break; case "report": text = r.report; break; } res = true; } catch (Exception ex) { res = false; } return(Json(new { result = res, text = text })); }
public ActionResult ReclamationsSaveItem(string addedBy, string name, /*string ord,*/ string projectName) { var res = false; try { var mng = new CRMManager(); var item = new recl_items { id = 0, created = DateTime.Now, addedBy = addedBy != "" ? addedBy : null, name = name != "" ? name : null, projectID = (int?)RDL.Convert.StrToInt(projectName, 0) != 0 ? (int?)RDL.Convert.StrToInt(projectName, 0) : null, }; mng.SaveReclamation(item); res = true; } catch (Exception ex) { res = false; } return(Json(new { result = res, msg = "" }, JsonRequestBehavior.AllowGet)); }
internal int SaveReclamation(recl_items item) { var res = db.SaveReclamation(item); return(res); }