protected void RolesGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { RolesGridView.DataSource = GlobalLists.MemberRoles; RolesGridView.PageIndex = e.NewPageIndex; RolesGridView.DataBind(); GlobalUtils.SetAccessToControls(this.Page, SaltShakerSession.CurrentRole); }
//Display grid based on tab index private void showtabItem(int index) { try { object sender = new object(); EventArgs e = new EventArgs(); MultiView c = (MultiView)this.FindControl("MultiViewRelatedContent"); //check for valid parameters before hiding taking any others actions if (ValidateGridDisplayParameters(index)) { switch (index) { case 0: OrganizationsGridViewPanel.Visible = true; this.renderOrganizationsGridView(SaltShakerSession.selectedMemberID); break; case 1: RolesGridViewPanel.Visible = true; this.renderRolesGridView(SaltShakerSession.selectedMemberID); break; } } c.ActiveViewIndex = index; GlobalUtils.SetAccessToControls(this.Page, SaltShakerSession.CurrentRole); } catch (Exception ex) { logger.Error("Exception in uc_MemberDetail.showtabItem:" + ex.Message); ExceptionMessageException Oops = new ExceptionMessageException(ex.Message); ShowMessage(String.Format(GlobalMessages.sMSG_WARNING, Oops.Message)); } }
protected void CoursesGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { CoursesGridView.DataSource = OrganizationCourses; CoursesGridView.PageIndex = e.NewPageIndex; CoursesGridView.DataBind(); GlobalUtils.SetAccessToControls(this.Page, SaltShakerSession.CurrentRole); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //clear old values SaltShakerSession.selectedMemberID = string.Empty; SaltShakerSession.selectedUserEmail = string.Empty; this.Page.Title = "MemberDetail - SALTShaker"; GlobalUtils.SetAccessToControls(this.Page, SaltShakerSession.CurrentRole); InitMemberDataModelBySearchResultsQueryString(); logger.Info("User: "******" viewed member: " + SaltShakerSession.selectedMemberID + " , " + SaltShakerSession.selectedUserEmail); } }
static string descImagePath = "/Images/icon_asc.gif"; //images are backwards protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { selectedRefOrganizationID = Request["organizationID"]; SaltShakerSession.selectedRefOrganizationID = selectedRefOrganizationID; LoadOrganizationDetail(selectedRefOrganizationID); this.Page.Title = "OrganizationDetail - SALTShaker"; GlobalUtils.SetAccessToControls(this.Page, SaltShakerSession.CurrentRole); //showtabItem(0); } }
private void showtabItem(int index) { try { EventArgs e = new EventArgs(); MultiView c = (MultiView)FindControl("detailMultiView"); //check for valid parameters before hiding taking any others actions //if (ValidateGridDisplayParameters(index)) { switch (index) { case 0: ProductGridViewPanel.Visible = true; renderProductGridView(); break; case 1: CoursesViewPanel.Visible = true; renderCoursesGridView(); break; case 2: TodoContentGridViewPanel.Visible = true; renderTodoContentGridView(); break; } } c.ActiveViewIndex = index; GlobalUtils.SetAccessToControls(this.Page, SaltShakerSession.CurrentRole); } catch (Exception ex) { logger.Error("Exception in uc_OrganizationDetail.showtabItem:" + ex.Message); ExceptionMessageException Oops = new ExceptionMessageException(ex.Message); ShowMessage(String.Format(GlobalMessages.sMSG_WARNING, Oops.Message)); } }
private bool saveMemberRoleUpdates() { bool bSuccess = true; try { CheckBox cbxMemberRoleActive; TextBox txtbRefUserRoleID; List <vMemberRoleModel> memberRoles = new List <vMemberRoleModel>(); for (int i = 0; i < RolesGridView.Rows.Count; i++) { cbxMemberRoleActive = (CheckBox)RolesGridView.Rows[i].FindControl("IsMemberRoleActive"); txtbRefUserRoleID = (TextBox)RolesGridView.Rows[i].FindControl("RefMemberRoleID"); if (!string.IsNullOrEmpty(txtbRefUserRoleID.Text)) { var memberRoleMatch = GlobalLists.MemberRoles.Where(entity => entity.RefMemberRoleID == Int32.Parse(txtbRefUserRoleID.Text.Trim())).FirstOrDefault(); if (memberRoleMatch != null) { //check if the value changed and only add if it does if (memberRoleMatch.IsMemberRoleActive != cbxMemberRoleActive.Checked) { vMemberRoleModel memRole = new vMemberRoleModel(); memRole.RefMemberRoleID = Int32.Parse(txtbRefUserRoleID.Text.Trim()); memRole.IsMemberRoleActive = cbxMemberRoleActive.Checked; memberRoles.Add(memRole); } } //RefRole being activated for the the first time for this member, insert into MemberRole (associate with this member) else if (cbxMemberRoleActive.Checked) { vMemberRoleModel memRole = new vMemberRoleModel(); memRole.RefMemberRoleID = Int32.Parse(txtbRefUserRoleID.Text.Trim()); memRole.IsMemberRoleActive = cbxMemberRoleActive.Checked; memberRoles.Add(memRole); } } } if (memberRoles.Count > 0) { string saltShakerUserName = string.Format("AMSA\\{0}", SaltShakerSession.UserId); bSuccess = Members.UpdateMemberRoles(int.Parse(SaltShakerSession.selectedMemberID), memberRoles, saltShakerUserName); if (bSuccess) { //give it a second to update GlobalUtils.WaiTTime(); renderRolesGridView(SaltShakerSession.selectedMemberID); ClearAllDirtyFlags(); ShowMessage("MemberRoles " + GlobalMessages.sMSG_UPDATE_SUCCESS); } else { ShowMessage(string.Format(GlobalMessages.sMSG_WARNING, "MemberRoles update appears to have failed. Please contact support for assistance [MemberRoleSave]")); } } } catch (Exception saveEx) { ShowMessage(string.Format(GlobalMessages.sMSG_WARNING, "your MemberRoles update appears to have failed. Please contact support for assistance " + saveEx)); } return(bSuccess); }
private bool saveOrganizationProductSubscription() { bool bSuccess = false; bool atLeastOneGoal = false; try { MultiView c = (MultiView)FindControl("detailMultiView"); GridView activeGView; CheckBox cbxProdActive; TextBox txtbProdID; if (c.ActiveViewIndex == 0) { activeGView = ProductGridView; } else if (c.ActiveViewIndex == 1) { activeGView = CoursesGridView; } else { ShowMessage(string.Format(sMSG_WARNING, "your organization products update appears to have failed. Please contact support for assistance")); return(bSuccess); } productTable = new System.Data.DataTable(); productTable.Columns.Add("RefProductID", typeof(int)); productTable.Columns.Add("IsActive", typeof(bool)); productTable.TableName = "RefOrganizationProductTableType"; //here you can find your control and get value(Id). for (int i = 0; i < activeGView.Rows.Count; i++) { cbxProdActive = (CheckBox)activeGView.Rows[i].FindControl("IsRefOrganizationProductActive"); txtbProdID = (TextBox)activeGView.Rows[i].FindControl("RefProductID"); //While we are looping through the rows in the table, set a flag variable to true when we find at least one goal product with an opt-in Int32 productID = Int32.Parse(txtbProdID.Text.Trim()); if (!string.IsNullOrEmpty(txtbProdID.Text)) { var prodMatch = ListOfOrganizationProducts.Where(entity => entity.RefProductID == productID).FirstOrDefault(); if (prodMatch != null) { //check if the value changed and only add if it does if (prodMatch.IsRefOrganizationProductActive != cbxProdActive.Checked) { productTable.Rows.Add(int.Parse(txtbProdID.Text), cbxProdActive.Checked); } } //checked active box on a none existing (ACTIVE) product means add it to //table of ACTIVE products associated with this organization else if (cbxProdActive.Checked) { productTable.Rows.Add(int.Parse(txtbProdID.Text), cbxProdActive.Checked); } } } //verify that there's at least one goal product active atLeastOneGoal = hasActiveGoal(productTable); //No goal products were selected, show an error message as this in an invalid state, break out of this method, we don't want to save these changes if (!atLeastOneGoal) { ShowMessage("You must enable at least one goal product. These updates have not been saved to the DB."); return(false); } if (productTable.Rows.Count > 0) { bSuccess = organization.UpdateOrganizationProductSubscription(int.Parse(LabelOrgID.Text.ToString()), productTable, SaltShakerSession.UserId); if (bSuccess) { //give it a second to update //System.Diagnostics.Stopwatch stopwatch = System.Diagnostics.Stopwatch.StartNew(); GlobalUtils.WaiTTime(); LoadOrganizationDetail(SaltShakerSession.selectedRefOrganizationID); if (c.ActiveViewIndex == 0) { //Keep products tab active showtabItem(0); } else if (c.ActiveViewIndex == 1) { //keep courses tab active showtabItem(1); } ShowMessage(sMSG_UPDATE_SUCCESS); } else { ShowMessage(string.Format(sMSG_WARNING, "your organization products update appears to have failed. Please contact support for assistance")); } } } catch (Exception saveEx) { ShowMessage(string.Format(sMSG_WARNING, "your organization products update appears to have failed. Please contact support for assistance " + saveEx)); } return(bSuccess); }