public async Task <ActionResult> TransactionHistory()
        {
            string Url3 = "http://fpmlwebsvr.fidelitypensionmanagers.com/TheHubRestService/MobileRestService.svc/ContributionDetails/pen100323137466/2019-01-01/2019-07-01";

            var contentCDR = await client.GetStringAsync(Url3);

            var dataCDR = JsonConvert.DeserializeObject <Root>(contentCDR).ContributionDetailsResult;

            List <ContributionDetailsResultViewModel> vIewModelCDR = new List <ContributionDetailsResultViewModel>();

            for (int i = 0; i < dataCDR.Count; i++)
            {
                var model = new ContributionDetailsResultViewModel();

                model.EmployeeContribution = dataCDR[i]["EmployeeContribution"].ToString();
                model.EmployerContribution = dataCDR[i]["EmployerContribution"].ToString();
                model.Narration            = dataCDR[i]["Narration"].ToString();
                model.AvcContribution      = dataCDR[i]["AVCContribution"].ToString();
                model.EmployerName         = dataCDR[i]["EmployerName"].ToString();
                model.AvcWithdrawal        = dataCDR[i]["AvcWithdrawal"].ToString();
                model.ContributionDate     = dataCDR[i]["ContributionDate"].ToString();
                model.Price      = dataCDR[i]["Price"].ToString();
                model.TotalFee   = dataCDR[i]["TotalFee"].ToString();
                model.ValueDate  = dataCDR[i]["ValueDate"].ToString();
                model.Withdrawal = dataCDR[i]["Withdrawal"].ToString();
                model.VatFee     = dataCDR[i]["VatFee"].ToString();

                vIewModelCDR.Add(model);
            }

            //Session["CntributionDetails"] = vIewModelCDR;
            ViewBag.ContributionDetails = vIewModelCDR;

            return(View());
        }
