private SecurityModule.Provider.RoleProvider GenerateRoleMaster() { SecurityModule.Provider.RoleProvider provider = new SecurityModule.Provider.RoleProvider(); try { provider.RoleCode = hfRoleCode.Value.IsNullOrEmpty() ? 0 : hfRoleCode.Value.ToInt(); provider.RoleName = roleNameTextBox.Text.ToString(); provider.RoleDescription = descriptionTextBox.Text.ToString(); } catch (Exception ex) { throw (ex); } return(provider); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { SecurityModule.Provider.RoleProvider roleMasterList = GenerateRoleMaster(); List <PageControlsProvider> roleDetailsList = PageControlsProviders(); //aProviders = new PageControlsProvider(); string text = btnSubmit.Text; string roleName = roleNameTextBox.Text; //var aList = PageControlsProviders(); if (roleName != "" && text == "Submit") { if (roleDetailsList.Count == 0) { throw new Exception("No item is selected."); } roleMasterList.Save(roleDetailsList); //aProviders.SavePageControls(aList, text); Clear(); //this.AlertSuccess(lblMsg, MessageConstants.Saved); MessageHelper.ShowAlertMessage(MessageConstants.Saved); } else if (roleName != "" && text == "Update") { roleMasterList.Update(roleDetailsList); //aProviders.UpdatePageControls(aList, text); Clear(); // this.AlertSuccess(lblMsg, MessageConstants.Updated); MessageHelper.ShowAlertMessage(MessageConstants.Updated); } else { // this.AlertWarning(lblMsg, MessageConstants.SavedWarning); MessageHelper.ShowAlertMessage(MessageConstants.SavedWarning); } } catch (SqlException ex) { MessageHelper.ShowAlertMessage(ex.Message); } catch (Exception ex) { MessageHelper.ShowAlertMessage(ex.Message); } }
protected void ddlMenuType_OnSelectedIndexChanged(object sender, EventArgs e) { SecurityModule.Provider.RoleProvider provider = new SecurityModule.Provider.RoleProvider(); try { GetwithCaption(); DataTable dt = new DataTable(); dt = (DataTable)HttpContext.Current.Session["pageControlsTable"]; DataTable filterSetDT = new DataTable(); DataTable exFiltersetDT = new DataTable(); string filterExpression = "ParentID=" + ddlMenuType.SelectedValue; DataRow[] dr; dr = dt.Select(filterExpression); if (dr.Length == 0) { return; } filterSetDT = dr.CopyToDataTable(); string filterExpression2 = "ParentID<>" + ddlMenuType.SelectedValue; dr = dt.Select(filterExpression2); exFiltersetDT = dr.CopyToDataTable(); filterSetDT.Merge(exFiltersetDT); dt.Clear(); dt = filterSetDT; //GridView1.DataSource = null; //GridView1.DataBind(); GridView1.DataSource = dt; GridView1.DataBind(); Session["pageControlsTable"] = String.Empty; Session["pageControlsTable"] = dt; } catch (SqlException ex) { MessageHelper.ShowAlertMessage(ex.Message); } catch (Exception ex) { MessageHelper.ShowAlertMessage(ex.Message); } }
private void PopulateddlMenuType() { SecurityModule.Provider.RoleProvider provider = new SecurityModule.Provider.RoleProvider(); try { ddlMenuType.DataSource = provider.GetAllMenu(); ddlMenuType.DataTextField = "Caption"; ddlMenuType.DataValueField = "ID"; ddlMenuType.DataBind(); ddlMenuType.Items.Insert(0, new ListItem(string.Empty, "0")); ddlMenuType.SelectedIndex = 0; } catch (SqlException ex) { MessageHelper.ShowAlertMessage(ex.Message); } catch (Exception ex) { MessageHelper.ShowAlertMessage(ex.Message); } }