Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(string id, string fee)
        {
            CSCOFEE cSCOFEE = db.CSCOFEEs.Find(id, fee);

            db.CSCOFEEs.Remove(cSCOFEE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
 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));
 }
Esempio n. 5
0
        // 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));
        }
Esempio n. 6
0
        // 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));
        }
Esempio n. 7
0
        // 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));
        }
Esempio n. 8
0
        // 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));
        }
Esempio n. 9
0
        // 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));
        }