Example #1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         mainmenu = new MainMenuBLL();
         int menuID = Convert.ToInt32((gwMenuItems.SelectedRow.FindControl("lblMenuID") as Label).Text);
         if (mainmenu.UpdateMainMenu(menuID, txtEditItemname.Text, txtEPermalink.Text, chkEStatus.Checked))
         {
             this.load_gwMenuItems();
         }
     }
     catch (Exception ex)
     {
         this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
     }
 }
Example #2
0
 protected void chkShow_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         CheckBox    chk      = (sender as CheckBox);
         GridViewRow row      = (GridViewRow)(((CheckBox)sender).NamingContainer);
         HiddenField hdnCheck = (HiddenField)row.Cells[4].FindControl("hiddenField1");
         mainmenu = new MainMenuBLL();
         if (mainmenu.UpdateStatus(Convert.ToInt32(hdnCheck.Value), chk.Checked))
         {
             this.load_gwMenuItems();
         }
     }
     catch (Exception ex)
     {
         this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
     }
 }
Example #3
0
 protected void btnAddMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         mainmenu = new MainMenuBLL();
         if (mainmenu.NewMainMenu(txtItemname.Text, txtPermalink.Text, mainmenu.MaxItemindex() + 1, chkStatus.Checked))
         {
             Response.Redirect(Request.Url.AbsoluteUri);
         }
         else
         {
             this.AlertPageValid(true, "False to connect server !", alertPageValid, lblPageValid);
             return;
         }
     }
     catch (Exception ex)
     {
         this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
     }
 }
Example #4
0
    protected void lkbtnUp_Click(object sender, EventArgs e)
    {
        try
        {
            mainmenu = new MainMenuBLL();
            LinkButton lkbutton = (sender as LinkButton);
            //Get the command argument
            string          commandArgument = lkbutton.CommandArgument;
            int             menuid = int.Parse(commandArgument);
            Number          a, b;
            Number          A, B;
            List <MainMenu> lstMN = mainmenu.ListMenuItemsWithMenuID(menuid); //index A
            MainMenu        menu  = lstMN.FirstOrDefault();

            List <MainMenu> lstMUP = mainmenu.ListMenuItemsWithIndex(mainmenu.MaxItemindexLK(menu.ItemIndex)); //index B
            MainMenu        menuUp = lstMUP.FirstOrDefault();

            if (menuUp == null)
            {
                a = new Number(0);
                b = new Number(0);
                return;
            }
            else
            {
                A = new Number(menu.MenuID);
                B = new Number(menuUp.MenuID);
                a = new Number(menu.ItemIndex);
                b = new Number(menuUp.ItemIndex);
                this.swap(a, b);
                this.mainmenu.UpdateItemIndex(a.getNum(), A.getNum());
                this.mainmenu.UpdateItemIndex(b.getNum(), B.getNum());
                this.load_gwMenuItems();
                gwMenuItems.SelectedIndex = -1;
            }
        }
        catch (Exception ex)
        {
            this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
        }
    }
Example #5
0
 protected void gwMenuItems_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         mainmenu = new MainMenuBLL();
         int      menuID = Convert.ToInt32((gwMenuItems.SelectedRow.FindControl("lblMenuID") as Label).Text);
         MainMenu menu   = mainmenu.ListMenuItemsWithMenuID(menuID).FirstOrDefault();
         txtEditItemname.Text = menu.ItemName;
         txtEPermalink.Text   = menu.Permalink;
         chkEStatus.Checked   = menu.MenuStatus;
         btnSubmit.Enabled    = true;
         this.load_dlSelectCategory();
         this.load_btnAddPost();
         this.load_gwSubMenuItem(menuID);
         lblAddSubItemWaring.Text = "";
     }
     catch (Exception ex)
     {
         this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
     }
 }
Example #6
0
 private void load_gwMenuItems()
 {
     mainmenu = new MainMenuBLL();
     gwMenuItems.DataSource = mainmenu.ListMenuItems();
     gwMenuItems.DataBind();
 }
 private void load_rptMainMenu()
 {
     mainmenu = new MainMenuBLL();
     rptMainMenu.DataSource = mainmenu.ListMenuItemsByMenuStatus(true);
     rptMainMenu.DataBind();
 }