Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id, GrantPaymentOrder, SubNumber, Grant, Amount, Notes")] GrantPayment grantPayment)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    GrantPaymentServices.Insert(CurrentUser.Id, grantPayment, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.GrantList             = new SelectList(GrantServices.List(db), "Product", "Name");
            ViewBag.GrantPaymentOrderList = new SelectList(GrantPaymentOrderServices.List(db), "Id", "Notes");
            return(View(grantPayment));
        }
Ejemplo n.º 2
0
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.GrantList = new SelectList(GrantServices.List(db), "Product", "Name");
            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "Grant, Amount, Description")] GrantDeduction grantDeduction)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    GrantDeductionServices.Update(CurrentUser.Id, grantDeduction, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.GrantList = new SelectList(GrantServices.List(db), "Product", "Name", grantDeduction.Grant);
            return(View(grantDeduction));
        }
Ejemplo n.º 4
0
        // GET: Grant/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db    db    = new Db(DbServices.ConnectionString);
            Grant grant = GrantServices.Get(id.Value, db);

            if (grant == null)
            {
                return(HttpNotFound());
            }
            return(View(grant));
        }
Ejemplo n.º 5
0
        // GET: GrantDeduction/Edit/5
        public ActionResult Edit(Nullable <int> grant)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (grant == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GrantDeduction grantDeduction = GrantDeductionServices.Get(grant.Value, db);

            if (grantDeduction == null)
            {
                return(HttpNotFound());
            }

            ViewBag.GrantList = new SelectList(GrantServices.List(db), "Product", "Name", grantDeduction.Grant);
            return(View(grantDeduction));
        }
Ejemplo n.º 6
0
        // GET: GrantPayment/Edit/5
        public ActionResult Edit(Nullable <int> id)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GrantPayment grantPayment = GrantPaymentServices.Get(id.Value, db);

            if (grantPayment == null)
            {
                return(HttpNotFound());
            }

            ViewBag.GrantList             = new SelectList(GrantServices.List(db), "Product", "Name", grantPayment.Grant);
            ViewBag.GrantPaymentOrderList = new SelectList(GrantPaymentOrderServices.List(db), "Id", "Notes", grantPayment.GrantPaymentOrder);
            return(View(grantPayment));
        }
Ejemplo n.º 7
0
        // GET: Grant/Edit/5
        public ActionResult Edit(Nullable <int> product)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (product == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Grant grant = GrantServices.Get(product.Value, db);

            if (grant == null)
            {
                return(HttpNotFound());
            }

            ViewBag.GrantDecisionList = new SelectList(GrantDecisionServices.List(db), "Id", "CersNumber", grant.GrantDecision);
            ViewBag.ProductList       = new SelectList(ProductServices.List(db), "Id", "Notes", grant.Product);
            return(View(grant));
        }
Ejemplo n.º 8
0
 public ActionResult DeleteConfirmed(int product)
 {
     try
     {
         Db db = new Db(DbServices.ConnectionString);
         GrantServices.Delete(CurrentUser.Id, product, db);
         TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "DeleteConfirmed");
         // return RedirectToAction("Index");
     }
     catch (CfException cfex)
     {
         TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
     }
     catch (Exception ex)
     {
         TempData["Failure"] = ex.Message;
     }
     // return View(grant);
     return(RedirectToAction("Index"));
 }