Example #1
0
        public ActionResult SystemDashboard()
        {
            try
            {
                dynamic response = JObject.Parse(GetResponse(string.Format("/GetSystemDetails/{0}", "zoneA")));
                if (response.status > 0)
                {
                    DashboardInfo dashboardInfo = JsonConvert.DeserializeObject <DashboardInfo>(response.data.ToString());

                    var dashboardInfoFromDB = new DashboardInfo();
                    using (var ibisaRepository = new IBISARepository())
                    {
                        dashboardInfoFromDB.AgreementDetails = ibisaRepository.GetAgreements();
                    }

                    //if (dashboardInfo.AgreementDetails != null && dashboardInfo.AgreementDetails.Any())
                    //    dashboardInfo.totalUsers = dashboardInfo.AgreementDetails.Count;

                    if (dashboardInfo.AgreementDetails != null && dashboardInfoFromDB.AgreementDetails != null && dashboardInfo.AgreementDetails.Any() && dashboardInfoFromDB.AgreementDetails.Any())
                    {
                        dashboardInfoFromDB.AgreementDetails.ForEach(x =>
                        {
                            var agreement = dashboardInfo.AgreementDetails.FirstOrDefault(i => i.wallet_address == x.wallet_address);
                            if (agreement != null)
                            {
                                agreement.agreementPrimaryId = x.agreementPrimaryId;
                                agreement.agreementNumber    = x.agreementNumber;
                                agreement.zone = x.zone;
                            }
                        });
                    }

                    return(View(dashboardInfo));
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.Log("Method: SystemDashboard()", ex);
            }

            return(View(new DashboardInfo()));
        }