예제 #1
0
        public ActionResult Create(InfoBenefitBU infobenefitbu)
        {
            if (ModelState.IsValid)
            {
                db.InfoBenefitBUs.Add(infobenefitbu);
                db.SaveChanges();
                return RedirectToAction("SuccessAddBenefitBU");
            }

            //ViewBag.FreqCaseID = new SelectList(db.FreqCases, "FreqCaseID", "FreqCaseName", infobenefitbu.FreqCaseID);
            //ViewBag.FreqPeriodeID = new SelectList(db.FreqPeriodes, "FreqPeriodeID", "FreqPeriodeName", infobenefitbu.FreqPeriodeID);
            //ViewBag.ManfaatInManfaatItemID = new SelectList(db.ManfaatInManfaatItems, "ManfaatInManfaatItemID", "ManfaatInManfaatItemID", infobenefitbu.ManfaatInManfaatItemID);
            //ViewBag.ManfaatPISAID = new SelectList(db.ManfaatPISAs, "ManfaatPISAID", "ManfaatPISAName", infobenefitbu.ManfaatPISAID);
            using (var dbnas = WebMatrix.Data.Database.Open("DBNASContext"))
            {
                //IQueryable<dynamic> bu = dbnas.Query("select pkskd,pkskd +'-' +nomor+'-' +pksnm as pksnm from datpks").AsQueryable();
                IQueryable<dynamic> cabang = dbnas.Query("select kdkc,nmkc from refkc").AsQueryable();
                //ViewBag.PKSKD = new SelectList(bu, "pkskd", "pksnm");
                ViewBag.KDKC = new SelectList(cabang, "kdkc", "nmkc");
                ViewBag.CaraBayarID = new SelectList(db.CaraBayars, "CaraBayarID", "CaraBayarName");
                ViewBag.PolisPegawaiID = new SelectList(db.PolisPegawais, "PolisPegawaiID", "PolisPegawaiName");
                ViewBag.FreqCaseID = new SelectList(db.FreqCases, "FreqCaseID", "FreqCaseName");
                ViewBag.FreqPeriodeID = new SelectList(db.FreqPeriodes, "FreqPeriodeID", "FreqPeriodeName");
                var ManfaatInManfaatItem = (from x in db.ManfaatInManfaatItems
                                            select new
                                            {
                                                ManfaatInManfaatItemID = x.ManfaatInManfaatItemID,
                                                ManfaatItemName = x.Manfaat.NamaManfaat + "-" + x.ManfaatItem.ManfaatItemName
                                            }).OrderBy(a => a.ManfaatItemName);
                ViewBag.ManfaatInManfaatItemID = new SelectList(ManfaatInManfaatItem, "ManfaatInManfaatItemID", "ManfaatItemName");
                ViewBag.ManfaatPISAID = new SelectList(db.ManfaatPISAs, "ManfaatPISAID", "ManfaatPISAName");
            }
            return View(infobenefitbu);
        }
예제 #2
0
 public ActionResult Edit(InfoBenefitBU infobenefitbu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(infobenefitbu).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("SuccessEditBenefitBU");
     }
     //ViewBag.FreqCaseID = new SelectList(db.FreqCases, "FreqCaseID", "FreqCaseName", infobenefitbu.FreqCaseID);
     //ViewBag.FreqPeriodeID = new SelectList(db.FreqPeriodes, "FreqPeriodeID", "FreqPeriodeName", infobenefitbu.FreqPeriodeID);
     ViewBag.ManfaatInManfaatItemID = new SelectList(db.ManfaatInManfaatItems, "ManfaatInManfaatItemID", "ManfaatInManfaatItemID", infobenefitbu.ManfaatInManfaatItemID);
     //ViewBag.ManfaatPISAID = new SelectList(db.ManfaatPISAs, "ManfaatPISAID", "ManfaatPISAName", infobenefitbu.ManfaatPISAID);
     return View(infobenefitbu);
 }