/// <summary>
 /// To get active Menu Details from database
 /// </summary>
 /// <param name="IsActive"></param>
 /// <returns></returns>
 private DataTable GetMenuDetails(bool IsActive)
 {
     MenuBAL MenuBAL = new MenuBAL();
     DataTable DtGetMenu = new DataTable();
     try
     {
         DtGetMenu = MenuBAL.LoadActiveMenu(IsActive, LoginUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         MenuBAL = null;
     }
     return DtGetMenu;
 }
 /// <summary>
 /// For filter MenuName by Using MenuID
 /// </summary>
 /// <param name="MenuName"></param>
 /// <returns></returns>
 private DataTable GetMenuIDsource(string MenuName)
 {
     MenuBAL MenuBAL = new MenuBAL();
     DataTable DtGetMenu = new DataTable();
     try
     {
         DtGetMenu = MenuBAL.SelectMenuName(MenuName, LoginUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         DtGetMenu = null;
     }
     return DtGetMenu;
 }
    private DataTable getMenudetails()
    {
        MenuBAL m = new MenuBAL();
        DataTable dTable = new DataTable();
        try
        {
            dTable = m.LoadAllMenu(LoginUser, Ret);
        }
        catch
        {

        }
        finally
        {
            m = null;
        }

        return dTable;
    }
 /// <summary>
 /// To load menu details from database
 /// </summary>
 /// <returns></returns>
 private DataTable GetMenuDetails()
 {
     MenuBAL MenuBAL = new MenuBAL();
     DataTable DtMenuDet = new DataTable();
     try
     {
         DtMenuDet = MenuBAL.LoadAllMenu(LoginUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         MenuBAL = null;
     }
     return DtMenuDet;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="MenuID"></param>
 /// <returns></returns>
 private DataTable GetMenuDetails(int MenuID)
 {
     MenuBAL MenuBAL = new MenuBAL();
     DataTable DtGetMenu = new DataTable();
     try
     {
         DtGetMenu = MenuBAL.SelectMenuID(MenuID, LoginUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         MenuBAL = null;
     }
     return DtGetMenu;
 }
    /// <summary>
    /// To load Menu details from Menu Business Access Layer
    /// </summary>
    /// <returns></returns>
    private DataTable loadMenu()
    {
        MenuBAL MenuBAL = new MenuBAL();
        DataTable DtMenuLoad = new DataTable();
        try
        {
            DtMenuLoad = MenuBAL.LoadAllMenu(LoginUser, Ret);
        }
        catch (Exception ee)
        {

        }
        finally
        {
            MenuBAL = null;
        }
        return DtMenuLoad;
    }
    /// <summary>
    /// To get menu details of selected menu id
    /// </summary>
    /// <param name="MenuID"></param>
    /// <returns></returns>
    private DataTable GetMenuID(int MenuID)
    {
        MenuBAL mBAL = new MenuBAL();
        DataTable dTable = new DataTable();
        try
        {
            dTable = mBAL.SelectMenuID(MenuID, LoginUser, Ret);
        }
        catch (Exception ee)
        {

        }
        finally
        {
            mBAL = null;
        }

        return dTable;
    }
    // Get Menu Details
    private DataTable getMenuDetails(bool IsActive)
    {
        MenuBAL MenuBAL = new MenuBAL();
        DataTable DtMenuDe = new DataTable();
        try
        {
            DtMenuDe = MenuBAL.LoadActiveMenu(IsActive, LoginUser, Ret);
        }
        catch (Exception ee)
        {

        }
        finally
        {
            MenuBAL = null;
        }
        return DtMenuDe;
    }
 /// <summary>
 /// To save and update Menu details
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string Status = ddlMenuStatus.SelectedItem.Text;
     int MenuStatus = 1;
     if (Status == "Active")
     {
         MenuStatus = 1;
     }
     else
     {
         MenuStatus = 0;
     }
     if (btnSave.Text == "Save")
     {
         int IntResult = 0;
         MenuBAL MenuBAL = new MenuBAL();
         string MenuName = txtMenuName.Text;
         string MenuDesc = txtMenuDesc.Text;
         try
         {
             if (txtMenuName.Text.Trim() != "" && ddlMenuStatus.SelectedItem.Value != null)
             {
                 IntResult = MenuBAL.InsertMenu(MenuName, MenuDesc, MenuStatus, LoginUser, Ret);
                 ClearMenu();
                 msgMenu.Msg = "Menu details submited successfully";
                 msgMenu.showmsg();
                 //Response.Redirect("MenuList.aspx",false);
             }
         }
         catch (Exception ee)
         {
             if (ee.Message == "Duplicate Entry")
             {
                 msgMenu.Msg = "Duplicate Entry!";
                 msgMenu.showmsg();
             }
         }
         finally
         {
             MenuBAL = null;
         }
     }
     else if (btnSave.Text == "Update")
     {
         int IntResult = 0;
         MenuBAL MenuBAL = new MenuBAL();
         string MenuName = txtMenuName.Text;
         string MenuDesc = txtMenuDesc.Text;
         try
         {
             if (txtMenuName.Text.Trim() != "" && ddlMenuStatus.SelectedItem.Value != null)
             {
                 IntResult = MenuBAL.UpdateMenu(MenuID, MenuName, MenuDesc, MenuStatus, LoginUser, Ret);
                 ClearMenu();
                 msgMenu.Msg = "Menu details updated successfully";
                 msgMenu.showmsg();
                 //Response.Redirect("MenuList.aspx",false);
                 Session["MenuId"] = null;
                 btnSave.Text = "Save";
             }
         }
         catch (Exception ee)
         {
             if (ee.Message == "Duplicate Entry")
             {
                 msgMenu.Msg = "Duplicate Entry!";
                 msgMenu.showmsg();
             }
         }
         finally
         {
             MenuBAL = null;
         }
     }
 }
    /// <summary>
    /// To get details of particular Menu ID
    /// </summary>
    private DataTable GetMenuDetails(int GroupId)
    {
        MenuBAL MenuBAL = new MenuBAL();
        DataTable DtMenuDet = new DataTable();
        try
        {
            DtMenuDet = MenuBAL.SelectMenuID(MenuID, LoginUser, Ret);
        }
        catch
        {

        }
        finally
        {
            MenuBAL = null;
        }
        return DtMenuDet;
    }