예제 #1
0
        public DashboardVM GetDashboardVM(string ParentFilter, string ChildFilter, DateTime fromDate, DateTime toDate, DataTable dtCiteies, string Panel1Option, Int64 Panel1Value, string Panel2Option, Int64 Panel2Value, Int64 UserId, string CountryId, string Client, string Scopes, string Markets, string Projects)
        {
            try
            {
                DashboardDL db = new DashboardDL();
                DataSet     ds = db.GetDashboardData(ParentFilter, ChildFilter, fromDate, toDate, dtCiteies, Panel1Option, Panel1Value, Panel2Option, Panel2Value, UserId, CountryId, Client, Scopes, Markets, Projects);
                // DataTable TotalSites =;
                DataTable   DashboardData = ds.Tables[1];
                DashboardVM vm            = new DashboardVM();

                ClientSitesVM ClientSites = new ClientSitesVM();
                ClientSites.Sites = GetSitesFromTable(ds.Tables[0]);

                vm.ClientSites = ClientSites;

                ClientSites.Markers = GetSitesFromTable(ds.Tables[4]);



                DashboardStatusVM SiteStatuses = new DashboardStatusVM();

                SiteStatuses.TotalSites        = Convert.ToInt32(DashboardData.Rows[0]["TotalSites"] is DBNull ? 0 : DashboardData.Rows[0]["TotalSites"]);
                SiteStatuses.PendingSites      = Convert.ToInt32(DashboardData.Rows[0]["PendingSites"] is DBNull ? 0 : DashboardData.Rows[0]["PendingSites"]);
                SiteStatuses.InProcessSites    = Convert.ToInt32(DashboardData.Rows[0]["InProcessSites"] is DBNull ? 0 : DashboardData.Rows[0]["InProcessSites"]);
                SiteStatuses.CompletedSites    = Convert.ToInt32(DashboardData.Rows[0]["CompletedSites"] is DBNull ? 0 : DashboardData.Rows[0]["CompletedSites"]);
                SiteStatuses.DriveCompleted    = Convert.ToInt32(DashboardData.Rows[0]["DriveCompletedSites"] is DBNull ? 0 : DashboardData.Rows[0]["DriveCompletedSites"]);
                SiteStatuses.PendingWithIssues = Convert.ToInt32(DashboardData.Rows[0]["PendingWithIssuesSites"] is DBNull ? 0 : DashboardData.Rows[0]["PendingWithIssuesSites"]);
                SiteStatuses.InProgress        = Convert.ToInt32(DashboardData.Rows[0]["InProgress"] is DBNull ? 0 : DashboardData.Rows[0]["InProgress"]);
                SiteStatuses.ReportSubmitted   = Convert.ToInt32(DashboardData.Rows[0]["ReportSubmitted"] is DBNull ? 0 : DashboardData.Rows[0]["ReportSubmitted"]);

                vm.SiteStatuses = SiteStatuses;

                List <RegionsVM> regionVm = GetRegionalSitesFromTable(ds.Tables[2]);
                List <RegionsVM> testerVm = GetTesterSitesFromTable(ds.Tables[3]);

                //  List<RegionsVM> driveTesterVm = GetTesterSitesFromTable(ds.Tables[3]);// GetDriveTesterSitesFromTable(ds.Tables[4]);

                vm.Regions          = regionVm;
                vm.TesterSites      = testerVm;
                vm.DriveTesterSites = testerVm;


                return(vm);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public DashboardVM GetProjectDashboardVM(string ParentFilter, string ChildFilter, DateTime fromDate, DateTime toDate, DataTable dtCiteies, string Panel1Option, Int64 Panel1Value, string Panel2Option, Int64 Panel2Value, Int64 UserId, string CountryId, string Client, string Scopes, string Markets)
        {
            try
            {
                DashboardDL db = new DashboardDL();
                DataSet     ds = db.GetProjectDashboardData(ParentFilter, ChildFilter, fromDate, toDate, dtCiteies, Panel1Option, Panel1Value, Panel2Option, Panel2Value, UserId, CountryId, Client, Scopes, Markets);

                DashboardVM vm = new DashboardVM();

                DataTable DashboardData = ds.Tables[0];
                DataTable dtSiteWO      = ds.Tables[1];


                DashboardStatusVM SiteStatuses = new DashboardStatusVM();
                SiteStatuses.TotalSites        = Convert.ToInt32(DashboardData.Rows[0]["TotalSites"] is DBNull ? 0 : DashboardData.Rows[0]["TotalSites"]);
                SiteStatuses.PendingSites      = Convert.ToInt32(DashboardData.Rows[0]["PendingSites"] is DBNull ? 0 : DashboardData.Rows[0]["PendingSites"]);
                SiteStatuses.InProcessSites    = Convert.ToInt32(DashboardData.Rows[0]["InProcessSites"] is DBNull ? 0 : DashboardData.Rows[0]["InProcessSites"]);
                SiteStatuses.CompletedSites    = Convert.ToInt32(DashboardData.Rows[0]["CompletedSites"] is DBNull ? 0 : DashboardData.Rows[0]["CompletedSites"]);
                SiteStatuses.DriveCompleted    = Convert.ToInt32(DashboardData.Rows[0]["DriveCompletedSites"] is DBNull ? 0 : DashboardData.Rows[0]["DriveCompletedSites"]);
                SiteStatuses.PendingWithIssues = Convert.ToInt32(DashboardData.Rows[0]["PendingWithIssuesSites"] is DBNull ? 0 : DashboardData.Rows[0]["PendingWithIssuesSites"]);
                SiteStatuses.InProgress        = Convert.ToInt32(DashboardData.Rows[0]["InProgress"] is DBNull ? 0 : DashboardData.Rows[0]["InProgress"]);
                SiteStatuses.ReportSubmitted   = Convert.ToInt32(DashboardData.Rows[0]["ReportSubmitted"] is DBNull ? 0 : DashboardData.Rows[0]["ReportSubmitted"]);
                vm.SiteStatuses = SiteStatuses;


                if (dtSiteWO != null && dtSiteWO.Rows.Count > 0)
                {
                    for (int i = 0; i < dtSiteWO.Rows.Count; i++)
                    {
                        SitesVM sv = new SitesVM();
                        sv.SubmittedOn = Convert.ToDateTime(dtSiteWO.Rows[i]["Date"].ToString());
                        sv.SiteCount   = int.Parse(dtSiteWO.Rows[i]["SiteCount"].ToString());
                        vm.lstSiteWO.Add(sv);
                    }
                }
                return(vm);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }