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 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)); }
public static Member GetMemberDetailsAsync(string SchemeName, string MemberNumber) { 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 member = new Member(); return(service.Read(MemberNumber)); }
public Member MemberDetails() { var user = UserManager.Users.Where(x => x.UserName == User.Identity.Name).First(); string SchemeName = 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); return(details); }
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 decimal CalculateTax() { var user = UserManager.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault(); Member_Service service = new Member_Service(); service.UseDefaultCredentials = false; service.Credentials = new NetworkCredential(SoapUser, SoapPass); service.Url = "http://" + PensionSetup.ServerName + ":" + PensionSetup.ServerPort + "/" + PensionSetup.ServerInstance + "/WS/" + PensionSetup.GetSchemeNameAsync(user.SponsorNumber) + "/Page/Member"; Member details = new Member(); string memberNo = user.MemberNumber; details = service.Read(memberNo); var dateOfBirth = details.Date_of_Birth; var name = details.First_Name + " " + details.Last_Name; var dateJoinScheme = details.Join_Scheme_Date; var dateOfExitObj = dateOfBirth.AddYears(GetRetirementAge()); decimal serviceYRS = dateOfExitObj.Year - dateJoinScheme.Year; decimal taxFreeAmount = 0; decimal taxFree = 0; var taxTableCode = ""; if (serviceYRS >= 15) { taxFreeAmount = GetTaxBrackets(15).Annual_Tax_Free_Amount; taxFree = taxFreeAmount * serviceYRS; taxTableCode = GetTaxBrackets(15).Tax_Table_Code; } else { taxFreeAmount = GetTaxBrackets(0).Annual_Tax_Free_Amount; taxFree = taxFreeAmount * serviceYRS; taxTableCode = GetTaxBrackets(0).Tax_Table_Code; } var taxableAmt = (expectedBalance - taxFree); var lumpsumAmt = (expectedBalance); //$taxTableCode= 01; var taxTableBand = 1; var taxBandInfo = TaxBandsCalc(taxTableCode, taxTableBand); var rate = taxBandInfo.Rate; var nexttaxTableBand = taxTableBand + 1; var taxBandInfoLevel = TaxBandsCalc(taxTableCode, nexttaxTableBand); var rangeUpperlimit = taxBandInfoLevel.Upper_Limit; var taxBand1 = taxBandInfo.Taxable_Amount; decimal taxBand1Amt = 0; decimal taxableAmt2 = 0; var taxTableBand1 = 0; TaxBands taxBandInfo2; decimal taxBand2 = 0; decimal rate2 = 0; if (taxBand1 <= taxableAmt) { taxBand1Amt = taxBand1 * (rate / 100m); taxableAmt2 = taxableAmt - taxBand1; taxTableBand1 = taxTableBand + 1; taxBandInfo2 = TaxBandsCalc(taxTableCode, taxTableBand1); taxBand2 = taxBandInfo2.Taxable_Amount; rate2 = taxBandInfo.Rate; } else if (taxableAmt < taxBand1) { taxBand1Amt = taxableAmt * (rate / 100m); } //Tax Band 2 calculation decimal taxBand2Amt = 0; decimal taxableAmt3 = 0; var taxTableBand2 = 0; TaxBands taxBandInfo3; decimal taxBand3 = 0; decimal rate3 = 0; if (taxBand2 <= taxableAmt2) { taxBand2Amt = taxBand2 * (rate2 / 100m); taxableAmt3 = taxableAmt2 - taxBand2; taxTableBand2 = taxTableBand1 + 1; taxBandInfo3 = TaxBandsCalc(taxTableCode, taxTableBand2); taxBand3 = taxBandInfo3.Taxable_Amount; rate3 = taxBandInfo3.Rate; } else if (taxableAmt2 < taxBand2) { taxBand2Amt = taxableAmt2 * (rate2 / 100m); } decimal taxBand3Amt = 0; decimal taxableAmt4 = 0; var taxTableBand3 = 0; TaxBands taxBandInfo4; decimal taxBand4 = 0; decimal rate4 = 0; if (taxBand3 <= taxableAmt3) { taxBand3Amt = taxBand3 * (rate3 / 100m); taxableAmt4 = taxableAmt3 - taxBand3; taxTableBand3 = taxTableBand2 + 1; taxBandInfo4 = TaxBandsCalc(taxTableCode, taxTableBand3); taxBand4 = taxBandInfo4.Taxable_Amount; rate4 = taxBandInfo4.Rate; } else if (taxableAmt3 < taxBand3) { taxBand3Amt = taxableAmt3 * (rate3 / 100m); } decimal taxBand4Amt = 0; decimal taxableAmt5 = 0; var taxTableBand4 = 0; TaxBands taxBandInfo5; decimal taxBand5 = 0; decimal rate5 = 0; if (taxBand4 <= taxableAmt4) { taxBand4Amt = taxBand4 * (rate4 / 100m); taxableAmt5 = taxableAmt4 - taxBand4; taxTableBand4 = taxTableBand3 + 1; taxBandInfo5 = TaxBandsCalc(taxTableCode, taxTableBand4); taxBand5 = taxBandInfo5.Taxable_Amount; rate5 = taxBandInfo5.Rate; var taxBand9 = taxBandInfo5.Lower_Limit; var taxableAmt10 = lumpsumAmt - taxBand9; } else if (taxableAmt4 < taxBand4) { taxBand4Amt = taxableAmt4 * (rate4 / 100m); } //Any amount above this is subject to the same rate of this Tax Band decimal taxBand5Amt = 0; if (taxableAmt5 > 0) { //IF TO USE THE REAMINING AMOUNT AFTER TAX taxBand5Amt = taxableAmt5 * (rate5 / 100m); var taBandAmt4 = taxableAmt5 * (rate5 / 100m); //IF TO USE LOWER LIMIT OF THE LAST TAX BAND } decimal Total = taxBand1Amt + taxBand2Amt + taxBand3Amt + taxBand4Amt + taxBand5Amt; var totalTax = Total; return(totalTax); }