private void BindUserPageSecuritySelections() { try { DataTable dt = new DataTable(); dt = UserSecurityData.GetPageSecurityBySelection(SECURITY_PAGE); ddlPage.DataValueField = "typeid"; ddlPage.DataTextField = "description"; ddlPage.DataSource = dt; ddlPage.DataBind(); ddlPage.Items.Insert(0, new ListItem("Select", "NA")); dt = new DataTable(); dt = UserSecurityData.GetPageSecurityBySelection(SECURITY_FIELD); ddlField.DataValueField = "typeid"; ddlField.DataTextField = "description"; ddlField.DataSource = dt; ddlField.DataBind(); ddlField.Items.Insert(0, new ListItem("Select", "0")); dt = new DataTable(); dt = UserSecurityData.GetPageSecurityBySelection(SECURITY_ACTION); ddlAction.DataValueField = "typeid"; ddlAction.DataTextField = "description"; ddlAction.DataSource = dt; ddlAction.DataBind(); ddlAction.Items.Insert(0, new ListItem("Select", "NA")); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void btnTransactionSubmit_Click(object sender, EventArgs e) { try { if (ddlSecurityGroup.SelectedIndex <= 0) { lblErrorMsg.Text = "Please select security group."; ddlSecurityGroup.Focus(); return; } if (ddlUserName.SelectedIndex <= 0) { lblErrorMsg.Text = "Please select user name."; ddlUserName.Focus(); return; } UserSecurityData.AddUsersToSecurityGroup(Convert.ToInt32(ddlUserName.SelectedValue.ToString()), Convert.ToInt32(ddlSecurityGroup.SelectedValue.ToString())); lblErrorMsg.Text = "User Security was added successfully"; BindUserSecurityGroups(); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
private void BindUserSecurityGroups() { try { DataTable dt = new DataTable(); dt = UserSecurityData.GetData("GetUsersUserSecurityGroup"); gvUserSec.DataSource = dt; gvUserSec.DataBind(); } catch (Exception ex) { throw ex; } }
private void BindUserPageSecurity() { if (hfUserId.Value != null) { DataTable dt = new DataTable(); dt = UserSecurityData.GetuserPageSecurity(Convert.ToInt32(hfUserId.Value)); gvPageSecurity.DataSource = dt; gvPageSecurity.DataBind(); } else { gvPageSecurity.DataSource = null; gvPageSecurity.DataBind(); lblErrorMsg.Text = "Select User to view the user page security permissions"; } }
private void BindSecurityGroups() { try { DataTable dt = new DataTable(); dt = UserSecurityData.GetData("GetUserSecurityGroup"); ddlSecurityGroup.DataSource = dt; ddlSecurityGroup.DataValueField = "usergroupid"; ddlSecurityGroup.DataTextField = "userGroupName"; ddlSecurityGroup.DataBind(); ddlSecurityGroup.Items.Insert(0, new ListItem("Select", "NA")); } catch (Exception ex) { throw ex; } }
protected void BindVHCBUsers() { try { DataTable dt = new DataTable(); dt = UserSecurityData.GetData("GetVHCBUser"); ddlUserName.DataValueField = "userid"; ddlUserName.DataTextField = "name"; ddlUserName.DataSource = dt; ddlUserName.DataBind(); ddlUserName.Items.Insert(0, new ListItem("Select", "NA")); } catch (Exception ex) { throw ex; } }
protected void gvPageSecurity_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int rowIndex = e.RowIndex; Label lblpagesecurityid = (Label)gvPageSecurity.Rows[rowIndex].FindControl("lblpagesecurityid"); if (lblpagesecurityid != null) { UserSecurityData.DeletePageSecurity(Convert.ToInt32(lblpagesecurityid.Text)); lblErrorMsg.Text = "User Page Security was deleted successfully"; BindUserPageSecurity(); } } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void gvUserSec_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int rowIndex = e.RowIndex; Label lblUserId = (Label)gvUserSec.Rows[rowIndex].FindControl("lbluserid"); if (lblUserId != null) { UserSecurityData.DeleteUsersUserSecurityGroup(Convert.ToInt32(lblUserId.Text)); lblErrorMsg.Text = "User Security was deleted successfully"; BindUserSecurityGroups(); } } catch (Exception ex) { throw ex; } }
protected override void OnPreRender(EventArgs e) { int userid = GetUserId(); DataTable dt = UserSecurityData.GetMasterPageSecurity(userid); foreach (var link in this.Master.FindDescendants <LinkButton>()) { string linkId = link.ID; foreach (DataRow dRow in dt.Rows) { if (dRow["PageDescription"].ToString().ToLower() == linkId.ToLower()) { ((LinkButton)Master.FindControl(linkId)).Visible = false; } } } ((Panel)Master.FindControl("AccountUserInfo")).Visible = true; base.OnPreRender(e); }
protected void btnPageSecurity_Click(object sender, EventArgs e) { try { if (ddlPage.SelectedIndex <= 0) { lblErrorMsg.Text = "Please select page to add an action"; return; } if (ddlAction.SelectedIndex <= 0) { lblErrorMsg.Text = "Please select Action to the selected page"; return; } UserSecurityData.AddUserPageSecurity(Convert.ToInt32(hfUserId.Value), Convert.ToInt32(ddlPage.SelectedValue.ToString()), Convert.ToInt32(ddlField.SelectedValue.ToString()), Convert.ToInt32(ddlAction.SelectedValue.ToString())); BindUserPageSecurity(); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }