public JsonResult Create01(string para01, string para02, string para03)
        {
            string sup_id    = para01;
            string income_id = para02;
            string spo_money = para03;

            INCOME list2 = db.INCOME.Find(income_id);
            int    money;

            int.TryParse(spo_money, out money);

            SUPPORT sUPPORT    = db.SUPPORT.Find(sup_id, income_id);
            SUPPORT newSupport = new SUPPORT();

            newSupport.SPONSOR_ID   = sup_id;
            newSupport.INCOME_ID    = income_id;
            newSupport.MONEY        = money;
            newSupport.SUPPORT_DATE = list2.INCOME_DATE;



            if (sUPPORT == null)
            {
                db.SUPPORT.Add(newSupport);
                db.SaveChanges();
            }

            var list = db.SUPPORT.Select(n => new { SPONSOR_ID = n.SPONSOR_ID, SPONSOR_NAME = n.SPONSOR.SPONSOR_NAME, INCOME_ID = n.INCOME_ID, MONEY = n.MONEY, SUPPORT_DATE = n.SUPPORT_DATE });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Edit(string para01, string para02, string para03)
        {
            string id        = para01;
            string spo_money = para02;
            string date      = para03;

            int money;

            int.TryParse(spo_money, out money);

            SUPPORT sUPPORT = db.SUPPORT.Find(id);

            sUPPORT.SPONSOR_ID   = id;
            sUPPORT.MONEY        = money;
            sUPPORT.SUPPORT_DATE = Convert.ToDateTime(date);

            db.Entry(sUPPORT).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }


            var list = db.SUPPORT.Select(n => new { SPONSOR_ID = n.SPONSOR_ID, SPONSOR_NAME = n.SPONSOR.SPONSOR_NAME, INCOME_ID = n.INCOME_ID, MONEY = n.MONEY, SUPPORT_DATE = n.SUPPORT_DATE });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
        public string test(string para01, string para02)
        {
            string id        = para01;
            string income_id = para02;

            SUPPORT sUPPORT = db.SUPPORT.Find(id, income_id);

            if (sUPPORT != null)
            {
                return("1");
            }
            SPONSOR myid = db.SPONSOR.Find(id);

            if (myid == null)
            {
                return("2");
            }
            INCOME myincome_id = db.INCOME.Find(income_id);

            if (myincome_id == null)
            {
                return("3");
            }
            return("4");
        }
Esempio n. 4
0
        public ActionResult DeleteConfirmed(string id)
        {
            SUPPORT sUPPORT = db.SUPPORT.Find(id);

            db.SUPPORT.Remove(sUPPORT);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "SPONSOR_ID,INCOME_ID,SUPPORT_DATE,MONEY")] SUPPORT sUPPORT)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sUPPORT).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.INCOME_ID  = new SelectList(db.INCOME, "INCOME_ID", "TYPE", sUPPORT.INCOME_ID);
     ViewBag.SPONSOR_ID = new SelectList(db.SPONSOR, "SPONSOR_ID", "SPONSOR_NAME", sUPPORT.SPONSOR_ID);
     return(View(sUPPORT));
 }
Esempio n. 6
0
        // GET: SUPPORTs/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SUPPORT sUPPORT = db.SUPPORT.Find(id);

            if (sUPPORT == null)
            {
                return(HttpNotFound());
            }
            return(View(sUPPORT));
        }
        public void Delete(string id)
        {
            if (id == null)
            {
                return;
            }
            SUPPORT sUPPORT = db.SUPPORT.Find(id);

            if (sUPPORT == null)
            {
                return;
            }

            db.SUPPORT.Remove(sUPPORT);
            db.SaveChanges();
        }
Esempio n. 8
0
        // GET: SUPPORTs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SUPPORT sUPPORT = db.SUPPORT.Find(id);

            if (sUPPORT == null)
            {
                return(HttpNotFound());
            }
            ViewBag.INCOME_ID  = new SelectList(db.INCOME, "INCOME_ID", "TYPE", sUPPORT.INCOME_ID);
            ViewBag.SPONSOR_ID = new SelectList(db.SPONSOR, "SPONSOR_ID", "SPONSOR_NAME", sUPPORT.SPONSOR_ID);
            return(View(sUPPORT));
        }