Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];

            this.Code.Attributes.Add("validate_url", "CheckCode.ashx?id=" + id);
            if (id.IsGuid())
            {
                dict = bdict.Get(id.ToGuid());
            }
            if (dict == null)
            {
                dict = bdict.GetRoot();
            }
            if (IsPostBack && dict != null)
            {
                string refreshID = dict.ParentID == Guid.Empty ? dict.ID.ToString() : dict.ParentID.ToString();
                //删除
                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    int i = bdict.DeleteAndAllChilds(dict.ID);
                    bdict.RefreshCache();
                    FoWoSoft.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), FoWoSoft.Platform.Log.Types.数据字典);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('删除成功!');parent.frames[0].reLoad('" + refreshID + "');window.location='Body.aspx?id=" + dict.ParentID.ToString() + "&appid=" + Request.QueryString["appid"] + "';", true);
                }
                //保存
                if (!Request.Form["Save"].IsNullOrEmpty())
                {
                    string title  = Request.Form["Title1"];
                    string code   = Request.Form["Code"];
                    string values = Request.Form["Values"];
                    string note   = Request.Form["Note"];
                    string other  = Request.Form["Other"];
                    string oldXML = dict.Serialize();

                    dict.Code  = code.IsNullOrEmpty() ? null : code.Trim();
                    dict.Note  = note.IsNullOrEmpty() ? null : note.Trim();
                    dict.Other = other.IsNullOrEmpty() ? null : other.Trim();
                    dict.Title = title.Trim();
                    dict.Value = values.IsNullOrEmpty() ? null : values.Trim();

                    bdict.Update(dict);
                    bdict.RefreshCache();
                    FoWoSoft.Platform.Log.Add("修改了数据字典项", "", FoWoSoft.Platform.Log.Types.数据字典, oldXML, dict.Serialize());
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');", true);
                }
            }
            if (dict != null)
            {
                this.Title1.Value = dict.Title;
                this.Code.Value   = dict.Code;
                this.Values.Value = dict.Value;
                this.Note.Value   = dict.Note;
                this.Other.Value  = dict.Other;
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                FoWoSoft.Data.Model.Dictionary dict  = new FoWoSoft.Data.Model.Dictionary();
                FoWoSoft.Platform.Dictionary   bdict = new FoWoSoft.Platform.Dictionary();
                string id = Request.QueryString["id"];
                if (!id.IsGuid())
                {
                    var dictRoot = bdict.GetRoot();
                    id = dictRoot != null?dictRoot.ID.ToString() : "";
                }
                if (!id.IsGuid())
                {
                    throw new Exception("未找到父级");
                }


                string title  = Request.Form["Title1"];
                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.ToGuid();
                dict.Sort     = bdict.GetMaxSort(id.ToGuid());
                dict.Title    = title.Trim();
                dict.Value    = values.IsNullOrEmpty() ? null : values.Trim();

                bdict.Add(dict);
                bdict.RefreshCache();
                FoWoSoft.Platform.Log.Add("添加了数据字典项", dict.Serialize(), FoWoSoft.Platform.Log.Types.数据字典);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');", true);
            }
        }