示例#1
0
        public DashboardVM GetDashboardSiteVM(string ParentFilter, string ChildFilter, DateTime fromDate, DateTime toDate, string Panel1Option, Int64 Panel1Value, string Panel2Option, Int64 Panel2Value, Int64 UserId, string FilterOption, int Offset, int PageSize, string CountryId, string Client = null, string Scopes = null, string Projects = null)
        {
            try
            {
                DashboardDL db = new DashboardDL();
                DataSet     ds = db.GetDashboardSites(ParentFilter, ChildFilter, fromDate, toDate, Panel1Option, Panel1Value, Panel2Option, Panel2Value, UserId, FilterOption, Offset, PageSize, CountryId, Client, Scopes, Projects);
                // DataTable TotalSites =;
                DataTable   DashboardData = ds.Tables[0];
                DashboardVM vm            = new DashboardVM();

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

                vm.ClientSites = ClientSites;
                if (ds.Tables.Count == 2)
                {
                    DataTable Count = ds.Tables[1];
                    vm.Count = (!string.IsNullOrEmpty(Count.Rows[0]["Count"].ToString())) ? Convert.ToInt32(Count.Rows[0]["Count"].ToString()) : 0;
                }

                return(vm);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#2
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;
            }
        }