예제 #2
0
        //// GET: api/RestClient
        //public IQueryable<EMPLOYEE> GetEMPLOYEEs()
        //{
        //    return db.EMPLOYEEs;
        //}

        //// GET: api/RestClient/5
        //[ResponseType(typeof(EMPLOYEE))]
        //public IHttpActionResult GetEMPLOYEE(string id)
        //{
        //    EMPLOYEE eMPLOYEE = db.EMPLOYEEs.Find(id);
        //    if (eMPLOYEE == null)
        //    {
        //        return NotFound();
        //    }

        //    return Ok(eMPLOYEE);
        //}

        //// PUT: api/RestClient/5
        //[ResponseType(typeof(void))]
        //public IHttpActionResult PutEMPLOYEE(string id, EMPLOYEE eMPLOYEE)
        //{
        //    if (!ModelState.IsValid)
        //    {
        //        return BadRequest(ModelState);
        //    }

        //    if (id != eMPLOYEE.REGISTRATION_CODE)
        //    {
        //        return BadRequest();
        //    }

        //    db.Entry(eMPLOYEE).State = EntityState.Modified;

        //    try
        //    {
        //        db.SaveChanges();
        //    }
        //    catch (DbUpdateConcurrencyException)
        //    {
        //        if (!EMPLOYEEExists(id))
        //        {
        //            return NotFound();
        //        }
        //        else
        //        {
        //            throw;
        //        }
        //    }

        //    return StatusCode(HttpStatusCode.NoContent);
        //}

        //// POST: api/RestClient
        //[ResponseType(typeof(EMPLOYEE))]
        //public IHttpActionResult PostEMPLOYEE(EMPLOYEE eMPLOYEE)
        //{
        //    if (!ModelState.IsValid)
        //    {
        //        return BadRequest(ModelState);
        //    }

        //    db.EMPLOYEEs.Add(eMPLOYEE);

        //    try
        //    {
        //        db.SaveChanges();
        //    }
        //    catch (DbUpdateException)
        //    {
        //        if (EMPLOYEEExists(eMPLOYEE.REGISTRATION_CODE))
        //        {
        //            return Conflict();
        //        }
        //        else
        //        {
        //            throw;
        //        }
        //    }

        //    return CreatedAtRoute("DefaultApi", new { id = eMPLOYEE.REGISTRATION_CODE }, eMPLOYEE);
        //}

        //// DELETE: api/RestClient/5
        //[ResponseType(typeof(EMPLOYEE))]
        //public IHttpActionResult DeleteEMPLOYEE(string id)
        //{
        //    EMPLOYEE eMPLOYEE = db.EMPLOYEEs.Find(id);
        //    if (eMPLOYEE == null)
        //    {
        //        return NotFound();
        //    }

        //    db.EMPLOYEEs.Remove(eMPLOYEE);
        //    db.SaveChanges();

        //    return Ok(eMPLOYEE);
        //}


        public async Task <ActionResult> GetContributionDetails(CancellationToken cancellationToken)
        {
            string Url = "http://fpmlwebsvr.fidelitypensionmanagers.com/TheHubRESTService/MobileRestService.svc/LastFiveTransactionsWeb/PEN100323137466";

            string Url3 = "http://fpmlwebsvr.fidelitypensionmanagers.com/TheHubRestService/MobileRestService.svc/ContributionDetails/pen100323137466/1/2019-01-01/2019-06-01";

            var content3 = await client.GetStringAsync(Url3);

            var data = JsonConvert.DeserializeObject <Root>(content3).ContributionDetailsResult;

            List <ContributionDetailsResultViewModel> vIewModel = new List <ContributionDetailsResultViewModel>();

            for (int i = 0; i < data.Count; i++)
            {
                var model = new ContributionDetailsResultViewModel();

                model.EmployeeContribution = data[i]["EmployeeContribution"].ToString();
                model.EmployerContribution = data[i]["EmployerContribution"].ToString();
                model.Narration            = data[i]["Narration"].ToString();
                model.AvcContribution      = data[i]["AVCContribution"].ToString();
                model.EmployerName         = data[i]["EmployerName"].ToString();
                model.AvcWithdrawal        = data[i]["AvcWithdrawal"].ToString();
                model.ContributionDate     = data[i]["ContributionDate"].ToString();
                model.Price      = data[i]["Price"].ToString();
                model.TotalFee   = data[i]["TotalFee"].ToString();
                model.ValueDate  = data[i]["ValueDate"].ToString();
                model.Withdrawal = data[i]["Withdrawal"].ToString();
                model.VatFee     = data[i]["VatFee"].ToString();

                vIewModel.Add(model);
            }


            //using (var request = new HttpRequestMessage(HttpMethod.Get, Url3))
            //using (var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken))
            //{
            //    var stream = await response.Content.ReadAsStreamAsync();

            //    if (response.IsSuccessStatusCode)
            //    {
            //        var dataa = DeserializeJsonFromStream<Root>(stream).LastFiveTransactionsWebResult;
            //        return Json(dataa, JsonRequestBehavior.AllowGet);
            //    }
            //    //  var content = await StreamToStringAsync(stream);

            //}
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        // GET: iPension/RSAClientPortal
        public async Task <ActionResult> Index(CancellationToken cancellationToken)
        {
            // var DataResult = restClient.GetContributionDetails(cancellationToken).Result;

            var userPin = User.Identity.Name;

            string Url = $"http://fpmlwebsvr.fidelitypensionmanagers.com/TheHubRESTService/MobileRestService.svc/LastFiveTransactionsWeb/{userPin}";

            var content3 = await client.GetStringAsync(Url);

            var data = JsonConvert.DeserializeObject <Root>(content3).LastFiveTransactionsWebResult;

            List <Last5TransactionViewModel> vIewModel = new List <Last5TransactionViewModel>();

            for (int i = 0; i < data.Count; i++)
            {
                var model = new Last5TransactionViewModel();

                model.EmployeeContribution = data[i]["EmployeeContribution"].ToString();
                model.EmployerContribution = data[i]["EmployerContribution"].ToString();
                model.Narration            = data[i]["Narration"].ToString();
                model.OtherContribution    = data[i]["OtherContribution"].ToString();
                model.ValueDate            = data[i]["ValueDate"].ToString();

                vIewModel.Add(model);
            }
            ViewBag.Last5Transaction = vIewModel;

            string Url_Balance = $"http://fpmlwebsvr.fidelitypensionmanagers.com/TheHubRESTService/MobileRestService.svc/Balance/{userPin}";

            var content_Balance = await client.GetStringAsync(Url_Balance);

            var data_Balance = JsonConvert.DeserializeObject <Root>(content_Balance).BalanceResult;

            ViewBag.RsaBalance = data_Balance["RsaBalance"].ToString();
            ViewBag.VcBalance  = data_Balance["VCBalance"] == null ? "₦0.00" : data_Balance["VCBalance"].ToString();

            Logger.DebugFormat($"Process call to get last 5 transaction was succesfull.");


            using (var request = new HttpRequestMessage(HttpMethod.Get, Url))
                using (var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken))
                {
                    var stream = await response.Content.ReadAsStreamAsync();

                    if (response.IsSuccessStatusCode)
                    {
                        var dataa = DeserializeJsonFromStream <Root>(stream).LastFiveTransactionsWebResult;
                    }
                    //  var content = await StreamToStringAsync(stream);
                }


            string Url3 = "http://fpmlwebsvr.fidelitypensionmanagers.com/TheHubRestService/MobileRestService.svc/ContributionDetails/pen100323137466/2019-01-01/2019-06-01";

            var contentCDR = await client.GetStringAsync(Url3);

            var dataCDR = JsonConvert.DeserializeObject <Root>(contentCDR).ContributionDetailsResult;

            List <ContributionDetailsResultViewModel> vIewModelCDR = new List <ContributionDetailsResultViewModel>();

            for (int i = 0; i < dataCDR.Count; i++)
            {
                var model = new ContributionDetailsResultViewModel();

                model.EmployeeContribution = dataCDR[i]["EmployeeContribution"].ToString();
                model.EmployerContribution = dataCDR[i]["EmployerContribution"].ToString();
                model.Narration            = dataCDR[i]["Narration"].ToString();
                model.AvcContribution      = dataCDR[i]["AVCContribution"].ToString();
                model.EmployerName         = dataCDR[i]["EmployerName"].ToString();
                model.AvcWithdrawal        = dataCDR[i]["AvcWithdrawal"].ToString();
                model.ContributionDate     = dataCDR[i]["ContributionDate"].ToString();
                model.Price      = dataCDR[i]["Price"].ToString();
                model.TotalFee   = dataCDR[i]["TotalFee"].ToString();
                model.ValueDate  = dataCDR[i]["ValueDate"].ToString();
                model.Withdrawal = dataCDR[i]["Withdrawal"].ToString();
                model.VatFee     = dataCDR[i]["VatFee"].ToString();

                vIewModelCDR.Add(model);
            }

            Session["CntributionDetails"] = vIewModelCDR;

            //  var Data = await DeserializeOptimizedFromStreamCallAsync();
            //var Model = new EmployeeViewModel();

            //string Url = "http://localhost:5000/api/values";

            //using (var request = new HttpRequestMessage(HttpMethod.Get, Url))
            //using (var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead))
            //{
            //    var stream = await response.Content.ReadAsStreamAsync();

            //    if (response.IsSuccessStatusCode)
            //        return DeserializeJsonFromStream<List<EmployeeViewModel>>(stream);

            //    var content = await StreamToStringAsync(stream);
            //    throw new ApiException { StatusCode = (int)response.StatusCode, Content = content };
            //}

            return(View());
        }