private void SearchPartialEmailAndRenderGridView(string email = "") { using (MemberBL Members = new MemberBL()) { //Search by params GlobalLists.ListMemberResults = Members.GetMembersBySearchParms(null, "", "", email, "").ToList(); iRecordCount = GlobalLists.ListMemberResults.Count(); if (iRecordCount > 0) { MemberDataGridView.DataSource = GlobalLists.ListMemberResults; MemberDataGridView.DataBind(); if (iRecordCount == 1) { selectedMemberID = GlobalLists.ListMemberResults[0].MemberID > 0 ? GlobalLists.ListMemberResults[0].MemberID.ToString() : null; MemberDataGridView.SelectedIndex = 0; //select the only existing row GridViewRow selectedRow = MemberDataGridView.SelectedRow; selectedUserName = selectedRow.Cells[4].Text; RedirectToDetails(selectedMemberID, selectedUserName); } this.displayRowCount(); } else { ShowMessage(GlobalMessages.sMSG_NORECORDSFOUND); } } }
private void SearchAndRenderGridView(Nullable <Int32> id, string firstName = "", string lastName = "", string email = "", string communityDisplayname = "") { using (MemberBL Members = new MemberBL()) { //Search by params GlobalLists.ListSaltMemberModel = Members.GetMembersBySearchParms(firstName.Trim(), lastName.Trim(), communityDisplayname.Trim()).ToList(); iRecordCount = GlobalLists.ListSaltMemberModel.Count(); if (iRecordCount > 0) { MemberDataGridView.DataSource = GlobalLists.ListSaltMemberModel; MemberDataGridView.DataBind(); if (iRecordCount == 1) { selectedMemberID = GlobalLists.ListSaltMemberModel[0].MemberID != null ? GlobalLists.ListSaltMemberModel[0].MemberID.ToString() : null; MemberDataGridView.SelectedIndex = 0; //select the only existing row GridViewRow selectedRow = MemberDataGridView.SelectedRow; selectedUserName = selectedRow.Cells[4].Text; RedirectToDetails(selectedMemberID, selectedUserName); } } else { ShowMessage(GlobalMessages.sMSG_NORECORDSFOUND); } } }
/// <summary> /// Kicks off the Global init and calls helper function /// renderDataToTable which displasy info to Member Details screen. /// </summary> private void FetchSaltMemberDataAndDisplayToScreen() { try { //data is already in memory from search screen results //don't call service again. if (!FindCashedDataModelForMatchingMember(SaltShakerSession.selectedMemberID)) { GlobalLists.ListMemberResults = Members.GetMembersBySearchParms(Int32.Parse(SaltShakerSession.selectedMemberID.Trim()), "", "", "", "").ToList(); GlobalLists.ListActivityHistory = Members.GetMemberActivityHistory(Int32.Parse(SaltShakerSession.selectedMemberID.Trim())).ToList(); } //render data to screen with global objects if (GlobalLists.ListMemberResults.Count > 0 && GlobalLists.ListActivityHistory.Count > 0) { vMemberAcademicInfoModel MemberItem = GlobalLists.ListMemberResults[0]; MemberActivityHistoryModel memberActivityHistory = GlobalLists.ListActivityHistory.Last(); //Get the latest DeActivation Date Nullable <DateTime> recentDeActivationDate = null; if (GlobalLists.ListActivityHistory.Count > 0) { var deactivationRecord = GlobalLists.ListActivityHistory.AsEnumerable() .Where(ma => ma.RefActivityTypeName == "DeActivation"); if (deactivationRecord.Count() > 0) { recentDeActivationDate = deactivationRecord.OrderByDescending(a => a.ActivityDate).First().ActivityDate; } } //render grid this.renderDataToTable(MemberItem.MemberID.ToString(), MemberItem.FirstName, MemberItem.LastName, MemberItem.EmailAddress, MemberItem.IsContactAllowed, MemberItem.IsMemberActive, MemberItem.EnrollmentStatusDescription, MemberItem.GradeLevelDescription, MemberItem.MemberFirstActivationDate.ToShortDateString(), recentDeActivationDate.ToString(), memberActivityHistory.ModifiedBy, MemberItem.WelcomeEmailSent == true ? "Sent" : "Not Sent"); //COV-10540 use SM object allocated as global above instead of allocating a new object. if (SM.IsMemberActive(MemberItem.EmailAddress) == false) { CheckBoxActive.Text = "Deactivated"; CheckBoxActive.BackColor = Color.Red; CheckBoxActive.Checked = true; CheckBoxActive.Enabled = false; } } } catch (Exception ex) { logger.Error("Exception in uc_MemberDetail.FetchSaltMemberDataAndDisplayToScreen:" + ex.Message); ExceptionMessageException Oops = new ExceptionMessageException(ex.Message); ShowMessage(String.Format(GlobalMessages.sMSG_WARNING, ex.Message)); } }