//************************
        protected void GetMenuListToPrivilegeUser()
        {
            AppMenuBLL appMenuBLL = new AppMenuBLL();

            try
            {
                groupWiseMenuListListBox.Items.Clear();

                DataTable dt = appMenuBLL.GetMenuListToPrivilegeUser(LumexSessionManager.Get("ActiveUserId").ToString(),menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim(), menuGroupDropDownList.SelectedValue.Trim() );

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        groupWiseMenuListListBox.Items.Add(new ListItem(dt.Rows[i]["MenuName"].ToString(), dt.Rows[i]["MenuId"].ToString()));
                    }
                }
                else
                {
                    msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "User Menu Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenuBLL = null;
                countMenuLabel.Text = "Total: " + groupWiseMenuListListBox.Items.Count.ToString();
            }
        }
        protected void LoadChildMenusByParentMenuId(string parentMenuId)
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetChildMenusByParentMenuId(parentMenuId);

                parentMenuDropDownList.DataSource = dt;
                parentMenuDropDownList.DataValueField = "MenuId";
                parentMenuDropDownList.DataTextField = "MenuName";
                parentMenuDropDownList.DataBind();
                parentMenuDropDownList.Items.Insert(0, "----------Select----------");
                parentMenuDropDownList.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void LoadMenuTypesByApp()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenuTypesByApp(menuForAppDropDownList.SelectedValue.Trim());

                menuTypeDropDownList.DataSource = dt;
                menuTypeDropDownList.DataValueField = "MenuType";
                menuTypeDropDownList.DataTextField = "MenuType";
                menuTypeDropDownList.DataBind();

                if (dt.Rows.Count == 1)
                {
                    menuTypeDropDownList.SelectedIndex = 0;
                }
                else
                {
                    menuTypeDropDownList.Items.Insert(0, "----------Select----------");
                    menuTypeDropDownList.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void deleteLinkButton_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                AppMenuBLL appMenu = new AppMenuBLL();
                string status = appMenu.DeleteMenuGroupById(menuGroupListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False");

                if (status == "Deleted")
                {
                    MyAlertBox("alert(\"Menu Group Deleted Successfully.\"); window.location=\"/setting/AppMenu/MenuGroupList.aspx\"");
                }
                else
                {
                    MyAlertBox("alert(\"This Menu Group contains " + status + " child(s). You can't delete this Menu Group. You must move the child(s) first to another menu group.\"); window.location=\"/UI/AppMenu/MenuGroupList.aspx\"");
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
        }
        protected void GetMenuList()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenuList();
                menuListGridView.DataSource = dt;
                menuListGridView.DataBind();

                if (menuListGridView.Rows.Count > 0)
                {
                    menuListGridView.UseAccessibleHeader = true;
                    menuListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void GetMenuById(string menuId)
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenuById(menuId);

                if (dt.Rows.Count > 0)
                {
                    appMenuNameHiddenField.Value = menuNameTextBox.Text = dt.Rows[0]["MenuName"].ToString();
                    descriptionTextBox.Text = dt.Rows[0]["ToolTipDescription"].ToString();
                    urlTextBox.Text = dt.Rows[0]["URL"].ToString();
                    displayNameTextBox.Text = dt.Rows[0]["DisplayName"].ToString();
                    imageURLTextBox.Text = dt.Rows[0]["ImageURL"].ToString();
                    menuTargetDropDownList.SelectedValue = dt.Rows[0]["MenuTarget"].ToString();

                    LoadMenuApps();
                    menuForAppDropDownList.SelectedValue = dt.Rows[0]["MenuForApp"].ToString();

                    LoadMenuTypesByApp();
                    menuTypeDropDownList.SelectedValue = dt.Rows[0]["MenuType"].ToString();

                    LoadMenuGroupsByMenuAppAndType();
                    menuGroupDropDownList.SelectedValue = dt.Rows[0]["MenuGroupId"].ToString();

                    menuDisplayDropDownList.SelectedValue = dt.Rows[0]["IsDisplay"].ToString();

                    LoadMenuLevelsByMenuAppTypeAndGroup();
                    menuLevelDropDownList.SelectedValue = dt.Rows[0]["ParentMenuLevel"].ToString();
                    LoadOnlyParentMenusByMenuAppTypeGroupAndLevel();

                    LoadParentMenusByMenuAppTypeGroupAndLevel();
                    parentMenuDropDownList.SelectedValue = dt.Rows[0]["ParentMenuId"].ToString();

                    menuDefaultDropDownList.SelectedValue = dt.Rows[0]["IsDefault"].ToString();
                    subParentMenuDropDownList.SelectedValue = dt.Rows[0]["IsSubParent"].ToString();
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void deactivateLinkButton_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                AppMenuBLL appMenu = new AppMenuBLL();
                appMenu.UpdateMenuActivation(menuListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False");

                MyAlertBox("alert(\"Menu Deactivated Successfully.\"); window.location=\"/setting/AppMenu/MenuList.aspx\"");
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
        }
        protected void LoadChildMenusByParentMenuId(string parentMenuId)
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetChildMenusByParentMenuId(parentMenuId);

                groupWiseUserMenuListListBox.DataSource = dt;
                groupWiseUserMenuListListBox.DataValueField = "MenuId";
                groupWiseUserMenuListListBox.DataTextField = "MenuName";
                groupWiseUserMenuListListBox.DataBind();

                if (groupWiseUserMenuListListBox.Items.Count > 0)
                {
                    upImageButton.Enabled = true;
                    downImageButton.Enabled = true;
                    saveButton.Enabled = true;
                }
                else
                {
                    upImageButton.Enabled = false;
                    downImageButton.Enabled = false;
                    saveButton.Enabled = false;
                }

                countChildMenuLabel.Text = "Total: " + groupWiseUserMenuListListBox.Items.Count.ToString();
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        private void PopulateUserMenu()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dtUserMenu = appMenu.GetUserMenuData(userIdLabel.Text.Trim(), menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());
                DataTable dtAllMenu = appMenu.GetAllMenusForMappingUserMenu(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());
                DataRow dr = null;

                for (int i = 0; i < dtUserMenu.Rows.Count; i++)
                {
                    for (int j = 0; j < dtAllMenu.Rows.Count; j++)
                    {
                        if (dtUserMenu.Rows[i]["ParentMenuId"].ToString() == dtAllMenu.Rows[j]["MenuId"].ToString())
                        {
                            dr = dtUserMenu.NewRow();

                            dr["MenuId"] = dtAllMenu.Rows[j]["MenuId"].ToString();
                            dr["MenuName"] = dtAllMenu.Rows[j]["MenuName"].ToString();
                            dr["ToolTipDescription"] = dtAllMenu.Rows[j]["ToolTipDescription"].ToString();
                            dr["ParentMenuId"] = dtAllMenu.Rows[j]["ParentMenuId"].ToString();
                            dr["URL"] = dtAllMenu.Rows[j]["URL"].ToString();
                            dr["MenuSorting"] = dtAllMenu.Rows[j]["MenuSorting"].ToString();
                            dr["DisplayName"] = dtAllMenu.Rows[j]["DisplayName"].ToString();
                            dr["ImageURL"] = dtAllMenu.Rows[j]["ImageURL"].ToString();
                            dr["MenuTarget"] = dtAllMenu.Rows[j]["MenuTarget"].ToString();

                            dtUserMenu.Rows.Add(dr);
                        }
                    }
                }

                ///////////////////////////////to convert column data type////////////////////////////////
                //DataTable dtCloned = dtUserMenu.Clone();
                //dtCloned.Columns["UserMenuSorting"].DataType = typeof(Int32);
                //foreach (DataRow row in dtUserMenu.Rows)
                //{
                //    dtCloned.ImportRow(row);
                //}

                dtUserMenu = dtUserMenu.DefaultView.ToTable(true, "MenuId", "MenuName", "ToolTipDescription", "ParentMenuId", "URL", "MenuSorting", "DisplayName", "MenuTarget", "ImageURL");
                dtUserMenu.DefaultView.Sort = "MenuSorting";
                dtUserMenu = dtUserMenu.DefaultView.ToTable();

                ///////////////////////////////to sort by column(s)///////////////////////////////////////
                //if (dtUserMenu.Rows.Count > 0)
                //{
                //    DataView dv = dtUserMenu.DefaultView;
                //    dv.Sort = "UserMenuSorting";
                //    dtUserMenu = dv.ToTable();
                //}

                if (dtUserMenu.Rows.Count > 0)
                {
                   // testAllMenu.Items.Clear();
                    AddTopMenuItems(dtUserMenu);
                }
                else
                {
                    //msgbox.Visible = true; msgTitleLabel.Text = "User Menu Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            AppMenuBLL appMenuBLL = new AppMenuBLL();
            List<string> userPrivilegeMenus = new List<string>();

            try
            {
                if (menuForAppDropDownList.Text == "----------Select----------")
                {
                    msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required.";
                }
                else if (menuTypeDropDownList.Text == "----------Select----------")
                {
                    msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required.";
                }
                else if (menuGroupDropDownList.Text == "----------Select----------")
                {
                    msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Group field is required.";
                }
                else
                {
                    for (int i = 0; i < groupWiseUserMenuListListBox.Items.Count; i++)
                    {
                        userPrivilegeMenus.Add(groupWiseUserMenuListListBox.Items[i].Value.Trim());
                    }

                    appMenuBLL.SaveUserPrivilegeMenu(userIdLabel.Text.Trim(), menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim(), menuGroupDropDownList.SelectedValue.Trim(), userPrivilegeMenus);

                    PopulateUserMenu();
                    //MyAlertBox("alert(\"User's Menu List Saved Successfully.\");");
                    string message = " <span class='actionTopic'>" + " User's Menu List Saved Successfully.</span>.";
                    MyAlertBox("var callbackOk = function () { window.location = \"\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");

                }
            }
            catch (Exception ex)
            {
                msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenuBLL = null;
                userPrivilegeMenus = null;
            }
        }
        protected void LoadMenuGroupsByMenuAppAndType()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenuGroupsByMenuAppAndType(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());

                menuGroupDropDownList.DataSource = dt;
                menuGroupDropDownList.DataValueField = "MenuGroupId";
                menuGroupDropDownList.DataTextField = "MenuGroupName";
                menuGroupDropDownList.DataBind();
                menuGroupDropDownList.Items.Insert(0, "----------Select----------");
                menuGroupDropDownList.SelectedIndex = 0;

                if (dt.Rows.Count > 1)
                {
                    menuGroupDropDownList.SelectedIndex = 1;
                    userMenuPane.Visible = true;
                    GetMenuListToPrivilegeUser();
                    GetPrivilegedMenuByUser();
                }
            }
            catch (Exception ex)
            {
                msgbox.Attributes.Add("class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
        private void PopulateAllMenu()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetAllMenuData(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());

                if (dt.Rows.Count > 0)
                {
                    //testAllMenu.Items.Clear();
                    AddTopMenuItems(dt);
                }
                else
                {
                    msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                appMenu = null;
            }
        }
        private void PopulateTestMenu()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetTestMenuData(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());

                if (dt.Rows.Count > 0)
                {
                   // testAllMenu.Items.Clear();
                    AddTopMenuItems(dt);
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                if (menuGroupNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Group Name field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (displayNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Display Name field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (urlTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu URL field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuTypeDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuForAppDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else
                {
                    appMenu.MenuGroupName = menuGroupNameTextBox.Text.Trim();
                    appMenu.DisplayName = displayNameTextBox.Text.Trim();
                    appMenu.ToolTipDescription = descriptionTextBox.Text.Trim();
                    appMenu.URL = urlTextBox.Text.Trim();
                    appMenu.MenuType = menuTypeDropDownList.SelectedValue.Trim();
                    appMenu.MenuForApp = menuForAppDropDownList.SelectedValue.Trim();
                    appMenu.MenuTarget = menuTargetDropDownList.SelectedValue.Trim();
                    appMenu.ImageUrl = imageURLTextBox.Text.Trim();

                    if (!appMenu.CheckDuplicateMenuGroup(appMenu.MenuGroupName))
                    {
                        DataTable dt = appMenu.SaveMenuGroup();

                        if (dt.Rows.Count > 0)
                        {
                            MyAlertBox("alert(\"Menu Group Created Successfully with Menu Group ID: " + dt.Rows[0][0].ToString() + " \"); window.location=\"/setting/AppMenu/MenuGroupList.aspx\"");
                        }
                        else
                        {
                            msgbox.Visible = true; msgTitleLabel.Text = "Failed to Create Menu Group!!!"; msgDetailLabel.Text = "";
                            msgbox.Attributes.Add("Class", "alert alert-warning");
                        }
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This Menu Group already exist, try another one.";
                        msgbox.Attributes.Add("Class", "alert alert-warning");
                    }
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
Example #15
0
        public void UpdateMenu(AppMenuBLL appMenu, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@MenuId", appMenu.MenuId.Trim());
                db.AddParameters("@MenuName", appMenu.MenuName.Trim());
                db.AddParameters("@DisplayName", appMenu.DisplayName.Trim());
                db.AddParameters("@MenuTarget", appMenu.MenuTarget.Trim());
                db.AddParameters("@ImageUrl", appMenu.ImageUrl.Trim());
                db.AddParameters("@ToolTipDescription", appMenu.ToolTipDescription.Trim());
                db.AddParameters("@ParentMenuId", appMenu.ParentMenuId.Trim());
                db.AddParameters("@URL", appMenu.URL.Trim());
                db.AddParameters("@MenuGroupId", appMenu.MenuGroupId.Trim());
                db.AddParameters("@MenuType", appMenu.MenuType.Trim());
                db.AddParameters("@MenuForApp", appMenu.MenuForApp.Trim());
                db.AddParameters("@MenuLevel", appMenu.MenuLevel.Trim());
                db.AddParameters("@IsDefault", appMenu.IsDefault.Trim());
                db.AddParameters("@IsDisplay", appMenu.IsDisplay.Trim());
                db.AddParameters("@IsSubParent", appMenu.IsSubParent.Trim());

                DataTable dtMGL = db.ExecuteDataTable("UPDATE_MENU_BY_ID", true);

                if (dtMGL.Rows.Count > 0 && dtMGL.Rows[0][0].ToString() != "Done")
                {
                    DataTable dt = new DataTable();
                    DataRow dr = null;

                    for (int i = 0; i < dtMGL.Rows.Count; i++)
                    {
                        dt = null;

                        db.ClearParameters();
                        db.AddParameters("@MenuId", dtMGL.Rows[i]["MenuId"].ToString());
                        dt = db.ExecuteDataTable("GET_CHILD_MENUS_BY_MENU_ID", true);

                        if (dt.Rows.Count > 0)
                        {
                            for (int j = 0; j < dt.Rows.Count; j++)
                            {
                                dr = dtMGL.NewRow();
                                dr["MenuId"] = dt.Rows[j]["MenuId"].ToString();
                                dr["MenuLevel"] = (int.Parse(dtMGL.Rows[i]["MenuLevel"].ToString()) + 1).ToString();
                                dr["MenuGroupId"] = dtMGL.Rows[i]["MenuGroupId"].ToString();
                                dtMGL.Rows.Add(dr);
                            }
                        }
                    }

                    for (int i = 0; i < dtMGL.Rows.Count; i++)
                    {
                        db.ClearParameters();
                        db.AddParameters("@MenuId", dtMGL.Rows[i]["MenuId"].ToString());
                        db.AddParameters("@MenuLevel", dtMGL.Rows[i]["MenuLevel"].ToString());
                        db.AddParameters("@MenuGroupId", dtMGL.Rows[i]["MenuGroupId"].ToString());

                        dt = db.ExecuteDataTable("UPDATE_CHILD_MENUS_GROUP_AND_LEVEL_BY_MENU_ID", true);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void LoadOnlyParentMenusByMenuAppTypeGroupAndLevel()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                groupWiseMenuListListBox.Items.Clear();
                groupWiseUserMenuListListBox.Items.Clear();

                DataTable dt = appMenu.GetOnlyParentMenusByMenuAppTypeGroupAndLevel(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim(), menuGroupDropDownList.SelectedValue.Trim(), menuLevelDropDownList.SelectedValue.Trim());

                groupWiseMenuListListBox.DataSource = dt;
                groupWiseMenuListListBox.DataValueField = "MenuId";
                groupWiseMenuListListBox.DataTextField = "MenuName";
                groupWiseMenuListListBox.DataBind();

                if (groupWiseMenuListListBox.Items.Count > 0)
                {
                    refreshImageButton.Enabled = true;
                    getChildsButton.Enabled = true;
                }
                else
                {
                    refreshImageButton.Enabled = false;
                    getChildsButton.Enabled = false;
                }

                countSubParentMenuLabel.Text = "Total: " + groupWiseMenuListListBox.Items.Count.ToString();
                countChildMenuLabel.Text = "Total: " + groupWiseUserMenuListListBox.Items.Count.ToString();
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        private void GetChildMenuItems(string Title)
        {
            ChildLevelMenuItems.Clear();
            DataView view = new DataView(usermenu);
            view.RowFilter = "ParentMenuId=" + Title;

            foreach (DataRowView row in view)
            {
                AppMenuBLL newMenuItem = new AppMenuBLL();
                newMenuItem.URL = row["URL"].ToString();
                newMenuItem.DisplayName = row["DisplayName"].ToString();
                newMenuItem.ImageUrl = row["ImageURL"].ToString();

                ChildLevelMenuItems.Add(newMenuItem);
            }
        }
        private void PopulateUserMenuForDeveloper(string menufor)
        {
            AppMenuBLL appMenu = new AppMenuBLL();
            string appmenu = "";
            try
            {
                if ((string)LumexSessionManager.Get("isMenu") == "N")
                {
                    if (menufor == "globalapp")
                    {
                        appmenu = "globalapp";
                    }
                    else if (menufor == "Site")
                    {
                        appmenu = "Site";
                    }
                    else if (menufor == "stn")
                    {
                        appmenu = "Settings";
                    }

                    ParentLevelMenuItems.Clear();
                    usermenu = new DataTable();
                    DataTable dtUserMenu = appMenu.GetAllMenuData(appmenu, "Sidebar");
                    usermenu = dtUserMenu;
                    if (dtUserMenu.Rows.Count > 0)
                    {
                        //    ainMenu.Items.Clear();
                        //      AddTopMenuItems(dtUserMenu);
                        getParentMenulist(dtUserMenu);
                        ParentLevelMenuRepeater.DataSource = ParentLevelMenuItems;
                        ParentLevelMenuRepeater.DataBind();
                    }

                    if (menufor == "App")
                    {
                        LumexSessionManager.Add("App", dtUserMenu);
                    }
                    else if (menufor == "Site")
                    {
                        LumexSessionManager.Add("Site", dtUserMenu);
                    }
                    else if (menufor == "stn")
                    {
                        LumexSessionManager.Add("menustn", dtUserMenu);
                    }
                    // LumexSessionManager.Add("IsMenu", "Y");
                }
                else if ((string)LumexSessionManager.Get("isMenu") == "Y")
                {
                    // usermenu = new DataTable();
                    //  usermenu = (DataTable)LumexSessionManager.Get("Menudata");
                    getParentMenulist(usermenu);
                    ParentLevelMenuRepeater.DataSource = ParentLevelMenuItems;
                    ParentLevelMenuRepeater.DataBind();
                }
            }
            catch (Exception)
            {

            }
            finally
            {
                appMenu = null;
            }
        }
        private void PopulateUserMenu(string menufor)
        {
            string path = HttpContext.Current.Request.Url.AbsolutePath;
            AppMenuBLL appMenu = new AppMenuBLL();
            string appmenufor = "";
            try
            {
                if ((string)LumexSessionManager.Get("isMenu") == "N")
                {
                    if (menufor == "globalapp")
                    {
                        appmenufor = "globalapp";
                    }
                    else if (menufor == "Site")
                    {
                        appmenufor = "Site";
                    }
                    else if (menufor == "stn")
                    {
                        appmenufor = "Settings";
                    }
                    DataTable dtUserMenu = appMenu.GetUserMenuData(LumexSessionManager.Get("ActiveUserId").ToString(), appmenufor, "Sidebar");
                    DataTable dtAllMenu = appMenu.GetAllMenusForMappingUserMenu(appmenufor, "Sidebar");
                    DataRow dr = null;
                    //   path = "/Default.aspx";
                    if (path == "/Default.aspx")
                    {
                        path = "Done";
                    }
                    else
                    {
                        for (int i = 0; i < dtUserMenu.Rows.Count; i++)
                        {
                            if (path == dtUserMenu.Rows[i]["URL"].ToString())
                            {
                                path = "Done";
                                break;
                            }
                        }
                    }
                    if (path != "Done")
                    {
                        // LumexSessionManager.RemoveAll();
                        //Response.Redirect("~/Page404.aspx", false);
                        Response.Redirect("~/Default.aspx", false);
                    }
                    else
                    {
                        for (int i = 0; i < dtUserMenu.Rows.Count; i++)
                        {
                            if (dtUserMenu.Rows[i]["IsDisplay"].ToString() == "False")
                            {
                                dtUserMenu.Rows.RemoveAt(i);
                                i--;
                            }
                        }

                        for (int i = 0; i < dtUserMenu.Rows.Count; i++)
                        {
                            for (int j = 0; j < dtAllMenu.Rows.Count; j++)
                            {
                                if (dtUserMenu.Rows[i]["ParentMenuId"].ToString() == dtAllMenu.Rows[j]["MenuId"].ToString())
                                {
                                    dr = dtUserMenu.NewRow();

                                    dr["MenuId"] = dtAllMenu.Rows[j]["MenuId"].ToString();
                                    dr["MenuName"] = dtAllMenu.Rows[j]["MenuName"].ToString();
                                    dr["ToolTipDescription"] = dtAllMenu.Rows[j]["ToolTipDescription"].ToString();
                                    dr["ParentMenuId"] = dtAllMenu.Rows[j]["ParentMenuId"].ToString();
                                    dr["URL"] = dtAllMenu.Rows[j]["URL"].ToString();
                                    dr["MenuSorting"] = dtAllMenu.Rows[j]["MenuSorting"].ToString();
                                    dr["DisplayName"] = dtAllMenu.Rows[j]["DisplayName"].ToString();
                                    dr["ImageURL"] = dtAllMenu.Rows[j]["ImageURL"].ToString();
                                    dr["MenuTarget"] = dtAllMenu.Rows[j]["MenuTarget"].ToString();
                                    dr["IsDisplay"] = dtAllMenu.Rows[j]["IsDisplay"].ToString();

                                    dtUserMenu.Rows.Add(dr);
                                }
                            }
                        }

                        ///////////////////////////////to convert column data type////////////////////////////////
                        //DataTable dtCloned = dtUserMenu.Clone();
                        //dtCloned.Columns["UserMenuSorting"].DataType = typeof(Int32);
                        //foreach (DataRow row in dtUserMenu.Rows)
                        //{
                        //    dtCloned.ImportRow(row);
                        //}

                        dtUserMenu = dtUserMenu.DefaultView.ToTable(true, "MenuId", "MenuName", "ToolTipDescription", "ParentMenuId", "URL", "MenuSorting", "DisplayName", "MenuTarget", "ImageURL", "IsDisplay");
                        dtUserMenu.DefaultView.Sort = "MenuSorting";
                        dtUserMenu = dtUserMenu.DefaultView.ToTable();
                        usermenu = dtUserMenu;
                        ///////////////////////////////to sort by column(s)///////////////////////////////////////
                        //if (dtUserMenu.Rows.Count > 0)
                        //{
                        //    DataView dv = dtUserMenu.DefaultView;
                        //    dv.Sort = "UserMenuSorting";
                        //    dtUserMenu = dv.ToTable();
                        //}

                        //   mainMenu.Items.Clear();
                        getParentMenulist(dtUserMenu);
                        ParentLevelMenuRepeater.DataSource = ParentLevelMenuItems;
                        ParentLevelMenuRepeater.DataBind();
                        //if (menufor == "inv")
                        //{
                        //    LumexSessionManager.Add("menuinv", dtUserMenu);
                        //}
                        //else if (menufor == "acc")
                        //{
                        //    LumexSessionManager.Add("menuacc", dtUserMenu);
                        //}
                        //else if (menufor == "stn")
                        //{
                        //    LumexSessionManager.Add("menustn", dtUserMenu);
                        //}

                    }
                }
                else if ((string)LumexSessionManager.Get("isMenu") == "Y")
                {
                    //usermenu = new DataTable();
                    //usermenu = (DataTable)LumexSessionManager.Get("Menudata");
                    if (path == "/Default.aspx")
                    {
                        path = "Done";
                    }
                    else
                    {
                        for (int i = 0; i < usermenu.Rows.Count; i++)
                        {
                            if (path == usermenu.Rows[i]["URL"].ToString())
                            {
                                path = "Done";
                                break;
                            }
                        }
                    }

                    if (path != "Done")
                    {
                        LumexSessionManager.RemoveAll();
                        Response.Redirect("~/Default.aspx", false);
                    }
                    getParentMenulist(usermenu);
                    ParentLevelMenuRepeater.DataSource = ParentLevelMenuItems;
                    ParentLevelMenuRepeater.DataBind();
                }
            }
            catch (Exception ex)
            {
                //  msgboxApp.Visible = true; msgTitleLabelApp.Text = "Exception!!!"; msgDetailLabelApp.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
        private void getParentMenulist(DataTable menudata)
        {
            DataView view = new DataView(menudata);
            view.RowFilter = "ParentMenuId=0";
            foreach (DataRowView row in view)
            {
                AppMenuBLL newMenuItem = new AppMenuBLL();
                newMenuItem.URL = row["URL"].ToString();
                newMenuItem.DisplayName = row["DisplayName"].ToString();
                newMenuItem.ImageUrl = row["ImageURL"].ToString();
                newMenuItem.MenuId = row["MenuId"].ToString();

                ParentLevelMenuItems.Add(newMenuItem);

            }
        }
        private void PopulateUserMenu()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dtUserMenu = appMenu.GetUserGroupMenuData(userGroupIdForSetMenuHiddenField.Value.Trim(), menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());
                DataTable dtAllMenu = appMenu.GetAllMenusForMappingUserMenu(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());
                DataRow dr = null;

                //for (int i = 0; i < dtUserMenu.Rows.Count; i++)
                //{
                //    if (dtUserMenu.Rows[i]["IsDisplay"].ToString() == "False")
                //    {
                //        dtUserMenu.Rows.RemoveAt(i);
                //        i--;
                //    }
                //}

                for (int i = 0; i < dtUserMenu.Rows.Count; i++)
                {
                    for (int j = 0; j < dtAllMenu.Rows.Count; j++)
                    {
                        if (dtUserMenu.Rows[i]["ParentMenuId"].ToString() == dtAllMenu.Rows[j]["MenuId"].ToString())
                        {
                            dr = dtUserMenu.NewRow();

                            dr["MenuId"] = dtAllMenu.Rows[j]["MenuId"].ToString();
                            dr["MenuName"] = dtAllMenu.Rows[j]["MenuName"].ToString();
                            dr["ToolTipDescription"] = dtAllMenu.Rows[j]["ToolTipDescription"].ToString();
                            dr["ParentMenuId"] = dtAllMenu.Rows[j]["ParentMenuId"].ToString();
                            dr["URL"] = dtAllMenu.Rows[j]["URL"].ToString();
                            dr["MenuSorting"] = dtAllMenu.Rows[j]["MenuSorting"].ToString();
                            dr["DisplayName"] = dtAllMenu.Rows[j]["DisplayName"].ToString();
                            dr["ImageURL"] = dtAllMenu.Rows[j]["ImageURL"].ToString();
                            dr["MenuTarget"] = dtAllMenu.Rows[j]["MenuTarget"].ToString();

                            dtUserMenu.Rows.Add(dr);
                        }
                    }
                }

                ///////////////////////////////to convert column data type////////////////////////////////
                //DataTable dtCloned = dtUserMenu.Clone();
                //dtCloned.Columns["UserMenuSorting"].DataType = typeof(Int32);
                //foreach (DataRow row in dtUserMenu.Rows)
                //{
                //    dtCloned.ImportRow(row);
                //}

                dtUserMenu = dtUserMenu.DefaultView.ToTable(true, "MenuId", "MenuName", "ToolTipDescription", "ParentMenuId", "URL", "MenuSorting", "DisplayName", "MenuTarget", "ImageURL");
                dtUserMenu.DefaultView.Sort = "MenuSorting";
                dtUserMenu = dtUserMenu.DefaultView.ToTable();

                ///////////////////////////////to sort by column(s)///////////////////////////////////////
                //if (dtUserMenu.Rows.Count > 0)
                //{
                //    DataView dv = dtUserMenu.DefaultView;
                //    dv.Sort = "UserMenuSorting";
                //    dtUserMenu = dv.ToTable();
                //}

                if (dtUserMenu.Rows.Count > 0)
                {
                    //testAllMenu.Items.Clear();
                    AddTopMenuItems(dtUserMenu);
                }
                else
                {
                    //msgbox.Visible = true; msgTitleLabel.Text = "User Menu Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void GetPrivilegedMenuByUserGroup()
        {
            AppMenuBLL appMenuBLL = new AppMenuBLL();

            try
            {
                groupWiseUserGroupMenuListListBox.Items.Clear();

                DataTable dt = appMenuBLL.GetPrivilegedMenuByUserGroup(userGroupIdForSetMenuHiddenField.Value.Trim(), menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim(), menuGroupDropDownList.SelectedValue.Trim());

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        groupWiseUserGroupMenuListListBox.Items.Add(new ListItem(dt.Rows[i]["MenuName"].ToString(), dt.Rows[i]["MenuId"].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                appMenuBLL = null;
                countUserMenuLabel.Text = "Total: " + groupWiseUserGroupMenuListListBox.Items.Count.ToString();
            }
        }
Example #23
0
        public DataTable SaveMenuGroup(AppMenuBLL appMenu, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@MenuGroupName", appMenu.MenuGroupName.Trim());
                db.AddParameters("@DisplayName", appMenu.DisplayName.Trim());
                db.AddParameters("@MenuTarget", appMenu.MenuTarget.Trim());
                db.AddParameters("@ImageUrl", appMenu.ImageUrl.Trim());
                db.AddParameters("@ToolTipDescription", appMenu.ToolTipDescription.Trim());
                db.AddParameters("@URL", appMenu.URL.Trim());
                db.AddParameters("@MenuType", appMenu.MenuType.Trim());
                db.AddParameters("@MenuForApp", appMenu.MenuForApp.Trim());

                DataTable dt = db.ExecuteDataTable("INSERT_MENU_GROUP", true);
                return dt;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void LoadMenuGroupsByMenuAppAndType()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenuGroupsByMenuAppAndType(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());

                menuGroupDropDownList.DataSource = dt;
                menuGroupDropDownList.DataValueField = "MenuGroupId";
                menuGroupDropDownList.DataTextField = "MenuGroupName";
                menuGroupDropDownList.DataBind();
                menuGroupDropDownList.Items.Insert(0, "");
                menuGroupDropDownList.SelectedIndex = 0;

                if (dt.Rows.Count > 1)
                {
                    menuGroupDropDownList.SelectedIndex = 1;
                    userMenuPane.Visible = true;
                    GetMenuListToPrivilegeUser();
                    GetPrivilegedMenuByUserGroup();
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                appMenu = null;
                MyAlertBox("MyOverlayStop();");
            }
        }
Example #25
0
        public void UpdateMenuGroup(AppMenuBLL appMenu, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@MenuGroupId", appMenu.MenuGroupId.Trim());
                db.AddParameters("@MenuGroupName", appMenu.MenuGroupName.Trim());
                db.AddParameters("@DisplayName", appMenu.DisplayName.Trim());
                db.AddParameters("@MenuTarget", appMenu.MenuTarget.Trim());
                db.AddParameters("@ImageUrl", appMenu.ImageUrl.Trim());
                db.AddParameters("@ToolTipDescription", appMenu.ToolTipDescription.Trim());
                db.AddParameters("@URL", appMenu.URL.Trim());
                db.AddParameters("@MenuType", appMenu.MenuType.Trim());
                db.AddParameters("@MenuForApp", appMenu.MenuForApp.Trim());

                db.ExecuteNonQuery("UPDATE_MENU_GROUP_BY_ID", true);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                if (groupWiseUserMenuListListBox.Items.Count > 0)
                {
                    appMenu.UpdateMenuSorting(groupWiseUserMenuListListBox, parentMenuIdHiddenField.Value.Trim());
                    PopulateAllMenu();
                    MyAlertBox("alert(\"Menu Sorted Successfully.\");");
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void updateButton_Click(object sender, EventArgs e)
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                if (menuNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Name field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (displayNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Display Name field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (urlTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu URL field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuForAppDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuTypeDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuGroupDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Group field is required.";

                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuDisplayDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Display field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuLevelDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Level field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (parentMenuDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Parent Menu field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (menuDefaultDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Default field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else if (subParentMenuDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Use as Sub-Parent field is required.";
                    msgbox.Attributes.Add("Class", "alert alert-warning");
                }
                else
                {
                    appMenu.MenuId = idLabel.Text.Trim();
                    appMenu.MenuName = menuNameTextBox.Text.Trim();
                    appMenu.DisplayName = displayNameTextBox.Text.Trim();
                    appMenu.ToolTipDescription = descriptionTextBox.Text.Trim();
                    appMenu.URL = urlTextBox.Text.Trim();
                    appMenu.MenuForApp = menuForAppDropDownList.SelectedValue.Trim();
                    appMenu.MenuType = menuTypeDropDownList.SelectedValue.Trim();
                    appMenu.MenuGroupId = menuGroupDropDownList.SelectedValue.Trim();
                    appMenu.IsDisplay = menuDisplayDropDownList.SelectedValue.Trim();
                    appMenu.MenuLevel = menuLevelDropDownList.SelectedValue.Trim();
                    appMenu.ParentMenuId = parentMenuDropDownList.SelectedValue.Trim();
                    appMenu.IsDefault = menuDefaultDropDownList.SelectedValue.Trim();
                    appMenu.IsSubParent = subParentMenuDropDownList.SelectedValue.Trim();
                    appMenu.MenuTarget = menuTargetDropDownList.SelectedValue.Trim();
                    appMenu.ImageUrl = imageURLTextBox.Text.Trim();

                    if (!appMenu.CheckDuplicateMenu(menuNameTextBox.Text.Trim()))
                    {
                        appMenu.UpdateMenu();

                        appMenuIdForUpdateHiddenField.Value = "";
                        appMenuNameHiddenField.Value = "";
                        MyAlertBox("alert(\"Menu Updated Successfully.\"); window.location=\"/setting/AppMenu/MenuList.aspx\"");
                    }
                    else
                    {
                        if (appMenuNameHiddenField.Value == menuNameTextBox.Text.Trim())
                        {
                            appMenu.MenuName = "WithOut";
                            appMenu.UpdateMenu();

                            appMenuIdForUpdateHiddenField.Value = "";
                            appMenuNameHiddenField.Value = "";
                            MyAlertBox("alert(\"Menu Updated Successfully.\"); window.location=\"/setting/AppMenu/MenuList.aspx\"");
                        }
                        else
                        {
                            msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This Menu already exist, try another one.";
                            msgbox.Attributes.Add("Class", "alert alert-warning");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void GetPrivilegedMenuByUser()
        {
            AppMenuBLL appMenuBLL = new AppMenuBLL();

            try
            {
                groupWiseUserMenuListListBox.Items.Clear();

                DataTable dt = appMenuBLL.GetPrivilegedMenuByUser(userIdLabel.Text.Trim(), menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim(), menuGroupDropDownList.SelectedValue.Trim());

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        groupWiseUserMenuListListBox.Items.Add(new ListItem(dt.Rows[i]["MenuName"].ToString(), dt.Rows[i]["MenuId"].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenuBLL = null;
                countUserMenuLabel.Text = "Total: " + groupWiseUserMenuListListBox.Items.Count.ToString();
            }
        }
        protected void LoadParentMenusByMenuAppAndType()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.LoadParentMenusByMenuAppAndType(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim());

                groupWiseUserMenuListListBox.DataSource = dt;
                groupWiseUserMenuListListBox.DataValueField = "MenuId";
                groupWiseUserMenuListListBox.DataTextField = "MenuName";
                groupWiseUserMenuListListBox.DataBind();

                if (groupWiseUserMenuListListBox.Items.Count > 0)
                {
                    upImageButton.Enabled = true;
                    downImageButton.Enabled = true;
                    saveButton.Enabled = true;
                    menuSortingPane.Visible = true;
                }
                else
                {
                    upImageButton.Enabled = false;
                    downImageButton.Enabled = false;
                    saveButton.Enabled = false;
                    menuSortingPane.Visible = false;
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
                msgbox.Attributes.Add("Class", "alert alert-warning");
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void LoadMenuTypesByApp()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenuTypesByApp(menuForAppDropDownList.SelectedValue.Trim());

                menuTypeDropDownList.DataSource = dt;
                menuTypeDropDownList.DataValueField = "MenuType";
                menuTypeDropDownList.DataTextField = "MenuType";
                menuTypeDropDownList.DataBind();

                if (dt.Rows.Count == 1)
                {
                    menuTypeDropDownList.SelectedIndex = 0;
                    LoadMenuGroupsByMenuAppAndType();
                    PopulateUserMenu();
                }
                else
                {
                    menuTypeDropDownList.Items.Insert(0, "");
                    menuTypeDropDownList.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                appMenu = null;
                MyAlertBox("MyOverlayStop();");
            }
        }