예제 #1
0
        public ActionResult Edit(int id)
        {
            WN_WarningSett entity = null;

            using (MBREntities db = new MBREntities())
            {
                entity = db.WN_WarningSett.Find(id);
            }

            List <SelectListItem> WarningLevelList      = new List <SelectListItem>();
            DATADICTIONARYService DATADICTIONARYService = new DATADICTIONARYService();
            var dicValues = DATADICTIONARYService.GetDicValuesByCode("WarningLevel");

            if (dicValues != null)
            {
                foreach (var item in dicValues)
                {
                    bool selected = item.Key.Equals((entity.WarningLevel ?? 0).ToString());
                    WarningLevelList.Add(new SelectListItem()
                    {
                        Text     = item.Value,
                        Value    = item.Key,
                        Selected = selected
                    });
                }
            }


            ViewBag.WarningLevel = WarningLevelList;

            return(View(entity));
        }
예제 #2
0
        public ActionResult Create()
        {
            List <SelectListItem> WarningLevelList      = new List <SelectListItem>();
            DATADICTIONARYService DATADICTIONARYService = new DATADICTIONARYService();
            var dicValues = DATADICTIONARYService.GetDicValuesByCode("WarningLevel");

            if (dicValues != null)
            {
                foreach (var item in dicValues)
                {
                    WarningLevelList.Add(new SelectListItem()
                    {
                        Text  = item.Value,
                        Value = item.Key
                    });
                }
            }

            ViewBag.WarningLevel = WarningLevelList;

            return(View());
        }
예제 #3
0
        public JsonResult GetDicValuesByCode(string code)
        {
            DATADICTIONARYService DATADICTIONARYService = new DATADICTIONARYService();

            return(Json(DATADICTIONARYService.GetDicValuesByCode(code), JsonRequestBehavior.AllowGet));
        }