Ejemplo n.º 1
0
        public ActionResult MemberDetails()
        {
            try
            {
                var            user       = UserManager.Users.Where(x => x.UserName == User.Identity.Name).First();
                string         SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
                Member_Service service    = new Member_Service();

                service.Url = "http://" + PensionSetup.ServerName + ":" + PensionSetup.ServerPort + "/" + PensionSetup.ServerInstance + "/WS/" + SchemeName + "/Page/Member";
                service.UseDefaultCredentials = false;
                service.Credentials           = new NetworkCredential(PensionSetup.SoapUsername, PensionSetup.SoapPassword);

                Member details      = new Member();
                string MemberNumber = user.MemberNumber;

                var contributionDates = PensionSetup.GetContributionDatesFromService(SchemeName, MemberNumber);
                var maxContDate       = contributionDates.startDate;
                var minContDate       = contributionDates.endDate;

                details = service.Read(MemberNumber);

                var today = DateTime.Today;
                var age   = today.Year - details.Date_of_Birth.Year;

                Retirement_Service rservice = new Retirement_Service();
                rservice.Url = "http://" + PensionSetup.ServerName + ":" + PensionSetup.ServerPort + "/" + PensionSetup.ServerInstance + "/WS/" + SchemeName + "/Page/Retirement";
                rservice.UseDefaultCredentials = false;
                rservice.Credentials           = new NetworkCredential(PensionSetup.SoapUsername, PensionSetup.SoapPassword);

                Retirement[] retirement = rservice.ReadMultiple(null, null, 0);

                var normalRetirementAge = retirement[0].Normal_Retirement_Age;


                var data = new { member = details, LastContDate = minContDate, FirstContDate = maxContDate, Age = age, NormalRetirementAge = normalRetirementAge };
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { MESSAGE = ex.Message, STATUS = "0" }, JsonRequestBehavior.AllowGet));
            }
        }