示例#1
0
        protected void ctlMenuGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            short menuId;

            if (e.CommandName == "MenuEdit")
            {
                int rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                menuId = UIHelper.ParseShort(ctlMenuGrid.DataKeys[rowIndex].Value.ToString());
                ctlMenuForm.PageIndex = (ctlMenuGrid.PageIndex * ctlMenuGrid.PageSize) + rowIndex;
                ctlMenuForm.ChangeMode(FormViewMode.Edit);
                IList <SuMenu> list = new List <SuMenu>();
                list.Add(SuMenuService.FindByIdentity(menuId));

                ctlMenuForm.DataSource = list;
                ctlMenuForm.DataBind();
                ctlMenuGrid.DataCountAndBind();
                ctlUpdatePanelMenuForm.Update();
                ctlMenuModalPopupExtender.Show();
            }
            if (e.CommandName == "Select")
            {
                int rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                menuId = UIHelper.ParseShort(ctlMenuGrid.DataKeys[rowIndex].Value.ToString());
                ctlMenuLangGrid.DataSource = QueryProvider.SuMenuQuery.FindMenuLangByTranslateId(menuId);
                ctlMenuLangGrid.DataBind();
                fdsMenuLang.Visible = true;
                ctlMenuGrid.DataCountAndBind();
                ctlUpdatePanelMenuLangGridView.Update();
            }
        }
示例#2
0
        protected void ctlDelete_Click(object sender, ImageClickEventArgs e)
        {
            foreach (GridViewRow row in ctlMenuGrid.Rows)
            {
                if ((row.RowType == DataControlRowType.DataRow) && (((CheckBox)row.FindControl("ctlSelect")).Checked))
                {
                    try
                    {
                        short  menuId = UIHelper.ParseShort(ctlMenuGrid.DataKeys[row.RowIndex].Value.ToString());
                        SuMenu menu   = SuMenuService.FindByIdentity(menuId);
                        SuMenuLangService.DeleteMenuLang(menuId);
                        SuMenuService.Delete(menu);
                    }
                    catch (Exception ex)
                    {
                        Response.Write("Delete Error");
                    }
                }
            }
            ctlMenuGrid.SelectedIndex = -1;
            ctlMenuGrid.DataCountAndBind();
            ctlUpdatePanelGridView.Update();

            ctlMenuLangGrid.DataSource = null;
            ctlMenuLangGrid.DataBind();
            fdsMenuLang.Visible = false;
            ctlUpdatePanelMenuLangGridView.Update();
        }
示例#3
0
        protected void ctlMenuForm_Inserting(object sender, FormViewInsertEventArgs e)
        {
            SuMenu menu = new SuMenu();

            GetSuMenuInfo(menu);

            try
            {
                SuMenuService.AddMenu(menu);
                ctlMenuGrid.DataCountAndBind();
                ClosePopUp();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }
示例#4
0
        protected void ctlMenuForm_Updating(object sender, FormViewUpdateEventArgs e)
        {
            short  menuId = UIHelper.ParseShort(ctlMenuForm.DataKey.Value.ToString());
            SuMenu menu   = QueryProvider.SuMenuQuery.FindProxyByIdentity(menuId);

            GetSuMenuInfo(menu);

            try
            {
                SuMenuService.UpdateMenu(menu);
                ctlMenuGrid.DataCountAndBind();

                ClosePopUp();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }