Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        public MemberContentInteraction UpdateInteraction(string id, MemberContentInteraction interactionToUpdate)
        {
            if (!string.IsNullOrEmpty(interactionToUpdate.MemberContentComment) && interactionToUpdate.MemberContentComment.Length > 500)
            {
                interactionToUpdate.MemberContentComment = interactionToUpdate.MemberContentComment.Substring(0, 500);
            }

            if (!interactionToUpdate.IsValid())
            {
                throw new System.ComponentModel.DataAnnotations.ValidationException();
            }

            MemberContentInteraction memberContentInteraction = new MemberContentInteraction();

            int memberId = interactionToUpdate.MemberID.GetValueOrDefault();

            if (memberAdapter.IsCurrentUser(memberId.ToString()))
            {
                memberContentInteraction = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").UpdateInteraction(memberId, interactionToUpdate.ToMemberContentInteractionContract()).ToDomainObject();
            }
            else
            {
                throw new WebFaultException <string>("Not Authorized", System.Net.HttpStatusCode.Unauthorized);
            }

            return(memberContentInteraction);
        }
Esempio n. 3
0
        /// <summary>
        /// Updates the specified member.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">There was an error updating Individual record</exception>
        public MemberUpdateStatus Update(ASAMemberModel member)
        {
            const string logMethodName = ".Update(ASAMemberModel member) - ";

            Log.Debug(logMethodName + "Begin Method");
            MemberUpdateStatus memberUpdateStatus = MemberUpdateStatus.Failure;

            try
            {
                memberUpdateStatus = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").UpdateUser(member.ToDataContract());
            }
            catch (Exception ex)
            {
                String msg = String.Format("There was an error updating Individual record - {0}", ex.Message);
                throw new Exception(msg);
            }
            //Call async Qualtric's Target Audience API
            if (Common.Config.QTA_Process.ToLower() == "on" && memberUpdateStatus == MemberUpdateStatus.Success)
            {
                var         updatedMember = GetMember(Convert.ToInt32(member.MembershipId));
                QualtricsTA QTA           = new QualtricsTA();
                QTA.UpdateUser(updatedMember);
            }

            Log.Debug(logMethodName + "End Method");
            return(memberUpdateStatus);
        }
