public ActionResult SchemeDetails()
        {
            var     user          = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var     SchemeName    = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            var     read          = GetCompanyInformation(SchemeName);
            decimal amount        = TotalAVCAmount(SchemeName);
            decimal fund_credit   = GetFundCredit(SchemeName);
            var     schemeDetails = new
            {
                schemeCode = SchemeName,
                schemeName = SchemeName,

                emailAddress  = read[0].E_Mail,
                companyName   = read[0].Name,
                postalAddress = read[0].Address + ' ' + read[0].Address_2,
                phoneNumber   = read[0].Phone_No,

                numberOfMembers    = GetTotalMembers(SchemeName),
                numberOfPensioners = GetPensioners(SchemeName),

                active         = GetActiveMembers(SchemeName),
                deferred       = GetDeferredMembers(SchemeName),
                dormant        = GetDormantMembers(SchemeName),
                inactive       = GetInactiveMembers(SchemeName),
                pensioners     = GetPensioners(SchemeName),
                peopledoingavc = GetPeopleDoingAVC(SchemeName),
                amount         = amount.ToString("N2", CultureInfo.InvariantCulture),
                fund_credit    = fund_credit.ToString("N2", CultureInfo.InvariantCulture)
            };

            var jsonSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var json           = jsonSerializer.Serialize(schemeDetails);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
        public ActionResult MemberStatement()
        {
            var    user         = UserManager.Users.Where(x => x.UserName == User.Identity.Name).First();
            string SchemeName   = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            string path         = ConfigurationManager.AppSettings["PDFStorage"];
            string MemberNumber = user.MemberNumber;
            string file         = user.SponsorNumber + "_51520011" + MemberNumber + ".pdf";
            Portal statement    = new Portal();

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

            try
            {
                statement.MemberStatement(file, path, MemberNumber);

                return(Json(new { STATUS = "1", URL = "/Content/Storage/" + file, memberStatement = statement }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                var error = new { STATUS = "0", MESSAGE = ex.Message };
                return(Json(error, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult GetBeneficiary(int Line_No)
        {
            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;

                details = service.Read(MemberNumber);
                var beneficiary = details.Next_of_Kin.Where(x => x.Line_No == Line_No).FirstOrDefault();

                var data = new { member = beneficiary };
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { MESSAGE = ex.Message, STATUS = "0" }, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Benefit(string date)
        {
            var    user       = UserManager.Users.Where(x => x.UserName == User.Identity.Name).First();
            string SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            Portal benefit    = new Portal();

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

            string MemberNumber = user.MemberNumber;

            ViewBag.MemberNumber = MemberNumber;

            string   file = user.SponsorNumber + "_51520155" + MemberNumber + ".pdf";
            string   path = ConfigurationManager.AppSettings["PDFStorage"];
            DateTime endDate;

            endDate = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            endDate = new DateTime(endDate.Year, endDate.Month, endDate.Day);

            benefit.BenefitStatement(file, path, MemberNumber, endDate.Date);

            return(Json(new { STATUS = "1", URL = "/Content/Storage/" + file, benefitStatement = benefit }, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        public ActionResult GetSavingsPlanByMember()
        {
            using (var con = new ApplicationDbContext())
            {
                var user       = con.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
                var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
                var savings    = (from n in con.Saving
                                  where n.SchemeCode == SchemeName && n.MemberNumber == user.MemberNumber
                                  select new
                {
                    savingsPlanID = n.Id,
                    schemeCode = n.SchemeCode,
                    memberNumber = n.MemberNumber,
                    savingsPlanName = n.SavingName,
                    savingsPlanOptionsID = n.SavingOptionId,
                    currentLevelOfSaving = n.CurrentLevelOfSaving,
                    monthlySavings = n.MonthlySavings,
                    durationInYears = n.DurationInYears,
                    targetAmount = n.TargetAmount,
                    targetAmountPresentValue = n.TargetAmountPresentValue,
                    dateCreated = n.CreatedAt,
                    dateModified = n.UpdatedAt,
                    risk =
                        (
                            n.Risk == null ? "Low risk" : n.Risk
                        )
                }).ToList();

                return(Json(new { savings = savings }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #6
0
        //GET
        public ActionResult ElectionCreate()
        {
            var user = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            List <SelectListItem> electionTypes = new List <SelectListItem>();

            foreach (var type in context.ElectionType.ToList())
            {
                electionTypes.Add(new SelectListItem()
                {
                    Value = type.Id.ToString(), Text = type.Type
                });
            }

            List <SelectListItem> items = new List <SelectListItem>();

            items.Add(new SelectListItem()
            {
                Text = "Open", Value = "1", Selected = false
            });
            items.Add(new SelectListItem()
            {
                Text = "Closed", Value = "2", Selected = true
            });

            ViewBag.ElectionStatus = items;
            ViewBag.ElectionType   = electionTypes;
            ViewBag.SchemeName     = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            return(View());
        }
        public ActionResult MemberDetails(string memberNo)
        {
            var            user       = context.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 = memberNo;

            details = service.Read(MemberNumber);

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

            var data = new
            {
                details,
                Age
            };

            var jsonSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var json           = jsonSerializer.Serialize(data);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
 private bool CheckIfMemberNumberExistsAsync(string StaffNumber, string SponsorNumber)
 {
     if (PensionSetup.GetMemberNumberAsync(StaffNumber, SponsorNumber) == null)
     {
         return(false);
     }
     return(true);
 }
 private bool CheckIfSponsorNumberExistsAsync(string SponsorNumber)
 {
     if (PensionSetup.GetSchemeNameAsync(SponsorNumber) == null)
     {
         return(false);
     }
     return(true);
 }
        public ActionResult RelationOptions()
        {
            var user          = UserManager.Users.Where(x => x.UserName == User.Identity.Name).First();
            var SchemeName    = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            var relationships = GetRelationships(SchemeName);

            return(Json(relationships, JsonRequestBehavior.AllowGet));
        }
        private async Task <string> GetMemberNamesAsync(string Email)
        {
            var user = await UserManager.FindByEmailAsync(Email);

            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            var Member     = PensionSetup.GetMemberDetailsAsync(SchemeName, user.MemberNumber);

            return(Member.First_Name + ' ' + Member.Last_Name);
        }
        public ViewResult AVCRequests(string sortOrder, string currentFilter, string searchString, int?page, int?size)
        {
            var user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);

            ViewBag.CurrentSort          = sortOrder;
            ViewBag.NameSortParm         = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.MemberNumberSortParm = sortOrder == "Date" ? "date_desc" : "Date";
            ViewBag.Selected             = size;

            ViewBag.SizeList = ListSize();

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;
            var avc = from a in context.AvcApplication.Include("AvcApplicationType")
                      select a;

            if (!String.IsNullOrEmpty(searchString))
            {
                avc = avc.Where(s => s.MemberNumber.Contains(searchString) ||
                                s.MemberNumber.Contains(searchString));
            }

            switch (sortOrder)
            {
            case "name_desc":
                avc = avc.OrderByDescending(x => x.MemberNumber);
                break;

            case "Date":
                avc = avc.OrderBy(s => s.MemberNumber);
                break;

            case "date_desc":
                avc = avc.OrderByDescending(s => s.AvcApplicationDate);
                break;

            default:
                avc = avc.OrderBy(s => s
                                  .AvcApplicationDate);
                break;
            }
            int pageSize   = (size ?? 10);
            int pageNumber = (page ?? 1);

            return(View(avc.ToPagedList(pageNumber, pageSize)));
        }
        public ViewResult Members(string sortOrder, string currentFilter, string searchString, int?page, int?size)
        {
            var user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);

            ViewBag.CurrentSort          = sortOrder;
            ViewBag.NameSortParm         = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.MemberNumberSortParm = sortOrder == "Date" ? "date_desc" : "Date";
            ViewBag.Selected             = size;

            ViewBag.SizeList = ListSize();

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;
            var members = from m in GetMembers(SchemeName)
                          select m;

            if (!String.IsNullOrEmpty(searchString))
            {
                members = members.Where(s => s.No.Contains(searchString) ||
                                        s.No.Contains(searchString));
            }

            switch (sortOrder)
            {
            case "name_desc":
                members = members.OrderByDescending(x => x.No);
                break;

            case "Date":
                members = members.OrderBy(s => s.First_Name);
                break;

            case "date_desc":
                members = members.OrderByDescending(s => s.First_Name);
                break;

            default:
                members = members.OrderBy(s => s.No);
                break;
            }
            int pageSize   = (size ?? 10);
            int pageNumber = (page ?? 1);

            return(View(members.ToPagedList(pageNumber, pageSize)));
        }
 public ActionResult GetBudgetsByMember()
 {
     using (var conn = new ApplicationDbContext())
     {
         var user       = conn.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
         var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
         var budget     = conn.Budget.Where(b => b.SchemeCode == SchemeName && b.MemberNumber == user.MemberNumber).ToList();
         var data       = new { budget = budget };
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
 }
        public ActionResult SaveBudget(BudgetData budgetPost)
        {
            var user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);

            using (var conn = new ApplicationDbContext())
            {
                var    operationType = budgetPost.operationType;
                var    budgetID      = budgetPost.budgetID;
                var    budgetName    = budgetPost.budgetName;
                Budget budget;
                if (operationType == "NEW")
                {
                    //SAVE
                    try
                    {
                        budget = new Budget();
                        budget = Budgeting(budget, budgetPost);
                        conn.Budget.Add(budget);
                        conn.SaveChanges();
                        var resp = new { STATUS = "1", MESSAGE = "Member Budget has been saved successfully" };
                        return(Json(resp, JsonRequestBehavior.AllowGet));
                    }
                    catch (Exception ex)
                    {
                        var resp = new { STATUS = "0", MESSAGE = "Member Budget could not be saved: " + ex.Message };
                        return(Json(resp, JsonRequestBehavior.AllowGet));
                    }
                }
                else if (operationType == "EDIT")
                {
                    //UPDATE
                    try
                    {
                        budget = conn.Budget.Where(b => b.Id == budgetID).FirstOrDefault();
                        budget = Budgeting(budget, budgetPost);
                        conn.SaveChanges();

                        var resp = new { STATUS = "1", MESSAGE = "Member Budget updated successfully" };
                        return(Json(resp, JsonRequestBehavior.AllowGet));
                    }
                    catch (Exception ex)
                    {
                        var resp = new { STATUS = "1", MESSAGE = "Member Budget could not be update: " + ex.Message };
                        return(Json(resp, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    var resp = new { STATUS = "0", MESSAGE = "Unknown Operation Type" };
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
            }
        }
Beispiel #16
0
        public int GetRetirementAge()
        {
            var user       = UserManager.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var schemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            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(SoapUser, SoapPass);

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

            return(retirement[0].Normal_Retirement_Age);
        }
        public Portal Portal()
        {
            var    user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            string SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            Portal portal     = new Portal();

            portal.Url = "http://" + PensionSetup.ServerName + ":" +
                         PensionSetup.ServerPort + "/" +
                         PensionSetup.ServerInstance + "/WS/" +
                         SchemeName + "/Codeunit/Portal";
            portal.UseDefaultCredentials = false;
            portal.Credentials           = new NetworkCredential(PensionSetup.SoapUsername, PensionSetup.SoapPassword);
            return(portal);
        }
        public ViewResult EditProfile()
        {
            Portal picture = new Portal();

            picture.UseDefaultCredentials = false;
            picture.Credentials           = new NetworkCredential(PensionSetup.SoapUsername, PensionSetup.SoapPassword);
            var user       = UserManager.Users.Where(x => x.UserName == User.Identity.Name).First();
            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);

            picture.GetPictureStream(user.MemberNumber, ConfigurationManager.AppSettings["IMGPath"]);
            ViewBag.MemberNumber  = user.MemberNumber;
            ViewBag.Relationships = Relationships(SchemeName);

            return(View());
        }
Beispiel #19
0
        public TaxBrackets GetTaxBrackets(int serviceYrs)
        {
            var user       = UserManager.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var schemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            TaxBrackets_Service brackets_Service = new TaxBrackets_Service();

            brackets_Service.Url = "http://" + PensionSetup.ServerName + ":" + PensionSetup.ServerPort + "/" + PensionSetup.ServerInstance + "/WS/" + schemeName + "/Page/TaxBrackets";

            brackets_Service.UseDefaultCredentials = false;
            brackets_Service.Credentials           = new NetworkCredential(SoapUser, SoapPass);
            TaxBrackets[] taxes = brackets_Service.ReadMultiple(null, null, 0);

            TaxBrackets taxBrackets = taxes.Where(x => x.Minimum_Service_Years == serviceYrs).FirstOrDefault();

            return(taxBrackets);
        }
Beispiel #20
0
        public async Task <IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { Status = 400, Message = "There is a problem with your input. Make sure you follow all password rules and all fields are valid." }));
            }

            string SponsorNumber = PensionSetup.GetSchemeNameAsync(model.SponsorNumber);

            if (SponsorNumber == null)
            {
                //ModelState.AddModelError("invalid_grant", "Sponsor Number does not exists");
                return(Json(new { Status = 400, Message = "Sponsor Number does not exists" }));
            }

            string MemberNumber = PensionSetup.GetMemberNumberAsync(model.StaffNumber, SponsorNumber);

            if (MemberNumber == null)
            {
                //ModelState.AddModelError("invalid_grant", "Staff Number does not exists");
                return(Json(new { Status = 400, Message = "Staff Number does not exists" }));
            }

            //Check if member has email
            var Member = PensionSetup.GetMemberDetailsAsync(SponsorNumber, MemberNumber);

            if (Member.E_Mail == null)
            {
                //ModelState.AddModelError("invalid_grant", "We didn't find any email associated to your profile, please contact your system administrator");
                return(Json(new { Status = 400, Message = "We didn't find any email associated to your profile, please contact your system administrator" }));
            }
            var user = new ApplicationUser {
                SponsorNumber = model.SponsorNumber, MemberNumber = MemberNumber, UserName = Member.E_Mail, Email = Member.E_Mail
            };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return(GetErrorResult(result));
            }
            //Send email
            string callbackUrl = await SendEmailConfirmationTokenAsync(user.Id, "Confirm your account");

            return(Json(new { Status = 200, Message = "We've sent an email to " + Member.E_Mail + ". Open your mail box to confirm your account.", Link = callbackUrl }));
        }
        public ActionResult GetMembersByGender()
        {
            var user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            var vendors    = Vendors(SchemeName);
            var member     = from u in vendors
                             let age = (u.Gender == VendorsListService.Gender.Female ? "Female" :
                                        u.Gender == VendorsListService.Gender.Male ? "Male" :
                                        "NA")
                                       group u by age into g
                                       select new { g.Key, Count = g.Count() };

            var jsonSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            var json = jsonSerializer.Serialize(member);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ClaimDetails(string exitNo)
        {
            var    user            = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            string SchemeName      = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            ClaimStatus_Service cs = new ClaimStatus_Service();

            cs.Url = "http://" + PensionSetup.ServerName + ":" +
                     PensionSetup.ServerPort + "/" +
                     PensionSetup.ServerInstance + "/WS/" +
                     SchemeName + "/Page/ClaimStatus";
            cs.UseDefaultCredentials = false;
            cs.Credentials           = new NetworkCredential(PensionSetup.SoapUsername, PensionSetup.SoapPassword);
            ClaimStatus claims = cs.Read(exitNo);

            var jsonSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var json           = jsonSerializer.Serialize(claims);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
Beispiel #23
0
        public Saving SavingsPlan(Saving savingsPlan, SavingPlanData planData)
        {
            var user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);

            savingsPlan.SchemeCode           = SchemeName;
            savingsPlan.MemberNumber         = user.MemberNumber;
            savingsPlan.SavingName           = planData.savingsPlanName;
            savingsPlan.CurrentLevelOfSaving = planData.currentSavings > 0 ? planData.currentSavings : 0;
            savingsPlan.SavingOptionId       = planData.savingPlanOptionsID > 0 ? planData.savingPlanOptionsID : 0;
            savingsPlan.MonthlySavings       = planData.monthlySavings > 0 ? planData.monthlySavings : 0;
            savingsPlan.DurationInYears      = planData.durationInYears > 0 ? planData.durationInYears : 0;
            savingsPlan.TargetAmount         = planData.targetAmount > 0 ? planData.targetAmount : 0;
            savingsPlan.Id        = planData.savingsPlanID;
            savingsPlan.Risk      = planData.risk;
            savingsPlan.CreatedAt = DateTime.Now;
            savingsPlan.TargetAmountPresentValue = 0;
            return(savingsPlan);
        }
        public ActionResult DataChangeDetails(string Number)
        {
            var    user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            string SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            MemberChangeList_Service service = new MemberChangeList_Service();

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

            var jsonSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var json           = jsonSerializer.Serialize(dataChange);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
        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));
            }
        }
        public Budget Budgeting(Budget budget, BudgetData budgetPost)
        {
            var user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);

            budget.SchemeCode                   = SchemeName;
            budget.MemberNumber                 = user.MemberNumber;
            budget.BudgetName                   = budgetPost.budgetName;
            budget.IncomeNetTakeHome            = budgetPost.netIncome;
            budget.IncomeSpouseNetTakeHome      = budgetPost.spouseNetIncome;
            budget.IncomeOther                  = budgetPost.otherIncome;
            budget.HouseMorgageRentInstallments = budgetPost.mortgageRent;
            budget.HouseLevyWaterElectricity    = budgetPost.ratesWaterElectricity;
            budget.HouseDstv                    = budgetPost.payTv;
            budget.HouseSecurity                = budgetPost.security;
            budget.HouseDomesticStaff           = budgetPost.staffCost;
            budget.HouseHomeInsurance           = budgetPost.homeInsurance;
            budget.TransCarInstallments         = budgetPost.publicTransport;
            budget.TransCarInsurance            = budgetPost.carInsurance;
            budget.TransFuel                    = budgetPost.maintenanceFee;
            budget.TelHomeLine                  = budgetPost.homeLine;
            budget.TellCellPhone                = budgetPost.cellularPhone;
            budget.TeldecimalernetSub           = budgetPost.internetSubscription;
            budget.FinanceRetirementSavings     = budgetPost.retirementSavings;
            budget.FinanceSavingsInvest         = budgetPost.savingInvestment;
            budget.FinanceMedicalExpensed       = budgetPost.medicalExpenses;
            budget.FinanceLifeAssurance         = budgetPost.lifeAssurance;
            budget.FinancePersonalLoan          = budgetPost.personalLoan;
            budget.FinanceCreditFund            = budgetPost.creditCard;
            budget.EducationSchoolFees          = budgetPost.schoolFees;
            budget.EducationUniformTextbooks    = budgetPost.miscellaneousFee;
            budget.EducationOtherCosts          = budgetPost.otherEducationCost;
            budget.ShoppingGroceries            = budgetPost.groceries;
            budget.ShoppingClothing             = budgetPost.clothing;
            budget.ShoppingAccountRepayments    = budgetPost.accountRepayment;
            budget.ShoppingOtherCosts           = budgetPost.otherShoppingCost;
            budget.EntertainmentSportRecreation = budgetPost.recreation;
            budget.EntertainmentLunches         = budgetPost.diningOut;
            budget.EntertainmentOther           = budgetPost.otherEntertainmentCost;
            budget.CreatedAt                    = DateTime.Now;
            return(budget);
        }
 public ActionResult CheckMemberPendingRequest()
 {
     try
     {
         var user       = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
         var SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
         var avcExist   = context.AvcApplication.Where(m => m.MemberNumber == user.MemberNumber &&
                                                       m.SchemeCode == SchemeName)
                          .Where(m => m.HrApprovalStatus == 0)
                          .Select(x => x.Id)
                          .FirstOrDefault();
         if (!avcExist.Equals(0))
         {
             var data = new
             {
                 STATUS  = "1",
                 MESSAGE = "You have a pending request."
             };
             return(Json(data, JsonRequestBehavior.AllowGet));
         }
         else
         {
             var data = new
             {
                 STATUS  = "0",
                 MESSAGE = "You have no pending request."
             };
             return(Json(data, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         var data = new
         {
             STATUS  = "2",
             MESSAGE = "An error has occurred.",
             ERROR   = ex.Message
         };
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
 }
Beispiel #28
0
        private async Task <string> SendEmailConfirmationTokenAsync(string userID, string subject)
        {
            string code = await UserManager.GenerateEmailConfirmationTokenAsync(userID);

            var user = await UserManager.FindByIdAsync(userID);

            System.Web.Mvc.UrlHelper Url = new System.Web.Mvc.UrlHelper(HttpContext.Current.Request.RequestContext, RouteTable.Routes);
            var callbackUrl = Url.Action("ConfirmEmail", "Account",
                                         new { userId = userID, code = code }, protocol: HttpContext.Current.Request.Url.Scheme);
            var message = await PensionSetup.EmailTemplate("_Email");

            var Username = PensionSetup.GetMemberNamesAsync(user.Email, user);

            message = message.Replace("@ViewBag.Name", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Username));
            //message = message.Replace("@ViewBag.Link", "intent:#Intent;action=ke.co.synobrain.alexanderforbes;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;S.msg_from_browser=Launched%20from%20Browser;end");
            message = message.Replace("@ViewBag.Link", callbackUrl);
            message = message.Replace("@ViewBag.Subject", subject);
            await UserManager.SendEmailAsync(userID, subject, message);

            return(callbackUrl);
        }
Beispiel #29
0
        private decimal GetAnnuityFactor(string gender, int age)
        {
            var    user       = UserManager.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            string SchemeName = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);

            AnnuityFactors_Service annuityFactors_Service = new AnnuityFactors_Service();

            annuityFactors_Service.Url = "http://" + PensionSetup.ServerName + ":" + PensionSetup.ServerPort + "/" + PensionSetup.ServerInstance + "/WS/" + SchemeName + "/Page/AnnuityFactors";
            annuityFactors_Service.UseDefaultCredentials = false;
            annuityFactors_Service.Credentials           = new NetworkCredential(SoapUser, SoapPass);

            AnnuityFactors[] factors = annuityFactors_Service.ReadMultiple(null, null, 0);

            decimal annuityFactor = 0;

            if (gender.ToLower() == "male" || gender.ToLower() == "m")
            {
                if (age < 20 || age > 114)
                { //age out of range
                    return(0);
                }
                else
                {
                    annuityFactor = factors.Where(a => a.Age == age).Select(a => a.Male_Factor).FirstOrDefault();
                }
            }
            else
            {
                if (age < 20 || age > 116)
                { //age out of range
                    return(0);
                }
                else
                {
                    annuityFactor = factors.Where(a => a.Age == age).Select(a => a.Female_Factor).FirstOrDefault();
                }
            }
            return(annuityFactor);
        }
Beispiel #30
0
        public ClaimStatus[] GetClaims()
        {
            var    user            = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            string SchemeName      = PensionSetup.GetSchemeNameAsync(user.SponsorNumber);
            ClaimStatus_Service cs = new ClaimStatus_Service();

            cs.Url = "http://" + PensionSetup.ServerName + ":" +
                     PensionSetup.ServerPort + "/" +
                     PensionSetup.ServerInstance + "/WS/" +
                     SchemeName + "/Page/ClaimStatus";
            cs.UseDefaultCredentials = false;
            cs.Credentials           = new NetworkCredential(PensionSetup.SoapUsername, PensionSetup.SoapPassword);
            ClaimStatus_Filter        filter  = new ClaimStatus_Filter();
            List <ClaimStatus_Filter> filters = new List <ClaimStatus_Filter>();

            filter.Field    = ClaimStatus_Fields.Sponsor;
            filter.Criteria = user.SponsorNumber;
            filters.Add(filter);

            ClaimStatus[] claims = cs.ReadMultiple(filters.ToArray(), null, 0);
            return(claims);
        }