protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Redirect("/Login.aspx");
            }
            string         action = Request["action"];
            SysEnumeration seEnt  = null;
            string         json   = "";

            switch (action)
            {
            case "create":
                json         = Request["json"];
                seEnt        = JsonHelper.GetObject <SysEnumeration>(json);
                seEnt.Value  = seEnt.Name;
                seEnt.IsLeaf = true;
                seEnt.DoCreate();
                SysEnumeration seEnt_parent = SysEnumeration.Find(seEnt.ParentID);
                seEnt_parent.IsLeaf = false;
                seEnt_parent.DoUpdate();
                break;

            case "update":
                json  = Request["json"];
                seEnt = JsonHelper.GetObject <SysEnumeration>(json);
                SysEnumeration originalEnt = SysEnumeration.Find(seEnt.EnumerationID);
                EasyDictionary dic         = JsonHelper.GetObject <EasyDictionary>(json);
                originalEnt       = DataHelper.MergeData <SysEnumeration>(originalEnt, seEnt, dic.Keys);
                originalEnt.Value = originalEnt.Name;
                originalEnt.DoUpdate();
                break;

            case "loadformdata":
                string id = Request["id"];
                json = JsonHelper.GetJsonString(SysEnumeration.Find(id));
                Response.Write("{success:true,data:" + json + "}");
                Response.End();
                break;
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            string action = Request["action"];

            json = Request["json"];
            switch (action)
            {
            case "select":
                Select();
                break;

            case "delete":
                Delete();
                break;

            case "update":
                Ent = JsonHelper.GetObject <SysEnumeration>(json);
                SysEnumeration originalEnt = SysEnumeration.Find(Ent.EnumerationID);
                EasyDictionary dic         = JsonHelper.GetObject <EasyDictionary>(json);
                originalEnt       = DataHelper.MergeData <SysEnumeration>(originalEnt, Ent, dic.Keys);
                originalEnt.Value = originalEnt.Name;
                originalEnt.DoUpdate();
                break;

            case "create":
                Ent = JsonHelper.GetObject <SysEnumeration>(json);
                SysEnumeration EntParent = SysEnumeration.Find(Ent.ParentID);
                Ent.Value  = Ent.Name;
                Ent.IsLeaf = true;
                if (string.IsNullOrEmpty(EntParent.Path))
                {
                    Ent.Path = EntParent.EnumerationID;
                }
                else
                {
                    Ent.Path = EntParent.Path + "." + EntParent.EnumerationID;
                }
                Ent.PathLevel   = EntParent.PathLevel + 1;
                Ent.CreaterID   = WebPortalService.CurrentUserInfo.UserID;
                Ent.CreaterName = WebPortalService.CurrentUserInfo.Name;
                Ent.DoCreate();
                //------------------------
                if (Convert.ToInt32(EntParent.IsLeaf) == 1)
                {
                    EntParent.IsLeaf = false;
                    EntParent.Update();
                }
                break;

            case "loadform":
                string EnumerationID = Request["EnumerationID"];
                json = JsonHelper.GetJsonString(SysEnumeration.Find(EnumerationID));
                Response.Write("{success:true,data:" + json + "}");
                Response.End();
                break;
            }
        }