Ejemplo n.º 1
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            if (!StringHelper.IsNumber(FatherId.Value))
            {
                WebUtility.ShowAlertMessage("请填写父级ID!", null);
            }

            systemMenu.Title      = MyTitle.Value;
            systemMenu.Url        = LinkUrl.Value;
            systemMenu.AddPageUrl = AddPageUrl.Value;
            systemMenu.IsOpen     = IsOpen.Checked;
            systemMenu.Enabled    = Enabled.Checked;

            if (systemMenu.Pkid > 0)
            {
                //更改
                bll_systemMenu.Update(systemMenu, FatherId.Value, Request.Form["sort"]);
                WebUtility.ShowAlertMessage("保存成功!", "sysMenuManage.aspx");
            }
            else
            {
                //增加
                systemMenu.FatherId   = Convert.ToInt32(FatherId.Value);
                systemMenu.CreateTime = DateTime.Now.ToString();
                bll_systemMenu.Insert(systemMenu);
                bll_systemMenu.Update(systemMenu, FatherId.Value, Request.Form["sort"]);
                WebUtility.ShowAlertMessage("新增成功!", Request.RawUrl);
            }
        }
    }
Ejemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            SystemMenu.Insert(this, -2);                            //insert divider 2 items from the bottom
            SystemMenu.Insert(this, -2, "SystemMenu Test...", 999); //Insert menu item 2 items from the bottom (after above divider)
            SystemMenu.SetHandler(this, id =>
            {
                if (id == 999)
                {
                    MessageBoxEx.Show(this, "This is a test of the SystemMenu API.", "SystemMenu Test", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(true); // This id is handled
                }
                return(false);    // Everything else is not handled by this api.
            });

            CustomStorageTests(); //Test control custom storage API.

            propertyGrid1.SelectedObject = new TestUITypeEditors(this);

            m_clbColorListBox.AddColor(Color.FromArgb(178, 0, 255)); //nearest color==Color.DarkViolet
            m_clbColorListBox.AddColor(Color.FromArgb(128, Color.Peru.R, Color.Peru.G, Color.Peru.B));
            m_clbColorListBox.AddColor(Color.CadetBlue);             //Not added because it already exists
            m_clbColorListBox.AddColor(Color.Empty);                 //Not added because it is invalid.
            m_clbColorListBox.Selected = Color.CadetBlue;

            m_ctvColorTreeView.AddColor(Color.FromArgb(57, 198, 149)); //nearest color==Color.MediumSeaGreen
            m_ctvColorTreeView.AddColor(Color.FromArgb(128, Color.MediumSeaGreen.R, Color.MediumSeaGreen.G, Color.MediumSeaGreen.B));
            m_ctvColorTreeView.AddColor(Color.FromArgb(57, 198, 149)); //nearest color==Color.MediumSeaGreen Already added.
            m_ctvColorTreeView.AddColor(Color.FromArgb(218, 165, 32)); //==Color.Goldenrod. Not added. Equivalant to known color
            m_ctvColorTreeView.Selected = Color.FromArgb(128, Color.MediumSeaGreen.R, Color.MediumSeaGreen.G, Color.MediumSeaGreen.B);

            m_cbbColorComboBox.AddColor(Color.FromArgb(218, 255, 127));      //nearest color==Color.YellowGreen
            m_cbbColorComboBox.AddColor(Color.FromArgb(128, 204, 242, 140)); //A=128, nearest color==Color.Khaki
            m_cbbColorComboBox.Selected = Color.MediumSeaGreen;

            base.OnLoad(e);
        }
Ejemplo n.º 3
0
    /// <summary>
    /// 执行操作的方法
    /// </summary>
    private void Action()
    {
        string cmd = Request["cmd"];

        if (String.IsNullOrEmpty(cmd))
        {
            return;
        }
        string ids = Request.QueryString["ids"];

        if (cmd == "moveup")
        {
            bll_systemMenu.MoveUp(ids);
        }
        else if (cmd == "movedown")
        {
            bll_systemMenu.MoveDown(ids);
        }
        else if (cmd == "onoff")
        {
            bll_systemMenu.UpdateStatus(ids, "onoff");
        }
        else if (cmd == "enab")
        {
            bll_systemMenu.UpdateStatus(ids, "enab");
        }
        else if (cmd == "del")
        {
            bll_systemMenu.Delete(ids);
        }
        else if (cmd == "updateall")
        {
            foreach (string key in Request.Form.AllKeys)
            {
                if (key.StartsWith("title"))
                {
                    string title = Request.Form[key];
                    string url   = Request.Form[key.Replace("title", "url")];
                    if (String.IsNullOrEmpty(title))
                    {
                        continue;
                    }

                    if (key.IndexOf("#") > 0)
                    {
                        string fid = Request.Form[key.Replace("title", "fid")];
                        if (!StringHelper.IsNumber(fid))
                        {
                            continue;
                        }

                        SystemMenuModel systemMenu = new SystemMenuModel();
                        systemMenu.Title    = title;
                        systemMenu.Url      = url;
                        systemMenu.FatherId = Convert.ToInt32(fid);
                        bll_systemMenu.Insert(systemMenu);
                    }
                    else
                    {
                        string          id         = key.Replace("title", "");
                        SystemMenuModel systemMenu = bll_systemMenu.GetModel(id);
                        if (systemMenu == null)
                        {
                            continue;
                        }
                        systemMenu.Title = title;
                        systemMenu.Url   = url;
                        bll_systemMenu.Update(systemMenu);
                    }
                }
            }

            WebUtility.ShowAlertMessage("全部保存成功!", Request.RawUrl);
        }

        Response.Redirect(Request.Url.AbsolutePath);
    }