Exemplo n.º 1
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;
            }
        }