Ejemplo n.º 1
0
        public ActionResult Create(EF.Dictionary dictionary)
        {
            string msg = "添加失败";

            //YJY.EMS.Model.OA.Department member = new YJY.EMS.Model.OA.Department();
            try
            {
                // TODO: Add insert logic here
                dictionary.CreateUser   = "******";
                dictionary.UpdateUser   = "******";
                dictionary.UpdateTime   = DateTime.Now;
                dictionary.CreateTime   = DateTime.Now;
                dictionary.DictionaryID = dictionaryDAL.Insert(dictionary);
                if (dictionary.DictionaryID <= 0)
                {
                    return(Content(msg));
                }
                msg = "添加成功";
                //return RedirectToAction("Index");
                return(Content(msg));
            }
            catch
            {
                //return View();
                return(Content(msg));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id, EF.Dictionary model)
        {
            //客户端已处理ajax重复提交问题(ajax提交一次,表单再提交一次)
            string msg = "保存失败";

            try
            {
                // TODO: Add update logic here
                //var statistical = bllStatistical.GetModel(id);
                if (id > 0 && model != null)
                {
                    //return RedirectToAction("Index");
                    model.CreateUser   = "******";
                    model.UpdateUser   = "******";
                    model.UpdateTime   = DateTime.Now;
                    model.CreateTime   = DateTime.Now;
                    model.DictionaryID = id;
                    int result = dictionaryDAL.Update(model);
                    if (result > 0)
                    {
                        msg = "保存成功";
                    }
                    //return RedirectToAction("Index");
                }
                return(Content(msg));
            }
            catch
            {
                //return View();
                return(Content(msg));
            }
        }
 public int GetDictionaryId(string dictionaryName)
 {
     EF.Dictionary dictionary = EcoVadisTMContext.Dictionary.SingleOrDefault(x => x.Name == dictionaryName);
     if (dictionary == null)
     {
         throw new Exception("Missing dictionary item");
     }
     else
     {
         return(dictionary.DictionaryId);
     }
 }
Ejemplo n.º 4
0
 public ActionResult Edit(int id, int pageIndex, string SearchString)
 {
     EF.Dictionary dictionary = null;
     if (id > 0)
     {
         dictionary = dictionaryDAL.GetDictionary(id);
     }
     //记录列表的页码以及查询条件,便于从编辑、详情等页面返回列表页时使用
     if (pageIndex > 1)
     {
         ViewBag.pageIndex = pageIndex;
     }
     if (!string.IsNullOrWhiteSpace(SearchString))
     {
         ViewBag.SearchString = HttpUtility.UrlEncode(SearchString);
     }
     return(View(dictionary));
 }