/// <summary> /// To the domain object. /// </summary> /// <param name="lesson1">The lesson1.</param> /// <returns></returns> public static Lesson1 ToDomainObject(this Lesson1Contract lesson1) { var expenses = new List <Expense>(); var incomes = new List <Income>(); if (lesson1.Expenses != null) { expenses = lesson1.Expenses.Select(expense => expense.ToDomainObject()).ToList(); } if (lesson1.Incomes != null) { incomes = lesson1.Incomes.Select(income => income.ToDomainObject()).ToList(); } var membershipApi = new AsaMemberAdapter(); var activeDirectoryKey = membershipApi.GetActiveDirectoryKeyFromContext(); return(new Lesson1() { Expenses = expenses, Incomes = incomes, Goal = lesson1.Goal != null?lesson1.Goal.ToDomainObject() : new Goal(), User = lesson1.User.ToDomainObject(), IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey) ? new Guid(activeDirectoryKey) : Guid.Empty }); }
private static IMemberProfileData createNewMemberProfile(IMemberProfileData profile, Dictionary <String, Object> providerKeys) { AsaMemberAdapter adapter = new AsaMemberAdapter(); ASAMemberModel member = ConvertProfileToASAMember(profile, providerKeys); member = adapter.Create(member).Member; profile = ConvertASAMembertoProfile(member, providerKeys); return(profile); }
public void AssociateLessonWithRegisteredUser(string userLessonId) { int validatedUserLessonId; bool userLessonIdIsValid = Int32.TryParse(userLessonId, out validatedUserLessonId); if (userLessonIdIsValid) { var memberAdapter = new AsaMemberAdapter(); var userId = memberAdapter.GetMemberIdFromContext(); SaltServiceAgent.AssociateLessonsWithUser(Convert.ToInt32(validatedUserLessonId), userId); } }
public ResultCodeModel InsertSurvey(SurveyModel survey) { ResultCodeModel result; try { var memberAdapter = new AsaMemberAdapter(); //add system data //response status will be hardcoded in deployment scripts so it will be the same for all environments survey.ResponseDate = DateTime.Now; survey.ResponseStatus = "21B65800-5F9A-421F-9E82-DA13B111F790"; survey.MemberId = memberAdapter.GetMemberIdFromContext(); if (SurveyValidation.ValidateSurvey(survey)) { _log.Info("ASA.Web.Services.SurveyService.InsertSurvey() starting ..."); result = _surveyAdapter.InsertSurvey(survey); _log.Info("ASA.Web.Services.SurveyService.InsertSurvey() ending ..."); } else { result = new ResultCodeModel(); var error = new ErrorModel("Invalid information input for this survey", "Web Survey Service"); _log.Error("ASA.Web.Services.SurveyService.InsertSurvey(): Invalid information input for this survey"); result.ErrorList.Add(error); if (Config.Testing) { //get validation errors out of list and retrun them if (survey.ErrorList.Count > 0) { foreach (ErrorModel em in survey.ErrorList) { //if not empty copy message if (!string.IsNullOrEmpty(em.Code)) { result.ErrorList.Add(em); } } } } } } catch (Exception ex) { _log.Error("ASA.Web.Services.SurveyService.InsertSurvey(): Exception => " + ex.ToString()); throw new SurveyOperationException("Web Survey Service - Exception in ASA.Web.Services.SurveyService.InsertSurvey()", ex); } return(result); }
public SurveyListModel GetIndividualsResponse(string surveyId, string individualId, string surveyQuestionId) { var memberAdapter = new AsaMemberAdapter(); SurveyListModel sList = null; try { _log.Info("ASA.Web.Services.SurveyService.GetIndividualsResponse() starting ..."); int memberId = memberAdapter.GetMemberIdFromContext(); if (_surveyAdapter == null) { _log.Error("ASA.Web.Services.SurveyService.GetIndividualsResponse(): " + _surveyAdapterExceptionMessage); throw new SurveyBadDataException("Null adapter in ASA.Web.Services.SurveyService.GetIndividualsResponse()"); } if (string.IsNullOrEmpty(surveyId)) { _log.Info("Survey Id was not provided to access GetIndividualsResponse"); sList = new SurveyListModel(); var error = new ErrorModel("Survey Id was not provided to access GetIndividualsResponse", "Web Survey Service"); sList.ErrorList.Add(error); } else if (string.IsNullOrEmpty(individualId)) { _log.Info("Individual Id was not provided to access GetIndividualsResponse"); sList = new SurveyListModel(); var error = new ErrorModel("Individual Id was not provided to access GetIndividualsResponse", "Web Survey Service"); sList.ErrorList.Add(error); } else { //no errors then continue sList = _surveyAdapter.GetIndividualsResponse(Convert.ToInt32(surveyId), memberId); } } catch (Exception ex) { _log.Error("ASA.Web.Services.SurveyService.GetSurveyQuestions(): Exception => " + ex.ToString()); throw new SurveyOperationException("Web Survey Service - Exception in ASA.Web.Services.SurveyService.GetSurveyQuestion()", ex); } _log.Info("ASA.Web.Services.SurveyService.GetSurveyQuestion() ending ..."); if (sList.Surveys.Any()) { sList.Surveys[0].SurveyId = surveyId; sList.Surveys[0].SurveyQuestionId = surveyQuestionId; } return(sList); }
/// <summary> /// Converts to the domain object. /// </summary> /// <param name="paymentReminder">The payment reminder.</param> /// <returns></returns> public static ReminderModel ToDomainObject(this PaymentReminderContract paymentReminder) { var userAdapter = new AsaMemberAdapter(); return(new ReminderModel() { DayOfMonth = paymentReminder.DayOfMonth, ID = paymentReminder.PaymentReminderId.ToString(CultureInfo.InvariantCulture), IsActive = true, MemberId = userAdapter.GetMemberIdFromContext(), IndividualId = userAdapter.GetActiveDirectoryKeyFromContext(), NumberOfLoans = paymentReminder.NumberOfLoans.HasValue?paymentReminder.NumberOfLoans.Value:0, ServicerName = paymentReminder.ServicerName }); }
private int GetMemberId() { if (HttpContext.Current.Items.Contains("MembershipId")) { return(Convert.ToInt32(HttpContext.Current.Items["MembershipId"])); } else { var adapter = new AsaMemberAdapter(); HttpContext.Current.Items.Add("MembershipId", adapter.GetMemberIdFromContext()); } return(Convert.ToInt32(HttpContext.Current.Items["MembershipId"])); }
/// <summary> /// To the member lesson contract. /// </summary> /// <param name="user">The user.</param> /// <param name="lessonId">The lesson id.</param> /// <returns></returns> public static MemberLessonContract ToDataContract(this User user, int lessonId) { var toReturn = new MemberLessonContract(); var memberAdapter = new AsaMemberAdapter(); toReturn.LessonUserId = user.UserId; toReturn.MemberId = memberAdapter.GetMemberIdFromContext(); toReturn.LessonId = lessonId; toReturn.CurrentStep = lessonId == LessonTypes.HowDoesYourCashFlow ? user.Lesson1Step : lessonId == LessonTypes.MasterYourPlastic ? user.Lesson2Step : lessonId == LessonTypes.OwnYourStudentLoans ? user.Lesson3Step : 0; return(toReturn); }
/// <summary> /// To the domain model. /// </summary> /// <param name="surveyDataContract">The survey data contract.</param> /// <returns></returns> public static SurveyModel ToDomainModel(this SurveyContract surveyDataContract) { var memberAdapter = new AsaMemberAdapter(); return(surveyDataContract == null ? null : new SurveyModel() { ListOfAnswerOptions = surveyDataContract.ListOfValues, QuestionText = surveyDataContract.SurveyQuestion, SurveyId = surveyDataContract.SurveyId.ToString(CultureInfo.InvariantCulture), IndividualId = memberAdapter.GetActiveDirectoryKeyFromContext(), MemberId = memberAdapter.GetMemberIdFromContext(), SurveyQuestionId = surveyDataContract.SurveyId.ToString(CultureInfo.InvariantCulture) }); }
public SelfReportedLoanListModel GetLoans(string ssn) { _log.Debug(string.Format("START ASA.Web.Services.LoanService.GetLoan(): ssn={0}", !string.IsNullOrEmpty(ssn)?ssn:"null")); HttpHeadersHelper.SetNoCacheResponseHeaders(WebOperationContext.Current); SelfReportedLoanListModel loans = null; IAsaMemberAdapter memberAdapter = null; memberAdapter = new AsaMemberAdapter(); if (LoanValidation.ValidateInputSsn(ssn)) { _log.Debug("calling GetActiveDirectoryKeyFromContext now."); int? id = memberAdapter.GetMemberIdFromContext(); ASAMemberModel member = memberAdapter.GetMember(id.Value); if (_loanAdapter == null) { _log.Error(_loanAdapterExceptionMessage); loans = new SelfReportedLoanListModel(); ErrorModel error = new ErrorModel(_loanAdapterExceptionMessage, "Web Loan Service"); _log.Error("ASA.Web.Services.LoanService.GetLoan(): " + _loanAdapterExceptionMessage); loans.ErrorList.Add(error); } else if (member != null)// we should never try to retrieve loans for someone who isn't found as the logged-in member from context. { loans = _loanAdapter.GetLoans(ssn, member); } if (loans == null) { _log.Debug("No loans were retrieved for this SSN: " + ssn); loans = new SelfReportedLoanListModel(); loans.ErrorList.Add(new ErrorModel("No Loans were retrieved for this SSN.")); } } else { loans = new SelfReportedLoanListModel(); ErrorModel error = new ErrorModel("Invalid search criteria", "Web Loan Service"); _log.Warn("ASA.Web.Services.LoanService.GetLoan(): Invalid search criteria"); loans.ErrorList.Add(error); } _log.Debug(string.Format("END ASA.Web.Services.LoanService.GetLoan(): ssn={0}", !string.IsNullOrEmpty(ssn) ? ssn : "null")); return(loans); }
/// <summary> /// To the domain object. /// </summary> /// <param name="lesson2">The lesson2.</param> /// <returns></returns> public static Lesson2 ToDomainObject(this Lesson2Contract lesson2) { var membershipApi = new AsaMemberAdapter(); var activeDirectoryKey = membershipApi.GetActiveDirectoryKeyFromContext(); var lesson = new Lesson2() { CurrentBalance = lesson2.CurrentBalance.ToDomainObject(), DebtReductionOptions = lesson2.DebtReductionOptions.ToDomainObject(), IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey) ? new Guid(activeDirectoryKey) : Guid.Empty, ImportedExpenses = lesson2.ImportedExpenses.ToDomainObject(), OneTimeExpenses = lesson2.OneTimeExpenses.ToOneTimeExpenseDomainObject(), RecurringExpenses = lesson2.RecurringExpenses.ToRecurringExpenseDomainObject(), User = lesson2.User.ToDomainObject() }; return(lesson); }
private ASAMemberModel UpdateProfileModel(ASAMemberModel model) { String logMethodName = ".UpdateProfileModel(ASAMemberModel model) - "; _log.Debug(logMethodName + "Begin Method"); AsaMemberAdapter adapter = new AsaMemberAdapter(); try { adapter.Update(model); } catch (Exception ex) { throw new DataProviderException("Unable to update member profile", ex); } _log.Debug(logMethodName + "End Method"); return(model); }
public AlertListModel GetAlerts() { const string logMethodName = ".GetUserAlerts() - "; _log.Debug(logMethodName + "Begin Method"); AlertListModel aList = null; try { var adapter = new AsaMemberAdapter(); if (adapter.GetMemberIdFromContext() > 0) { if (_alertAdapter == null) { _log.Error(logMethodName + "ASA.Web.Services.AlertService.GetUserAlerts(): " + AlertAdapterExceptionMessage); throw new AlertBadDataException("Null adapter in ASA.Web.Services.AlertService.GetUserAlerts()"); } else { aList = _alertAdapter.GetAlerts(adapter.GetMemberIdFromContext()); } } else { _log.Warn(logMethodName + "A user who is anonymous is trying to access GetUserAlerts"); aList = new AlertListModel(); var error = new ErrorModel("A user who is anonymous is trying to access GetUserAlerts", "Web Alert Service"); aList.ErrorList.Add(error); } } catch (Exception ex) { //Alerts is non-critical functionality so if there is some kind of problem getting alerts we simply log it and move on my returning a null set. _log.Error(logMethodName + "ASA.Web.Services.AlertService.GetUserAlerts(): Exception => " + ex.ToString()); //throw new AlertOperationException("Web Alert Service - Exception in ASA.Web.Services.AlertService.GetUserAlerts()", ex); } _log.Debug(logMethodName + "End Method"); return(aList ?? (aList = new AlertListModel())); }
public override IMemberProfileData UpdateMemberProfile(IMemberProfileData profile, Dictionary <String, Object> providerKeys = null) { String logMethodName = ".UpdateMemberProfile(IMemberProfileData profile, Dictionary<String, Object> providerKeys = null) - "; _log.Debug(logMethodName + "Begin Method"); ASAMemberModel model = ConvertProfileToASAMember(profile, providerKeys); model.ActiveDirectoryKey = profile.Id.ToString(); UpdateProfileModel(model); ClearCachedModel(profile.MemberId); AsaMemberAdapter adapter = new AsaMemberAdapter(); profile = ConvertASAMembertoProfile(adapter.GetMemberByEmail(profile.EmailAddress)); _log.Debug(logMethodName + "End Method"); return(profile); }
/// <summary> /// To the user. /// </summary> /// <param name="userLessonContracts">The user lesson contracts.</param> /// <returns></returns> public static User ToDomainObject(this MemberLessonContract[] userLessonContracts) { var toReturn = new User(); var memberAdapter = new AsaMemberAdapter(); var activeDirectoryKey = memberAdapter.GetActiveDirectoryKeyFromContext(); var lesson1 = userLessonContracts.FirstOrDefault(l => l.LessonId == 1); var lesson2 = userLessonContracts.FirstOrDefault(l => l.LessonId == 2); var lesson3 = userLessonContracts.FirstOrDefault(l => l.LessonId == 3); toReturn.IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey) ? new Guid(memberAdapter.GetActiveDirectoryKeyFromContext()) : Guid.Empty; toReturn.Lesson1Step = lesson1 != null && lesson1.CurrentStep.HasValue ? lesson1.CurrentStep.Value : 0; toReturn.Lesson2Step = lesson2 != null && lesson2.CurrentStep.HasValue ? lesson2.CurrentStep.Value : 0; toReturn.Lesson3Step = lesson3 != null && lesson3.CurrentStep.HasValue ? lesson3.CurrentStep.Value : 0; toReturn.MemberId = memberAdapter.GetMemberIdFromContext(); toReturn.UserId = userLessonContracts.Any() ? userLessonContracts.First().LessonUserId : 0; return(toReturn); }
/// <summary> /// To the domain object. /// </summary> /// <param name="lesson3">The lesson3.</param> /// <returns></returns> public static Lesson3 ToDomainObject(this Lesson3Contract lesson3) { var membershipApi = new AsaMemberAdapter(); var activeDirectoryKey = membershipApi.GetActiveDirectoryKeyFromContext(); var lesson = new Lesson3() { FavoriteRepaymentPlans = lesson3.FavoriteRepaymentPlans.ToDomainObject(), IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey) ? new Guid(activeDirectoryKey) : Guid.Empty, LoanTypes = lesson3.LoanTypes.ToDomainObject(), DefermentOptions = lesson3.DefermentOptions.ToDomainListObject(), FasterRepaymentOptions = lesson3.FasterRepaymentOptions.ToDomainListObject(), LowerPaymentOptions = lesson3.LowerPaymentOptions.ToDomainListObject(), UserId = lesson3.User.MemberLessonId, User = lesson3.User.ToDomainObject() }; return(lesson); }
/// <summary> /// Saves the reminders. /// </summary> /// <param name="rList">The r list.</param> /// <returns></returns> /// <exception cref="ReminderOperationException">Web Reminder Service - ASA.Web.Services.ReminderService.ReminderAdapter.SaveReminders()</exception> public ResultCodeModel SaveReminders(ReminderListModel rList) { var toReturn = new ResultCodeModel(1); try { var memberAdapter = new AsaMemberAdapter(); int memberId = memberAdapter.GetMemberIdFromContext(); foreach (var r in rList.Reminders) { r.MemberId = memberId; } rList.Reminders = rList.Reminders.Where(r => r.IsActive).ToList(); var result = SaltServiceAgent.SaveUserPaymentReminders(memberId, rList.ToDataContract()); switch (result) { case RemindersUpdateStatus.Failure: toReturn.ResultCode = 0; break; case RemindersUpdateStatus.Success: toReturn.ResultCode = 1; break; case RemindersUpdateStatus.PartialSuccess: toReturn.ResultCode = 2; break; } } catch (Exception ex) { _log.Error("ASA.Web.Services.ReminderService.ReminderAdapter.SaveReminders(): Exception =>" + ex.ToString()); throw new ReminderOperationException("Web Reminder Service - ASA.Web.Services.ReminderService.ReminderAdapter.SaveReminders()", ex); } return(toReturn); }
private bool IsAlertForPersonLoggedIn(string alertId) { bool alertBelongsToPersonLoggedIn = false; //get Id of the member currently logged-in int memberId = new AsaMemberAdapter().GetMemberIdFromContext(); //get list of current Alerts's for the member logged-in if (memberId > 0) { AlertListModel alertList = GetAlerts(memberId); foreach (AlertModel a in alertList.Alerts) { if (a.ID == alertId) { alertBelongsToPersonLoggedIn = true; } } } return(alertBelongsToPersonLoggedIn); }
/// <summary> /// Gets the question and response. /// </summary> /// <param name="surveyId">The survey id.</param> /// <returns></returns> /// <exception cref="SurveyOperationException">Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetQuestionAndResponse()</exception> public SurveyListModel GetQuestionAndResponse(int surveyId) { const string logMethodName = ".GetQuestionAndResponse(string surveyId) - "; Log.Debug(logMethodName + "Begin Method"); var sList = new SurveyListModel(); var memberAdapter = new AsaMemberAdapter(); try { var survey = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetSurveyById(surveyId).ToDomainModel(); if (survey != null) { var response = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserSurveyResults(surveyId, memberAdapter.GetMemberIdFromContext()).ToDomainModel(); sList.Surveys = new List <SurveyModel>(); if (response.Surveys.Any()) { survey.Response = response.Surveys.First().Response; survey.ResponseCount = 1; } sList.Surveys = new List <SurveyModel>() { survey }; } } catch (Exception ex) { Log.Error("ASA.Web.Services.SurveyService.SurveyAdapter.GetQuestionAndResponse(): Exception =>" + ex.ToString()); throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetQuestionAndResponse()", ex); } Log.Debug(logMethodName + "End Method"); return(sList); }
/// <summary> /// Gets the response and totals. /// </summary>memberAdapter /// <param name="surveyId">The survey id.</param> /// <returns></returns> /// <exception cref="SurveyOperationException">Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetResponseAndTotals()</exception> public SurveyListModel GetResponseAndTotals(int surveyId) { const string logMethodName = ".GetResponseAndTotals(string surveyId) - "; Log.Debug(logMethodName + "Begin Method"); var sList = new SurveyListModel(); try { var memberAdapter = new AsaMemberAdapter(); var survey = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetSurveyById(surveyId); if (survey != null) { foreach (var option in survey.SurveyOptions) { sList.Surveys.Add(new SurveyModel() { IndividualId = memberAdapter.GetActiveDirectoryKeyFromContext(), MemberId = memberAdapter.GetMemberIdFromContext(), SurveyId = survey.SurveyId.ToString(CultureInfo.InvariantCulture), SurveyQuestionId = survey.SurveyId.ToString(CultureInfo.InvariantCulture), Response = option.OptionValue, ResponseCount = option.TotalResponseCount, QuestionText = survey.SurveyQuestion, }); } } } catch (Exception ex) { Log.Error("ASA.Web.Services.SurveyService.SurveyAdapter.GetSurveyQuestion(): Exception =>" + ex.ToString()); throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetResponseAndTotals()", ex); } Log.Debug(logMethodName + "End Method"); return(sList); }
public bool PublicVlcEndpoint(VLCQuestionResponseModel response) { try { if (VLCQuestionResponseValidation.validateQuestionResponseModel(response)) { var _memberAdapter = new AsaMemberAdapter(); var memberId = _memberAdapter.GetMemberIdFromContext(); response.MemberID = memberId; response.ResponseDate = System.DateTime.Now; return(_surveyAdapter.AddVlcResponse(response)); } else { return(false); } } catch (Exception ex) { _log.Error("ASA.Web.Services.SurveyService.AddVlcResponse(): Exception => " + ex.ToString()); throw new SurveyOperationException("Web Survey Service - Exception in ASA.Web.Services.SurveyService.AddVlcResponse()", ex); } }
/// <summary> /// Gets the individuals response. /// </summary> /// <param name="surveyId">The survey id.</param> /// <param name="memberId">The member id.</param> /// <returns></returns> /// <exception cref="SurveyOperationException">Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetQuestionAndResponse()</exception> public SurveyListModel GetIndividualsResponse(int surveyId, int memberId) { const string logMethodName = ".GetIndividualsResponse(string surveyId, string surveyQuestionId, string individualId) - "; Log.Debug(logMethodName + "Begin Method"); SurveyListModel sList; try { var memberAdapter = new AsaMemberAdapter(); sList = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserSurveyResults(surveyId, memberAdapter.GetMemberIdFromContext()).ToDomainModel(); } catch (Exception ex) { Log.Error("ASA.Web.Services.SurveyService.SurveyAdapter.GetQuestionAndResponse(): Exception =>" + ex.ToString()); throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetQuestionAndResponse()", ex); } Log.Debug(logMethodName + "End Method"); return(sList); }
/// <summary> /// To the user. /// </summary> /// <param name="userLessonContract">The user lesson contract.</param> /// <returns></returns> public static User ToDomainObject(this MemberLessonContract userLessonContract) { var toReturn = new User(); var memberAdapter = new AsaMemberAdapter(); var activeDirectoryKey = memberAdapter.GetActiveDirectoryKeyFromContext(); toReturn.IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey) ? new Guid(activeDirectoryKey) : Guid.Empty; toReturn.MemberId = memberAdapter.GetMemberIdFromContext(); if (null == userLessonContract) { return(toReturn); } toReturn.UserId = userLessonContract.LessonUserId; toReturn.Lesson1Step = userLessonContract.LessonId == 1 && userLessonContract.CurrentStep.HasValue? userLessonContract.CurrentStep.Value : 0; toReturn.Lesson2Step = userLessonContract.LessonId == 2 && userLessonContract.CurrentStep.HasValue ? userLessonContract.CurrentStep.Value : 0; toReturn.Lesson3Step = userLessonContract.LessonId == 3 && userLessonContract.CurrentStep.HasValue ? userLessonContract.CurrentStep.Value : 0; return(toReturn); }
public ReminderListModel GetReminders() { ReminderListModel rList = null; var memberAdapter = new AsaMemberAdapter(); try { _log.Info("ASA.Web.Services.ReminderService.GetReminders() starting ..."); int memberId = memberAdapter.GetMemberIdFromContext(); if (_reminderAdapter == null) { _log.Error("ASA.Web.Services.ReminderService.GetReminders(): " + _reminderAdapterExceptionMessage); throw new ReminderBadDataException("Null adapter in ASA.Web.Services.ReminderService.GetReminders()"); } else if (memberId <= 0) { _log.Info("A user who is anonymous is trying to access GetReminders"); rList = new ReminderListModel(); ErrorModel error = new ErrorModel("A user who is anonymous is trying to access GetReminders", "Web Reminder Service"); rList.ErrorList.Add(error); } else { rList = _reminderAdapter.GetReminders(memberId); } } catch (Exception ex) { _log.Error("ASA.Web.Services.ReminderService.GetReminders(): Exception => " + ex.ToString()); throw new ReminderOperationException("Web Reminder Service - Exception in ASA.Web.Services.ReminderService.GetReminders()", ex); } _log.Info("ASA.Web.Services.ReminderService.GetReminders() ending ..."); return(rList); }
private ASAMemberModel RetrieveASAMemberModel(Object memberId, Dictionary <String, Object> providerKeys = null) { ASAMemberModel model = null; Object membershipId = null; //Minor hack on top of the email hack to ensure the correct ID's are being used for storage of objects into other stores //BIG TODO : Cleaner implmentation of get user that allows both email and ID to work without conflicting calls and types //will likely require some kind of credential key object. String memberIdKey = "ASAMemberId[" + memberId.ToString() + "]"; if (memberId.ToString().IndexOf('@') == -1) { membershipId = memberId; } else { if (HttpContext.Current.Items[memberIdKey] != null) { membershipId = HttpContext.Current.Items[memberIdKey]; } } String logMethodName = ".RetrieveASAMemberModel(Object memberId, Dictionary<String, Object> providerKeys = null) - "; _log.Debug(logMethodName + "Begin Method"); _log.Debug(logMethodName + "Getting ASAMemberModel for memberId : " + memberId); String modelKey = "ASAMemberModel[" + membershipId + "]"; String modelLoadedKey = "ASAMemberModelLoaded[" + membershipId + "]"; Boolean modelLoaded = false; if (membershipId != null && HttpContext.Current.Items[modelLoadedKey] != null) { Boolean.TryParse(HttpContext.Current.Items[modelLoadedKey].ToString(), out modelLoaded); } if (modelLoaded) { _log.Debug(logMethodName + "Trying to load from Request persistence."); model = HttpContext.Current.Items[modelKey] as ASAMemberModel; _log.Debug(logMethodName + "ASAMemberModel Loaded from Request persistence"); } else { _log.Debug(logMethodName + "ASAMemberModel NOT FOUND in Request persistence. Querying Avectra."); AsaMemberAdapter adapter = new AsaMemberAdapter(); //TODO - JHL: Added for demo only if (memberId.ToString().IndexOf('@') == -1) { Guid systemId; if (Guid.TryParse(memberId.ToString(), out systemId) && systemId != Guid.Empty) { _log.Debug(logMethodName + "Calling AsaMemberAdapter.GetMember(Guid systemId) - memberId = '" + systemId.ToString() + "'"); model = adapter.GetMember(systemId); if (model != null) { if (!HttpContext.Current.Items.Contains("MembershipId")) { HttpContext.Current.Items.Add("MembershipId", model.MembershipId); } } _log.Debug(logMethodName + "Call to AsaMemberAdapter.GetMember(Guid systemId) COMPLETED - memberId = '" + systemId.ToString() + "'"); } else if (providerKeys != null) { if (providerKeys["IndividualId"] != null) { _log.Debug(logMethodName + "Calling AsaMemberAdapter.GetMember(Guid systemId) - individualId = '" + systemId.ToString() + "'"); model = adapter.GetMember(new Guid((string)providerKeys["IndividualId"])); _log.Debug(logMethodName + "Call to AsaMemberAdapter.GetMember(Guid systemId) COMPLETED - individualId = '" + systemId.ToString() + "'"); } else if (providerKeys["ActiveDirectoryKey"] != null && Guid.TryParse(providerKeys["ActiveDirectoryKey"].ToString(), out systemId) && systemId != Guid.Empty) { _log.Debug(logMethodName + "Calling AsaMemberAdapter.GetMember(Guid systemId) - memberId from ProviderKeys = '" + systemId.ToString() + "'"); model = adapter.GetMember(systemId); _log.Debug(logMethodName + "Call to AsaMemberAdapter.GetMember(Guid systemId) COMPLETED - memberId from ProviderKeys= '" + systemId.ToString() + "'"); } } } else { _log.Debug(logMethodName + "Calling AsaMemberAdapter.GetMemberByEmail(String email) - email = '" + memberId.ToString() + "'"); model = adapter.GetMemberByEmail(memberId.ToString()); _log.Debug(logMethodName + "Call to AsaMemberAdapter.GetMemberByEmail(String email) COMPLETED - email = '" + memberId.ToString() + "'"); } //cov-10328 - check for nulls if (model != null) { membershipId = model.ActiveDirectoryKey; memberIdKey = "ASAMemberId[" + model.Emails.FirstOrDefault(m => m.IsPrimary == true).EmailAddress + "]"; modelKey = "ASAMemberModel[" + membershipId.ToString() + "]"; modelLoadedKey = "ASAMemberModelLoaded[" + membershipId.ToString() + "]"; HttpContext.Current.Items[memberIdKey] = memberId; HttpContext.Current.Items[modelKey] = model; HttpContext.Current.Items[modelLoadedKey] = true; _log.Debug(logMethodName + "ASAMemberModel Loaded into Request persistence"); } else { //allocate empty model model = new ASAMemberModel(); _log.Warn(logMethodName + "ASAMemberModel NOT Loaded into Request persistence"); } } _log.Debug(logMethodName + "End Method"); return(model); }