Esempio n. 4
0
        public IEnumerable <vMemberAcademicInfoModel> GetMembersBySearchParms(Nullable <Int32> MemberID, String FirstName, String LastName, String EmailAddress, String CommunityDisplayName)
        {
            FirstName            = (String.IsNullOrEmpty(FirstName)) ? "" : FirstName;
            LastName             = (String.IsNullOrEmpty(LastName)) ? "" : LastName;
            EmailAddress         = (String.IsNullOrEmpty(EmailAddress)) ? "" : EmailAddress;
            CommunityDisplayName = (String.IsNullOrEmpty(CommunityDisplayName)) ? "" : CommunityDisplayName;

            if (MemberID != null)
            {
                FilteredMembers = MemberSearch.Where(entity => entity.MemberID == MemberID).ToList();
            }

            if (FilteredMembers.Count() > 0)
            {
                //members found in memory
                return(FilteredMembers);
            }
            else
            {
                // retrieve Members with specified search params from db
                IEnumerable <vMemberAcademicInfoModel> SaltSearchResult = IntegrationLoader.LoadDependency <ISaltServiceAgentAsync>("saltServiceAgentAsync").GetMembersBySearchParms(MemberID, FirstName, LastName, EmailAddress, ar => { }).ToVMemberAcademicInfoDomainObject();

                return(SaltSearchResult);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Method wired from Global.asax.cs to represent the first call into the ASA Application stack. Any calls before this event may have unexpected behaviors.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void ApplicationRequestStart(Object sender, EventArgs e)
        {
            if (HttpContext.Current != null &&
                HttpContext.Current.Handler != null &&
                HttpContext.Current.Handler.GetType() == typeof(MvcHandler))    //Order of operation on this if statement is very specific. Using && ensures if eval will abort before doing anything that causes an exception
            {
                //We do logging a bit different here to keep the debug logs from having a bunch of irrelvant information about requests that were skipped by the main application.
                //This is due to the fact that the event hook we use is fired by ALL requests coming to IIS but we only care about working with the ones for MVC.
                //This method is our PRE-Load area for any data or processes we want to handle at the beginning of every request headed for the MVC application,
                //TODO: This should likely fire its own event that allows other developers to extend from rather than extending directly into a loader critical for core-site components.
                String logMethodName = ".ApplicationRequestStart(Object sender, EventArgs e) - ";
                _log.Debug(logMethodName + "Begin Method");
                _log.Info(logMethodName + "======= Starting ApplicationRequest " + HttpContext.Current.Request.RawUrl + " ========");

                Guid requestId = Guid.NewGuid();
                if (HttpContext.Current.Items["SiteMember"] == null)
                {
                    _log.Debug(logMethodName + "No SiteMember in context, loading");
                    SiteMember member = null;

                    member = IntegrationLoader.LoadDependency <ISiteMembership>("siteMembership").GetMember();

                    HttpContext.Current.Items["SiteMember"] = member;
                }

                _log.Debug(logMethodName + "End Method");
            }
        }
Esempio n. 6
0
        public IList <OrganizationProductModel> GetOrganizationProducts(int orgId)
        {
            var productList = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetOrganizationProducts(orgId);

            IList <OrganizationProductModel> returnList = productList.Select(product => product.ToOrganizationProductModel()).ToList();

            return(returnList);
        }
Esempio n. 7
0
        public SaltMemberModel GetMemberByEmail(string email)
        {
            var member = new SaltMemberModel();

            //this will return a single record and thus firstorDefault.
            member = IntegrationLoader.LoadDependency <ISaltServiceAgentAsync>("saltServiceAgentAsync").GetMembersBySearchParms(null, "", "", email, ar => { }).ToDomainObject().FirstOrDefault();

            return(member);
        }
Esempio n. 8
0
        /// <summary>
        /// Retrieves user based upon the NatvieGuid in Active directory.
        /// This is the most preffered method for accessing a member from XWeb do not use the others unless you have no other option.
        /// </summary>
        /// <param name="systemId">NativeID from AD.</param>
        /// <returns>
        /// Populated member model.
        /// </returns>
        public ASAMemberModel GetMember(Guid systemId)
        {
            const string logMethodName = ".GetMember(Guid systemId) - ";

            Log.Debug(logMethodName + "Begin Method");

            var member = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserByActiveDirectoryKey(systemId.ToString()).ToDomainObject();

            Log.Debug(logMethodName + "End Method");
            return(member);
        }
Esempio n. 9
0
        /// <summary>
        /// Gets the member.
        /// </summary>
        /// <param name="memberId">The member id.</param>
        /// <returns></returns>
        public ASAMemberModel GetMember(int memberId)
        {
            const string logMethodName = ".GetMember(int memberId) - ";

            Log.Debug(logMethodName + "Begin Method");

            var member = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserByUserId(memberId).ToDomainObject();

            Log.Debug(logMethodName + "End Method");
            return(member);
        }
Esempio n. 10
0
        private SelfReportedLoanListModel RemoveInvalidLoansFromList(SelfReportedLoanListModel srList)
        {
            //get Id of the member currently logged-in
            SiteMember sm           = IntegrationLoader.LoadDependency <ISiteMembership>("siteMembership").GetMember();
            string     individualId = "";

            if (sm != null && sm.Profile != null && sm.Profile.Id != null)
            {
                individualId = sm.Profile.Id.ToString();
                _log.Debug(string.Format("SiteMember.Profile.Id = {0}", individualId));
            }

            List <string> invalidLoanIdList = new List <string>();

            //get list of current SRL's for the member logged-in
            if (!string.IsNullOrEmpty(individualId))
            {
                SelfReportedLoanListModel srListFromDB = GetSelfReportedLoans(individualId);
                foreach (SelfReportedLoanModel srl in srList.Loans)
                {
                    if (!string.IsNullOrEmpty(srl.LoanSelfReportedEntryId) && srListFromDB != null)//only care about loans being updated here.
                    {
                        bool foundValidLoan = false;
                        foreach (SelfReportedLoanModel srlFromDB in srListFromDB.Loans)
                        {
                            if (srl.LoanSelfReportedEntryId == srlFromDB.LoanSelfReportedEntryId)
                            {
                                foundValidLoan = true;
                                break;
                            }
                        }

                        // if a loan attempting to be updated by user isn't in DB, then user is tampering. Remove that loan from the update list.
                        if (!foundValidLoan)
                        {
                            invalidLoanIdList.Add(srl.LoanSelfReportedEntryId);
                            _log.Warn(string.Format("User attempted to save loan information that did not belong to them. User = {0}, LoanSelfReportedEntryId = {1}",
                                                    individualId, srl.LoanSelfReportedEntryId));
                        }
                    }
                }

                foreach (string str in invalidLoanIdList)
                {
                    SelfReportedLoanModel srl = srList.Loans.Find(l => l.LoanSelfReportedEntryId == str);
                    if (srl != null)
                    {
                        srList.Loans.Remove(srl);
                    }
                }
            }

            return(srList);
        }
Esempio n. 11
0
        public SelfReportedLoanListModel GetSelfReportedLoans()
        {
            Log.Info("ASA.Web.Services.SelfReported.GetSelfReportedLoans() starting ...");

            var userId   = _memberAdapter.GetMemberIdFromContext();
            var loanList = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserReportedLoans(userId);

            Log.Info("ASA.Web.Services.SelfReported.GetSelfReportedLoans() ending ...");

            return(loanList.FromMemberReportedLoanContractList());
        }
Esempio n. 12
0
        /// <summary>
        /// Gets users content interaction by contentType
        /// </summary>
        /// <param name="userId">The userId</param>
        /// <param name="contentType">0=All;1=Rate;</param>
        /// <returns>List<MemberContentInteraction></MemberContentInteraction></returns>
        public List <MemberContentInteraction> GetInteractions(string memberId, string contentType)
        {
            const string logMethodName = ".GetInteractions(string memberId, string contentType) - ";

            Log.Debug(logMethodName + "Begin Method");

            Int32 iContentType = 0;

            Int32.TryParse(contentType, out iContentType);

            return(IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserInteractions(Int32.Parse(memberId), iContentType).ToDomainObject());
        }
Esempio n. 13
0
        public void SelfReportedService_GetSelfReportedLoans_UserId()
        {
            var mockSaltServiceAgent = (SaltServiceAgentStub)IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent");

            mockSaltServiceAgent.GetUserReportedLoansResponses = new List <MemberReportedLoanContract>()
            {
                new MemberReportedLoanContract()
                {
                    CreatedDate                = DateTime.Now,
                    MemberId                   = 1,
                    MemberReportedLoanId       = 2,
                    RecordSourceId             = 1,
                    LoanName                   = "Loan Test 1",
                    LoanType                   = "Self-Reported",
                    InterestRate               = 5,
                    OriginalLoanAmount         = 5000,
                    PrincipalOutstandingAmount = 4000,
                    ReceivedYear               = 2011,
                    LoanTerm                   = 8,
                    ServicingOrganizationName  = "Sallie Mae",
                    RecordSource               = new RecordSourceContract(),
                    OriginalLoanDate           = DateTime.Now,
                    MonthlyPaymentAmount       = 50,
                    ModifiedDate               = DateTime.Now
                },
                new MemberReportedLoanContract()
                {
                    CreatedDate                = DateTime.Now,
                    MemberId                   = 1,
                    MemberReportedLoanId       = 3,
                    RecordSourceId             = 1,
                    LoanName                   = "Loan Test 2",
                    LoanType                   = "Self-Reported",
                    InterestRate               = 5,
                    OriginalLoanAmount         = 2000,
                    PrincipalOutstandingAmount = 1500,
                    ReceivedYear               = 2012,
                    LoanTerm                   = 5,
                    ServicingOrganizationName  = "Sallie Mae",
                    RecordSource               = new RecordSourceContract(),
                    OriginalLoanDate           = DateTime.Now,
                    MonthlyPaymentAmount       = 50,
                    ModifiedDate               = DateTime.Now
                }
            };

            SelfReported srl = new SelfReported();

            SelfReportedLoanListModel loanList = srl.GetSelfReportedLoans();

            Assert.AreEqual(2, loanList.Loans.Count);
        }
Esempio n. 14
0
        /// <summary>
        /// Gets the organization by oe branch.
        /// </summary>
        /// <param name="oeCode">The oe code.</param>
        /// <param name="branch">The branch.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public BasicOrgInfoModel GetOrganizationByOeBranch(string oeCode, string branch)
        {
            var toReturn = new BasicOrgInfoModel();

            var organization = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetOrganization(oeCode, branch);

            if (organization != null)
            {
                toReturn = organization.ToDomainObject();
            }

            return(toReturn);
        }
Esempio n. 15
0
        /// <summary>
        /// Gets the organization by external org id.
        /// </summary>
        /// <param name="externalOrgId">The external org ID.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public BasicOrgInfoModel GetOrganizationByExternalOrgID(string externalOrgId)
        {
            var toReturn = new BasicOrgInfoModel();

            var organization = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetOrganizationByExternalOrgID(externalOrgId);

            if (organization != null)
            {
                toReturn = organization.ToDomainObject();
            }

            return(toReturn);
        }
Esempio n. 16
0
        public int GetKWYOSelfReportedLoans()
        {
            Log.Info("ASA.Web.Services.SelfReported.GetKWYOSelfReportedLoans() starting ...");

            var userId = _memberAdapter.GetMemberIdFromContext();

            var recordSourceList = new string[] { "Imported-KWYO", "Member-KWYO" };

            var loanList = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserReportedLoansRecordSourceList(userId, recordSourceList);

            Log.Info("ASA.Web.Services.SelfReported.GetKWYOSelfReportedLoans() ending ...");

            return(loanList.Count);
        }
Esempio n. 17
0
        /// <summary>
        /// Retrieves user based upon the pre-registration token provided in registration email hyperlink
        /// </summary>
        /// <param name="email">Email address of member to lookup</param>
        public ASAMemberModel GetMemberByEmail(string email)
        {
            const string logMethodName = "GetMemberByEmail(string email) - ";

            Log.Debug(logMethodName + "Begin Method");

            var member = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserByUsername(email).ToDomainObject();

            if (member != null)
            {
                member.ProfileQAs = GetAllProfileQAs(int.Parse(member.MembershipId));
            }
            Log.Debug(logMethodName + "End Method");
            return(member);
        }
Esempio n. 18
0
        public User GetUserByActiveDirectoryKey(string activeDirectoryKey)
        {
            var user = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserByActiveDirectoryKey(activeDirectoryKey);

            if (user != null)
            {
                if (user.MemberLessons.Any())
                {
                    var toReturn = user.MemberLessons.ToDomainObject();
                    return(toReturn);
                }
            }

            return(null);
        }
Esempio n. 19
0
        public IEnumerable <SaltMemberModel> GetMembersBySearchParms(String FirstName, String LastName, String CommunityDisplayName)
        {
            FirstName            = (String.IsNullOrEmpty(FirstName)) ? "" : FirstName;
            LastName             = (String.IsNullOrEmpty(LastName)) ? "" : LastName;
            CommunityDisplayName = (String.IsNullOrEmpty(CommunityDisplayName)) ? "" : CommunityDisplayName;

            List <SaltMemberModel> SaltSearchResult = new List <SaltMemberModel>();

            SaltSearchResult = IntegrationLoader.LoadDependency <ISaltServiceAgentAsync>("saltServiceAgentAsync").GetMembersBySearchParms(null, FirstName, LastName, "", ar => { }).ToDomainObject().ToList();

            //common members
            //Integrate results, filtering out common entries (duplicates from Prospect get removed)
            //Sorting is done to put the most recently added Organization to the top that is active:EffectiveStartDate desc then if EffectiveEndDate is NULL sort those item by OrganizationEffectiveEndDate desc
            var result = SaltSearchResult.OrderBy(i => i.EmailAddress).ThenByDescending(i => i.OrganizationEffectiveStartDate).OrderByDescending(i => !(i.OrganizationEffectiveEndDate.HasValue)).ThenByDescending(i => i.OrganizationEffectiveEndDate).ToList();

            return(result);
        }
Esempio n. 20
0
        /// <summary>
        /// Des the activate account.
        /// </summary>
        /// <param name="activeDirectoryKey">The active directory key.</param>
        /// <returns></returns>
        public ResultCodeModel DeActivateAccount(string activeDirectoryKey)
        {
            const string logMethodName = "DeActivateAccount(string activeDirectoryKey) - ";

            Log.Debug(logMethodName + "Begin Method");
            var toReturn = new ResultCodeModel(1);
            var member   = GetMember(new Guid(activeDirectoryKey));

            if (member != null)
            {
                IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").DeactivateUser(GetMemberIdFromContext(), member.PrimaryEmailKey.ToString());
            }

            Log.Debug(logMethodName + "End Method");

            return(toReturn);
        }
Esempio n. 21
0
        public SaltMemberModel GetMember(int memberId)
        {
            var member = new SaltMemberModel();

            IEnumerable <vMemberAcademicInfoModel> SaltSearchResult = IntegrationLoader.LoadDependency <ISaltServiceAgentAsync>("saltServiceAgentAsync").GetMembersBySearchParms(memberId, "", "", "", ar => { }).ToVMemberAcademicInfoDomainObject();

            foreach (var Item in SaltSearchResult)
            {
                member.MemberID         = Item.MemberID;
                member.FirstName        = Item.FirstName;
                member.LastName         = Item.LastName;
                member.EmailAddress     = Item.EmailAddress;
                member.OrganizationName = Item.OrganizationName;
            }

            return(member);
        }
Esempio n. 22
0
        public ASAMemberModel Logon(bool logon, string emailAddress)
        {
            const string logMethodName = ".Logon(bool logon, string emailAddress - ";

            Log.Debug(logMethodName + "Begin Method");

            ASAMemberModel member = null;

            if (logon)
            {
                member = GetMemberByEmail(emailAddress);

                if (member != null)
                {
                    Log.Debug(logMethodName + "Member found, creating sesion cookies");
                    //creates WTFSession.NewSession() & authentication cookie
                    IntegrationLoader.LoadDependency <ISiteMembership>("siteMembership").SignIn(emailAddress);

                    if (System.Web.HttpContext.Current.Request.Cookies.AllKeys.Contains("IndividualId"))
                    {
                        HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["IndividualId"];
                        cookie.Domain  = "saltmoney.org";
                        cookie.Expires = DateTime.Now.AddDays(-1);
                        System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
                    }
                    if (System.Web.HttpContext.Current.Request.Cookies.AllKeys.Contains("MemberId"))
                    {
                        HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["MemberId"];
                        cookie.Domain  = "saltmoney.org";
                        cookie.Expires = DateTime.Now.AddDays(-1);
                        System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
                    }

                    UpdateLastLoginTimestamp(Convert.ToInt32(member.MembershipId));
                }
            }
            else
            {
                member = new ASAMemberModel();
            }

            Log.Debug(logMethodName + "End Method");
            return(member);
        }
Esempio n. 23
0
        public bool DeleteInteraction(string id, MemberContentInteraction interactionToDelete)
        {
            bool serviceResponse = false;
            int  memberId        = interactionToDelete.MemberID.GetValueOrDefault();

            if (memberAdapter.IsCurrentUser(memberId.ToString()))
            {
                serviceResponse = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").DeleteInteraction(memberId, Int32.Parse(id));
                if (!serviceResponse)
                {
                    throw new WebFaultException <string>("{Failed to delete" + "}", System.Net.HttpStatusCode.BadRequest);
                }
            }
            else
            {
                throw new WebFaultException <string>("Not Authorized", System.Net.HttpStatusCode.Unauthorized);
            }

            return(serviceResponse);
        }
Esempio n. 24
0
        public MemberContentInteraction AddInteraction(MemberContentInteraction interaction)
        {
            if (!string.IsNullOrEmpty(interaction.MemberContentComment) && interaction.MemberContentComment.Length > 500)
            {
                interaction.MemberContentComment = interaction.MemberContentComment.Substring(0, 500);
            }

            if (!interaction.IsValid())
            {
                throw new System.ComponentModel.DataAnnotations.ValidationException();
            }
            if (memberAdapter.IsCurrentUser(interaction.MemberID.ToString()))
            {
                return(IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").AddInteraction(interaction.ToMemberContentInteractionContract()).ToDomainObject());
            }
            else
            {
                throw new WebFaultException <string>("Not Authorized", System.Net.HttpStatusCode.Unauthorized);
            }
        }
Esempio n. 25
0
        private bool IsSRLForPersonLoggedIn(string srlId)
        {
            bool srlBelongsToPersonLoggedIn = false;
            //get Id of the member currently logged-in
            SiteMember sm           = IntegrationLoader.LoadDependency <ISiteMembership>("siteMembership").GetMember();
            string     individualId = "";

            if (sm != null && sm.Profile != null && sm.Profile.Id != null)
            {
                individualId = sm.Profile.Id.ToString();
            }

            //get list of current SRL's for the member logged-in
            if (!string.IsNullOrEmpty(individualId))
            {
                SelfReportedLoanListModel srListFromDB = GetSelfReportedLoans(individualId);

                if (!string.IsNullOrEmpty(srlId) && srListFromDB != null)//only care about loans being updated here.
                {
                    foreach (SelfReportedLoanModel srlFromDB in srListFromDB.Loans)
                    {
                        if (srlId == srlFromDB.LoanSelfReportedEntryId)
                        {
                            srlBelongsToPersonLoggedIn = true;
                            break;
                        }
                    }

                    if (!srlBelongsToPersonLoggedIn)
                    {
                        _log.Warn(string.Format("User attempted to save loan information that did not belong to them. User = {0}, LoanSelfReportedEntryId = {1}", individualId, srlId));
                    }
                }
                else if (string.IsNullOrEmpty(srlId))
                {
                    srlBelongsToPersonLoggedIn = true;
                }
            }

            return(srlBelongsToPersonLoggedIn);
        }
Esempio n. 26
0
        public BasicIndividualInfoModel GetBasicIndividualInfo()
        {
            Log.Debug("START GetBasicIndividualInfo");
            var retModel = new BasicIndividualInfoModel();

            try
            {
                var member = IntegrationLoader.LoadDependency <ISiteMembership>("siteMembership").GetMember();
                retModel.DisplayName = member.Profile.DisplayName;
            }
            catch (Exception e)
            {
                Log.Error("GetBasicIndividualInfo: Exception => " + e.ToString());
                retModel.ErrorList.Add(new ErrorModel {
                    BusinessMessage = "Unable to Get Basic Individual Info"
                });
            }

            Log.Debug("END GetBasicIndividualInfo");
            return(retModel);
        }
Esempio n. 27
0
        /// <summary>
        /// Get Cost of Living state list.
        /// </summary>
        /// <returns>COLResponseModel containing the COLStateModel list of States.</returns>
        /// <exception cref="SurveyOperationException">Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetCOLStateList()</exception>
        public COLResponseModel GetCOLStateList()
        {
            const string logMethodName = ".GetCOLStateList() - ";

            Log.Info(logMethodName + "Begin Method");

            var colResponseModel = new COLResponseModel();

            try
            {
                colResponseModel.State = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetCOLStates().ToDomainObject();
            }

            catch (Exception ex)
            {
                Log.Error(logMethodName + "Exception =>" + ex.ToString());
                throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetCOLStateList()", ex);
            }

            Log.Info(logMethodName + "End Method");
            return(colResponseModel);
        }
Esempio n. 28
0
        /// <summary>
        /// Gets the CostOfLiving results.
        /// </summary>
        /// <param name="request">The COLRequestModel with the CityA, "CityB and Salary provided.</param>
        /// <returns>COLResponseModel with COLCostBreakDownModel and NeededSalary & percentageSalaryChange</returns>
        /// <exception cref="SurveyOperationException">Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetCOLStateList()</exception>
        public COLResponseModel GetCOLResults(COLRequestModel request)
        {
            const string logMethodName = ".GetCOLResults(COLRequestModel request) - ";

            Log.Info(logMethodName + "Begin Method");

            var colResponseModel = new COLResponseModel();

            try
            {
                colResponseModel = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetCOLResults((int)request.CityA, (int)request.CityB, (decimal)request.Salary).ToDomainObject();
            }

            catch (Exception ex)
            {
                Log.Error(logMethodName + "Exception =>" + ex.ToString());
                throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetCOLResults()", ex);
            }

            Log.Info(logMethodName + "End Method");
            return(colResponseModel);
        }
Esempio n. 29
0
        /// <summary>
        /// Post the results of the JSI quiz.
        /// </summary>
        /// <param name="jsiQuizModel">single JSIQuizModel object</param>
        /// <returns>?</returns>
        public JSIQuizListModel PostJSIResponse(JSIQuizModel jsiQuizModel)
        {
            const string logMethodName = ".PostJSIResponse(JSIQuizModel jsiQuizModel) - ";

            Log.Info(logMethodName + "Begin Method");

            var jList = new JSIQuizListModel();

            try
            {
                var jsiQuizResult = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").PostJSIResponse(jsiQuizModel.ToDataContract()).ToDomainObject();
                jList = new JSIQuizListModel(jsiQuizResult);
            }
            catch (Exception ex)
            {
                Log.Error(logMethodName + "Exception =>" + ex.ToString());
                throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetJSISchoolList()", ex);
            }

            Log.Info(logMethodName + "End Method");
            return(jList);
        }
Esempio n. 30
0
        /// <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);
        }