public ActionResult Create([Bind(Include = "CONO,FEECODE,FEEAMT,FEEMTH,FEETYPE,LASTTOUCH,STAMP")] CSCOFEE cSCOFEE) { if (ModelState.IsValid) { try { cSCOFEE.STAMP = 0; db.CSCOFEEs.Add(cSCOFEE); db.SaveChanges(); return(new RedirectResult(Url.Action("Edit", "CSCOMSTRs", new { id = MyHtmlHelpers.ConvertIdToByteStr(cSCOFEE.CONO) }) + "#Fee")); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { //string message = string.Format("{0}:{1}", // validationErrors.Entry.Entity.ToString(), // validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException ModelState.AddModelError(validationError.PropertyName, validationError.ErrorMessage); } } } catch (DbUpdateException ex) { UpdateException updateException = (UpdateException)ex.InnerException; if (updateException != null) { if (updateException.InnerException != null) { var sqlException = (FirebirdSql.Data.FirebirdClient.FbException)updateException.InnerException; foreach (var error in sqlException.Errors) { if (error.Message != null) { ModelState.AddModelError(string.Empty, error.Message); } } } else { ModelState.AddModelError(string.Empty, updateException.Message); } } else { ModelState.AddModelError(string.Empty, updateException.Message); } } } ViewBag.FEETYPE = new SelectList(db.CSITEMs, "ITEMTYPE", "ITEMDESC", cSCOFEE.FEETYPE); ViewBag.FEECODE = new SelectList(db.CSCASEs, "CASECODE", "CASEDESC", cSCOFEE.FEECODE); cSCOFEE.CSCOMSTR = db.CSCOMSTRs.Find(cSCOFEE.CONO); return(View(cSCOFEE)); }
public ActionResult DeleteConfirmed(string id, string fee) { CSCOFEE cSCOFEE = db.CSCOFEEs.Find(id, fee); db.CSCOFEEs.Remove(cSCOFEE); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(string id, string fee) { CSCOFEE cSCOFEE = db.CSCOFEEs.Find(MyHtmlHelpers.ConvertByteStrToId(id), fee); try { db.CSCOFEEs.Remove(cSCOFEE); db.SaveChanges(); return(new RedirectResult(Url.Action("Edit", "CSCOMSTRs", new { id = MyHtmlHelpers.ConvertIdToByteStr(cSCOFEE.CONO) }) + "#Fee")); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { //string message = string.Format("{0}:{1}", // validationErrors.Entry.Entity.ToString(), // validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException ModelState.AddModelError(validationError.PropertyName, validationError.ErrorMessage); } } } catch (DbUpdateException ex) { UpdateException updateException = (UpdateException)ex.InnerException; if (updateException != null) { if (updateException.InnerException != null) { var sqlException = (FirebirdSql.Data.FirebirdClient.FbException)updateException.InnerException; foreach (var error in sqlException.Errors) { if (error.Message != null) { ModelState.AddModelError(string.Empty, error.Message); } } } else { ModelState.AddModelError(string.Empty, updateException.Message); } } else { ModelState.AddModelError(string.Empty, updateException.Message); } } cSCOFEE.CSCOMSTR = db.CSCOMSTRs.Find(cSCOFEE.CONO); return(View(cSCOFEE)); }
public ActionResult Edit([Bind(Include = "CONO,FEECODE,FEEAMT,FEEMTH,FEETYPE,LASTTOUCH,STAMP")] CSCOFEE cSCOFEE) { if (ModelState.IsValid) { db.Entry(cSCOFEE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FEECODE = new SelectList(db.CSCASEs, "CASECODE", "CASEDESC", cSCOFEE.FEECODE); return(View(cSCOFEE)); }
// GET: CSCOFEEs/Create public ActionResult Create(string id) { ViewBag.Parent = MyHtmlHelpers.ConvertByteStrToId(id); CSCOFEE curRec = new CSCOFEE(); curRec.CONO = ViewBag.Parent; curRec.CSCOMSTR = db.CSCOMSTRs.Find(curRec.CONO); ViewBag.FEETYPE = new SelectList(db.CSITEMs, "ITEMTYPE", "ITEMDESC"); ViewBag.FEECODE = new SelectList(db.CSCASEs, "CASECODE", "CASEDESC"); return(View(curRec)); }
// GET: CSCOFEEs/Details/5 public ActionResult Details(string id, string fee) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CSCOFEE cSCOFEE = db.CSCOFEEs.Find(id, fee); if (cSCOFEE == null) { return(HttpNotFound()); } return(View(cSCOFEE)); }
// GET: CSCOFEEs/Delete/5 public ActionResult Delete(string id, string fee) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CSCOFEE cSCOFEE = db.CSCOFEEs.Find(MyHtmlHelpers.ConvertByteStrToId(id), fee); if (cSCOFEE == null) { return(HttpNotFound()); } return(View(cSCOFEE)); }
// GET: CSCOFEEs/Edit/5 public ActionResult Edit(string id, string fee) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CSCOFEE cSCOFEE = db.CSCOFEEs.Find(id, fee); if (cSCOFEE == null) { return(HttpNotFound()); } ViewBag.FEECODE = new SelectList(db.CSCASEs, "CASECODE", "CASEDESC", cSCOFEE.FEECODE); return(View(cSCOFEE)); }
// GET: CSCOFEEs/Details/5 public ActionResult Details(string id, string fee) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CSCOFEE cSCOFEE = db.CSCOFEEs.Find(MyHtmlHelpers.ConvertByteStrToId(id), fee); if (cSCOFEE == null) { return(HttpNotFound()); } ViewBag.FEETYPE = new SelectList(db.CSITEMs, "ITEMTYPE", "ITEMDESC", cSCOFEE.FEETYPE); ViewBag.FEECODE = new SelectList(db.CSCASEs, "CASECODE", "CASEDESC", cSCOFEE.FEECODE); return(View(cSCOFEE)); }