public LowerPayment PostLowerPaymentOptions(LowerPayment lowerPayment) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue) { return(lowerPayment); } lock (_lockObject) { SaltServiceAgent.PostLesson3(new Lesson3() { LowerPaymentOptions = new List <LowerPayment>() { lowerPayment }, User = new User() { UserId = lessonUserId.Value } }.ToDataContract()); } return(lowerPayment); }
public FasterRepayment PostFasterRepaymentOptions(FasterRepayment fasterRepayment) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue) { return(fasterRepayment); } lock (_lockObject) { SaltServiceAgent.PostLesson3(new Lesson3() { FasterRepaymentOptions = new List <FasterRepayment>() { fasterRepayment }, User = new User() { UserId = lessonUserId.Value } }.ToDataContract()); } return(fasterRepayment); }
public Deferment PostLoanDefermentOptions(Deferment deferment) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue) { return(deferment); } lock (_lockObject) { SaltServiceAgent.PostLesson3(new Lesson3() { DefermentOptions = new List <Deferment>() { deferment }, User = new User() { UserId = lessonUserId.Value } }.ToDataContract()); } return(deferment); }
public bool DeleteLoanType(string loanTypeId, LoanType loanType) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue) { return(false); } lock (_lockObject) { var loanTypes = SaltServiceAgent.GetUserLesson3Results(lessonUserId.Value, LessonSteps.Lesson3.YourBalance).ToDomainObject().LoanTypes.ToList(); loanTypes.Remove(loanTypes.First(l => l.Equals(loanType))); var result = SaltServiceAgent.PostLesson3( new Lesson3() { LoanTypes = new List <LoanType>(loanTypes), User = new User() { UserId = lessonUserId.Value } }.ToDataContract()).ToDomainObject(); } return(true); }
public SelfReportedLoanListModel SaveSelfReportedLoansWithFileName(string sourceName, Stream file) { var reader = new StreamReader(file); var fileBytes = Encoding.ASCII.GetBytes(reader.ReadToEnd()); var userId = _memberAdapter.GetMemberIdFromContext(); List <MemberReportedLoanContract> loanList; SelfReportedLoanListModel errorObj = new SelfReportedLoanListModel(); try { loanList = SaltServiceAgent.ImportLoanFile(userId, fileBytes, sourceName); if (loanList.Count == 0) { //return an error message so user knows that loans were not imported errorObj.ErrorList.Add(new ErrorModel("No loans returned")); return(errorObj); } else { return(loanList.FromMemberReportedLoanContractList()); } } catch (Exception ex) { //return error with message from SALT Service errorObj.Loans = new List <SelfReportedLoanModel>(); errorObj.ErrorList.Add(new ErrorModel(ex.Message)); return(errorObj); } }
public Favorite PostFavoritePaymentPlan(Favorite favorite) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue) { return(null); } lock (_lockObject) { var result = SaltServiceAgent.PostLesson3( new Lesson3() { FavoriteRepaymentPlans = new List <Favorite>(SaltServiceAgent.GetUserLesson3Results(lessonUserId.Value, LessonSteps.Lesson3.ReviewYourFavorites).ToDomainObject().FavoriteRepaymentPlans) { favorite }, User = new User() { UserId = lessonUserId.Value } }.ToDataContract()).ToDomainObject(); return(favorite); } }
public LoanType PostLoanType(LoanType loanType) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue) { return(null); } lock (_lockObject) { var result = SaltServiceAgent.PostLesson3( //add new loanType object to list of LoanType and update lesson new Lesson3() { LoanTypes = new List <LoanType>() { loanType }, User = new User() { UserId = lessonUserId.Value } }.ToDataContract() ).ToDomainObject(); } return(loanType); }
public RecurringExpense PostRecurringExpense(RecurringExpense recurringExpense) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue || recurringExpense.Value <= 0) { return(null); } lock (_lockObject) { var result = SaltServiceAgent.PostLesson2( new Lesson2() { RecurringExpenses = new List <RecurringExpense>(SaltServiceAgent.GetUserLesson2Results(lessonUserId.Value, LessonSteps.Lesson2.RecurringExpenses) .ToDomainObject() .RecurringExpenses) { recurringExpense }, User = new User() { UserId = lessonUserId.Value } }.ToDataContract()).ToDomainObject(); return(result.RecurringExpenses.First(re => re.Equals(recurringExpense))); } }
public OneTimeExpense PostOneTimeExpense(OneTimeExpense oneTimeExpense) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue || oneTimeExpense.Value <= 0) { return(null); } lock (_lockObject) { var result = SaltServiceAgent.PostLesson2( new Lesson2() { OneTimeExpenses = new List <OneTimeExpense>(SaltServiceAgent.GetUserLesson2Results(lessonUserId.Value, LessonSteps.Lesson2.OneTimePurchases) .ToDomainObject() .OneTimeExpenses) { oneTimeExpense }, User = new User() { UserId = lessonUserId.Value } }.ToDataContract()).ToDomainObject(); return(result.OneTimeExpenses.First(oe => oe.Equals(oneTimeExpense))); } }
/// <summary> /// Delete the specified member from SALT db and ActiveDirectory. /// </summary> /// <param name="member">The member.</param> /// <returns>bool</returns> /// <exception cref="System.Exception">There was an error deleteing Member record</exception> public bool DeleteMember(ASAMemberModel member) { const string logMethodName = ".DeleteMember(ASAMemberModel member) - "; Log.Debug(logMethodName + "Begin Method"); bool result = false; //delete SALT db information. result = SaltServiceAgent.DeleteUser(Convert.ToInt32(member.MembershipId)); if (0 == false.CompareTo(result)) { Log.Error(logMethodName + "Error deleting member from SALT DB"); //when debugging, for some reason it step into the if and highlights this line, but it does not throw the error. //if you comment out the the construction of the error then the debugger will not step in here. throw new WebFaultException <string>("Failed to delete member", System.Net.HttpStatusCode.BadRequest); } //delete Active Directory Account. try { result = IntegrationLoader.LoadDependency <ISecurityAdapter>("securityAdapter").DeleteMember(member.Emails[0].EmailAddress); } catch (Exception ex) { Log.Error(logMethodName + "Error deleting member from AD", ex); throw new WebFaultException <string>("Failed to delete member", System.Net.HttpStatusCode.BadRequest); } Log.Debug(logMethodName + "End Method"); return(result); }
public bool DeleteRecurringExpense(string expenseId, RecurringExpense recurringExpense) { var lessonUserId = GetUserLessonId(); if (!lessonUserId.HasValue) { return(false); } lock (_lockObject) { var recurringExpenses = SaltServiceAgent.GetUserLesson2Results(lessonUserId.Value, LessonSteps.Lesson2.RecurringExpenses).ToDomainObject().RecurringExpenses.ToList(); recurringExpenses.Remove(recurringExpenses.First(e => e.Equals(recurringExpense))); SaltServiceAgent.PostLesson2( new Lesson2() { RecurringExpenses = new List <RecurringExpense>(recurringExpenses), User = new User() { UserId = lessonUserId.Value } }.ToDataContract()).ToDomainObject(); } return(true); }
public User CreateUser(User user, string lessonId) { User lessonUser = new User(); int validatedLessonId; bool lessonIdIsValid = Int32.TryParse(lessonId, out validatedLessonId); if (user.IsValid()) { if (lessonIdIsValid) { lock (_lockObject) { lessonUser = SaltServiceAgent.StartUserLesson(user.ToDataContract(validatedLessonId)).ToDomainObject(); return(lessonUser); } } else { user.AddError("Invalid lessonId"); } } //return invalidated incoming user agumented with errormodel return(user); }
public Common.ResultCodeModel DeleteAlert(string alertId) { var logMethodName = ".DeleteAlert(string alertId) - "; _log.Debug(logMethodName + "Begin Method"); var result = new Common.ResultCodeModel(0); if (IsAlertForPersonLoggedIn(alertId)) { try { SaltServiceAgent.DeleteAlert(Convert.ToInt32(alertId)); result.ResultCode = 1; } catch (Exception ex) { _log.Error(logMethodName + "ASA.Web.Services.AlertService.AlertAdapter.DeleteAlert(): Exception =>" + ex.ToString()); throw new AlertOperationException("Web Alert Service - ASA.Web.Services.AlertService.AlertAdapter.DeleteAlert()", ex); } } else { _log.Warn(logMethodName + "ASA.Web.Services.AlertService.AlertAdapter.DeleteAlert(): Someone is trying to delete alerts that don't belong to them!"); result.ErrorList.Add(new ErrorModel("Alert could not be deleted")); } _log.Debug(logMethodName + "End Method"); return(result); }
/// <summary> /// Deactivates the user. /// </summary> /// <param name="userId">The user id.</param> /// <returns></returns> public bool DeactivateUser(string email, string modifierUserName = null) { int userId = SaltServiceAgent.GetUserByUsername(email).MemberId; SaltServiceAgent.DeactivateUser(userId, modifierUserName); return(true); }
/// <summary> /// Creates the specified member. /// </summary> /// <param name="member">The member.</param> /// <returns></returns> public RegistrationResultModel Create(ASAMemberModel member) { const string logMethodName = ".Create(ASAMemberModel member) - "; Log.Debug(logMethodName + "Begin Method"); RegistrationResultModel toReturn = null; try { var email = member.Emails.First().EmailAddress; var updateResult = SaltServiceAgent.RegisterUser(member.ToUserRegistrationDataContract()); toReturn = new RegistrationResultModel() { Member = updateResult.Member.ToDomainObject(), CreateStatus = (MemberUpdateStatus)updateResult.CreateStatus }; //the site membership code will delete the account in active directory //if an exception is raised. if (toReturn.CreateStatus == MemberUpdateStatus.InvalidOrganization) { throw new Exception("The organization entered was invalid"); } else if (toReturn.CreateStatus == MemberUpdateStatus.IncompleteProfile) { throw new Exception("The user profile is incomplete"); } else if (toReturn.CreateStatus == MemberUpdateStatus.Failure) { throw new Exception("An exception has occured creating the user"); } else if (toReturn.CreateStatus == MemberUpdateStatus.Duplicate) { throw new Exception("The user already exists in the system."); } } catch (Exception x) { Log.Error(string.Format(logMethodName + "Error inserting new Individual record for member: MemberAccountId={0}, Email={1}, StackTrace={2}" , member.MembershipId != null ? member.MembershipId.ToString() : "null" , member.Emails != null && member.Emails.Count > 0 && !string.IsNullOrEmpty(member.Emails[0].EmailAddress) ? member.Emails[0].EmailAddress : "null" , x)); throw x; } //Call async Qualtric's Target Audience API if (Common.Config.QTA_Process.ToLower() == "on") { QualtricsTA QTA = new QualtricsTA(); QTA.CreateUser(toReturn.Member); } Log.Debug(logMethodName + "End Method"); return(toReturn); }
public List <RecurringExpense> GetRecurringExpenses() { var lessonUserId = GetUserLessonId(); return(!lessonUserId.HasValue ? null : SaltServiceAgent.GetUserLesson2Results(lessonUserId.Value) .RecurringExpenses.ToRecurringExpenseDomainObject()); }
public User UpdateLesson3User(User user, string userId) { if (userId == null || string.Empty == userId) { user.AddError("User ID is undefined!"); return(user); } SaltServiceAgent.UpdateUserLesson(user.ToDataContract(LessonTypes.OwnYourStudentLoans)); return(user); }
public User UpdateLesson2User(User user, string userId) { if (userId == null || string.Empty == userId) { user.AddError("User ID is undefined!"); return(user); } SaltServiceAgent.UpdateUserLesson(user.ToDataContract(LessonTypes.MasterYourPlastic)); return(user); }
public bool UpsertMemberRoles(int memberId, List <vMemberRoleModel> memberRoles, string ModifiedBy) { try { return(SaltServiceAgent.UpsertMemberRoles(memberId, memberRoles.ToMemberRolesDataContractList().ToArray(), ModifiedBy)); } catch (Exception ex) { throw ex; } }
public IEnumerable <vMemberRoleModel> GetMemberRoles(int MemberID) { try { return(SaltServiceAgent.GetMemberRoles(MemberID).ToDomainObject()); } catch (Exception ex) { throw ex; } }
public SelfReportedLoanModel CreateLoan(SelfReportedLoanModel loan) { if (!loan.IsValid()) { throw new System.ComponentModel.DataAnnotations.ValidationException(); } var loanContract = loan.ToMemberReportedLoanContract(); var userId = _memberAdapter.GetMemberIdFromContext(); var serviceResponse = SaltServiceAgent.CreateLoan(userId, loanContract).FromMemberReportedLoanContract(); return(serviceResponse); }
public IList <MemberOrganizationModel> GetMemberOrganizations(int userId) { var returnList = new List <MemberOrganizationModel>(); var organizationList = SaltServiceAgent.GetMemberOrganizations(userId); foreach (var org in organizationList) { returnList.Add(org.ToMemberOrganizationModel()); } return(returnList); }
public bool DeleteLoan(string id) { int loanId = Convert.ToInt32(id); var userId = _memberAdapter.GetMemberIdFromContext(); var serviceResponse = SaltServiceAgent.DeleteLoan(userId, loanId); if (!serviceResponse) { Log.Debug("End Method"); throw new WebFaultException <string>("{Failed to delete" + "}", System.Net.HttpStatusCode.BadRequest); } return(serviceResponse); }
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 IList <MemberProductModel> GetMemberProducts(int memberId) { var returnList = new List <MemberProductModel>(); var productList = SaltServiceAgent.GetMemberProducts(memberId); foreach (var product in productList) { returnList.Add(product.ToMemberProductModel()); } return(returnList); }
public bool RetakeLesson(string lessonId) { var userId = GetUserLessonId(); var lesson = Convert.ToInt32(lessonId); return(userId.HasValue && SaltServiceAgent.DeleteUserLessonResponses(userId.Value, lesson, null, null, null) && SaltServiceAgent.UpdateUserLesson(new MemberLessonContract() { LessonId = lesson, CurrentStep = 0, LessonUserId = userId.Value })); }
public bool UpsertMemberToDo(MemberToDoModel todo) { bool result; try { result = SaltServiceAgent.UpsertMemberToDo(todo.ToDataContract()); } catch (Exception ex) { Log.Error("UpsertMemberToDo Exception =>", ex); throw; } return(result); }
/// <summary> /// Gets the reminders. /// </summary> /// <param name="memberId">The member id.</param> /// <returns></returns> /// <exception cref="ReminderOperationException">Web Reminder Service - ASA.Web.Services.ReminderService.ReminderAdapter.GetReminders()</exception> public ReminderListModel GetReminders(int memberId) { var rList = new ReminderListModel(); try { rList = SaltServiceAgent.GetUserPaymentReminders(memberId).ToDomainObject(); } catch (Exception ex) { _log.Error("ASA.Web.Services.ReminderService.ReminderAdapter.GetReminders(): Exception =>" + ex.ToString()); throw new ReminderOperationException("Web Reminder Service - ASA.Web.Services.ReminderService.ReminderAdapter.GetReminders()", ex); } return(rList); }
public bool PostLesson1(Lesson1 lesson1) { if (lesson1.IsValid()) { lock (_lockObject) { SaltServiceAgent.PostLesson1(lesson1.ToDataContract()); return(true); } } else { lesson1.AddError("Lesson object is not valid"); return(false); } }
public IList <MemberToDoModel> GetMemberToDos(int memberID) { List <MemberToDoModel> returnList = new List <MemberToDoModel>(); try { var memberTodoList = SaltServiceAgent.GetMemberToDos(memberID); foreach (var todoContract in memberTodoList) { returnList.Add(todoContract.ToDomainObject()); } } catch (Exception ex) { Log.Error("GetMemberToDos Exception =>", ex); } return(returnList); }