Esempio n. 1
0
        public ActionResult add1(FormCollection collection)
        {
            RoadFlow.Data.Model.DictionaryModel dict  = new RoadFlow.Data.Model.DictionaryModel();
            RoadFlow.Platform.DictionaryBLL     bdict = new RoadFlow.Platform.DictionaryBLL();
            string id = Request.QueryString["id"];

            if (!id.IsGuid())
            {
                var dictRoot = bdict.GetRoot();
                id = dictRoot != null?dictRoot.ID.ToString() : "";
            }
            if (!id.IsGuid())
            {
                throw new Exception("未找到父级");
            }

            if (collection != null)
            {
                string title  = Request.Form["Title"];
                string code   = Request.Form["Code"];
                string values = Request.Form["Values"];
                string note   = Request.Form["Note"];
                string other  = Request.Form["Other"];

                dict.ID       = Guid.NewGuid();
                dict.Code     = code.IsNullOrEmpty() ? null : code.Trim();
                dict.Note     = note.IsNullOrEmpty() ? null : note.Trim();
                dict.Other    = other.IsNullOrEmpty() ? null : other.Trim();
                dict.ParentID = id.Convert <Guid>();
                dict.Sort     = bdict.GetMaxSort(id.Convert <Guid>());
                dict.Title    = title.Trim();
                dict.Value    = values.IsNullOrEmpty() ? null : values.Trim();

                bdict.Add(dict);
                //bdict.RefreshCache();
                RoadFlow.Platform.Log.Add("添加了数据字典项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
                ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');";
            }

            return(View(dict));
        }