Example #1
0
        public DataTable SaveMenu(AppMenuBLL appMenu, LumexDBPlayer db)
        {
            try
            {
                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 dt = db.ExecuteDataTable("INSERT_MENU", true);

                return dt;
            }
            catch (Exception)
            {
                throw;
            }
            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;
            }
            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.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
Example #4
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 (menuGroupNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Group Name field is required.";
                }
                else if (displayNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Display Name field is required.";
                }
                else if (urlTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu URL field is required.";
                }
                else if (menuTypeDropDownList.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required.";
                }
                else if (menuForAppDropDownList.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required.";
                }
                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=\"/UI/AppMenu/MenuGroupList.aspx\"");
                        }
                        else
                        {
                            msgbox.Visible = true; msgTitleLabel.Text = "Failed to Create Menu Group!!!"; msgDetailLabel.Text = "";
                        }
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This Menu Group already exist, try another one.";
                    }
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
Example #6
0
        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, "");
                parentMenuDropDownList.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
Example #7
0
        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);

            }
        }
        protected void updateButton_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.";
                }
                else if (displayNameTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Display Name field is required.";
                }
                else if (urlTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu URL field is required.";
                }
                else if (menuTypeDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required.";
                }
                else if (menuForAppDropDownList.Text == "----------Select----------")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required.";
                }
                else
                {
                    appMenu.MenuGroupId = idLabel.Text.Trim();
                    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(menuGroupNameTextBox.Text.Trim()))
                    {
                        appMenu.UpdateMenuGroup();

                        appMenuGroupIdForUpdateHiddenField.Value = "";
                        appMenuGroupNameHiddenField.Value = "";
                        MyAlertBox("alert(\"Menu Group Updated Successfully.\"); window.location=\"/UI/AppMenu/MenuGroupList.aspx\"");
                    }
                    else
                    {
                        if (appMenuGroupNameHiddenField.Value == menuGroupNameTextBox.Text.Trim())
                        {
                            appMenu.MenuGroupName = "WithOut";
                            appMenu.UpdateMenuGroup();

                            appMenuGroupIdForUpdateHiddenField.Value = "";
                            appMenuGroupNameHiddenField.Value = "";
                            MyAlertBox("alert(\"Menu Group Updated Successfully.\"); window.location=\"/UI/AppMenu/MenuGroupList.aspx\"");
                        }
                        else
                        {
                            msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This Menu Group already exist, try another one.";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
Example #9
0
        private void PopulateUserMenuForDeveloper(string menufor)
        {
            AppMenuBLL appMenu = new AppMenuBLL();
            string appmenu = "";
            try
            {
                if ((string)LumexSessionManager.Get("isMenu") == "N")
                {
                    if (menufor == "inv")
                    {
                        appmenu = "Inventory";
                    }
                    else if (menufor == "acc")
                    {
                        appmenu = "Accounts";
                    }
                    else if (menufor == "stn")
                    {
                        appmenu = "Settings";
                    }

                    ParentLevelMenuItems.Clear();
                    usermenu = new DataTable();
                    DataTable dtUserMenu = appMenu.GetAllMenuData(appmenu, "Sideber");
                    usermenu = dtUserMenu;
                    if (dtUserMenu.Rows.Count > 0)
                    {
                        //    ainMenu.Items.Clear();
                        //      AddTopMenuItems(dtUserMenu);
                        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);
                    }
                    // 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;
            }
        }
Example #10
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            AppMenuBLL appMenuBLL = new AppMenuBLL();
            List<string> userPrivilegeMenus = new List<string>();

            try
            {
                if (menuForAppDropDownList.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required.";
                }
                else if (menuTypeDropDownList.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required.";
                }
                else if (menuGroupDropDownList.Text == "")
                {
                    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();
                    string message = "User's Menu List <span class='actionTopic'>Saved</span> Successfully.";
                    MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                appMenuBLL = null;
                userPrivilegeMenus = null;
            }
        }
        protected void LoadMenuLevelsByMenuAppTypeAndGroup()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

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

                menuLevelDropDownList.DataSource = dt;
                menuLevelDropDownList.DataValueField = "MenuLevel";
                menuLevelDropDownList.DataTextField = "MenuLevel";
                menuLevelDropDownList.DataBind();
                menuLevelDropDownList.Items.Insert(0, "");
                menuLevelDropDownList.Items.Insert(1, "All");
                menuLevelDropDownList.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
Example #12
0
        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++)
                //{
                //    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["MenuSorting"].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 = "MenuSorting";
                    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;
            }
        }
Example #13
0
        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)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                appMenuBLL = null;
                countUserMenuLabel.Text = "Total: " + groupWiseUserMenuListListBox.Items.Count.ToString();
            }
        }
Example #14
0
        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();
                    GetPrivilegedMenuByUser();
                }
            }
            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 #15
0
        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();");
            }
        }
Example #16
0
        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.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;
            }
        }
Example #17
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 GetMenuListByMenuAppTypeGroupAndLevel()
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenusByMenuAppTypeGroupAndLevel(menuForAppDropDownList.SelectedValue.Trim(), menuTypeDropDownList.SelectedValue.Trim(), menuGroupDropDownList.SelectedValue.Trim(), menuLevelDropDownList.SelectedValue.Trim());
                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 = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            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=\"/UI/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;
            }
        }
Example #20
0
        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);
            }
        }
        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 = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                appMenu = null;
            }
        }
        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;
            }
            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=\"/UI/AppMenu/AdminMenuList.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;
            }
            finally
            {
                appMenu = null;
            }
        }
        protected void GetMenuGroupById(string menuGroupId)
        {
            AppMenuBLL appMenu = new AppMenuBLL();

            try
            {
                DataTable dt = appMenu.GetMenuGroupById(menuGroupId);

                if (dt.Rows.Count > 0)
                {
                    appMenuGroupNameHiddenField.Value = menuGroupNameTextBox.Text = dt.Rows[0]["MenuGroupName"].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();
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            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;
            }
            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;
            }
            finally
            {
                appMenu = null;
            }
        }
Example #28
0
        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 == "inv")
                    {
                        appmenufor = "Inventory";
                    }
                    else if (menufor == "acc")
                    {
                        appmenufor = "Accounts";
                    }
                    else if (menufor == "stn")
                    {
                        appmenufor = "Settings";
                    }
                    DataTable dtUserMenu = appMenu.GetUserMenuData(LumexSessionManager.Get("ActiveUserId").ToString(), appmenufor, "Sideber");
                    DataTable dtAllMenu = appMenu.GetAllMenusForMappingUserMenu(appmenufor, "Sideber");
                    DataRow dr = null;

                    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;
            }
        }