Ejemplo n.º 1
0
 protected void DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.DataId == "odsInvoices")
     {
         e.Data = Invoices.CreateData();
     }
 }
        protected void OnDataLoading(object sender, DataLoadingWebEventArgs e)
        {
            SalesDetailsDataGenerator salesDetailsDataGenerator = new SalesDetailsDataGenerator(LoadData("DashboardSales"));

            salesDetailsDataGenerator.Generate();
            e.Data = salesDetailsDataGenerator.Data;
        }
 private void ASPxDashboardObjectDS_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.DataId == "objectDataSource")
     {
         e.Data = Invoices.CreateData();
     }
 }
 protected void ASPxDashboard1_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.DataId == "odsSales")
     {
         e.Data = SalesPersonData.CreateData();
     }
 }
Ejemplo n.º 5
0
 private static void DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.DataSourceName == "Object Data Source")
     {
         e.Data = Invoices.CreateData();
     }
 }
Ejemplo n.º 6
0
 private static void Default_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.DataId == "odsSales")
     {
         e.Data = CreateData();
     }
 }
Ejemplo n.º 7
0
        private static object GetData(DataLoadingWebEventArgs e)
        {
            var request       = HttpContext.Current.Request;
            var headers       = request.Headers;
            var idIndicador   = int.Parse(headers["filtro_id_indicador"]);
            var tipoIndicador = headers["filtro_tipo_indicador"];
            var fechaInicio   = DateTime.ParseExact(headers["filtro_fecha_inicio"], "yyyy-MM-dd", CultureInfo.InvariantCulture);
            var fechaFin      = DateTime.ParseExact(headers["filtro_fecha_fin"], "yyyy-MM-dd", CultureInfo.InvariantCulture);
            var idPlataforma  = headers["filtro_id_plataforma"];

            var result = new DataTable();
            var repo   = new TabIndicadorRepository();

            if (string.IsNullOrEmpty(tipoIndicador))
            {
                return(result);
            }
            if (tipoIndicador == "U")
            {
                if (idIndicador == 2)
                {
                    result = repo.ListarResultIndicator_Ind2(idIndicador, fechaInicio, fechaFin);
                }
                else
                {
                    result = repo.ListarResultIndicator_Ind(idIndicador, fechaInicio, fechaFin);
                }
            }

            return(result);
        }
Ejemplo n.º 8
0
 private void Dashboard1_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     // Fires when data source is requested and not found locally within the wrapped dashboard.
     if (e.DataSourceName == "Object Data Source")
     {
         e.Data = SalesPersonData.CreateDataWithDataTable();
     }
 }
Ejemplo n.º 9
0
 void DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.Data == null)
     {
         var dsType = Definition.DashboardTypes.First(t => t.Caption == e.DataSourceName).Type;
         e.Data = _objectSpace.CreateDashboardDataSource(dsType);
     }
 }
Ejemplo n.º 10
0
 void DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.Data == null)
     {
         var dsType = Definition.DashboardTypes.First(t => t.GetDefaultCaption() == e.DataSourceName).Type;
         e.Data = Application.CreateDashboardDataSource(dsType);
     }
 }
Ejemplo n.º 11
0
 void DataLoading(object sender, DataLoadingWebEventArgs e) {
     if (e.Data == null){
         var typeWrapper = Definition.DashboardTypes.FirstOrDefault(t => t.GetDefaultCaption() == e.DataSourceName);
         if (typeWrapper != null){
             var dsType = typeWrapper.Type;
             e.Data = Application.CreateDashboardDataSource(dsType);
         }
     }
 }
Ejemplo n.º 12
0
 void dashboard_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (DataLoading != null)
     {
         Application.Update(this, () =>
         {
             DataLoading(sender, e);
         });
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// The dashboard viewer on data loading.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void AsPxDashboardViewer1OnDataLoading(object sender, DataLoadingWebEventArgs e)
        {
            var hotel = this.Session["Hotel"] as Hotel;

            this.billingController = new BillingEntityController();
            var billingList = hotel == null
                ? this.billingController.RefreshEntities().ToList()
                : this.billingController.RefreshEntities().Where(x => x.Booking.Room.HotelId == hotel.Id).ToList();

            e.Data = billingList;
        }
 protected void dashboardViewer1_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.DataSourceName == "LlamadaServicio")
     {
         e.Data = Session["LlamadaServicio"];
     }
     else if (e.DataSourceName == "LlamadaServicioTecnico")
     {
         e.Data = Session["LlamadaServicioTecnico"];
     }
 }
Ejemplo n.º 15
0
        // Conditional data loading for ObjectDataSource
        private void DashboardConfigurator_DataLoading(object sender, DataLoadingWebEventArgs e)
        {
            var userName = contextAccessor.HttpContext.Session.GetString("CurrentUser");

            if (e.DataId == "odsSales")
            {
                if (userName == "Admin")
                {
                    e.Data = SalesData.GetSalesData();
                }
                else if (userName == "User")
                {
                    e.Data = SalesData.GetSalesDataLimited();
                }
            }
        }
Ejemplo n.º 16
0
        // Conditional data loading for ObjectDataSource
        private static void DashboardConfigurator_DataLoading(object sender, DataLoadingWebEventArgs e)
        {
            var userName = (string)HttpContext.Current.Session["CurrentUser"];

            if (e.DataId == "odsSales")
            {
                if (userName == "Admin")
                {
                    e.Data = SalesData.GetSalesData();
                }
                else if (userName == "User")
                {
                    e.Data = SalesData.GetSalesDataLimited();
                }
            }
        }
Ejemplo n.º 17
0
 protected void dashboardViewer1_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     if (e.DataSourceName == "Ventas")
     {
         e.Data = Session["Ventas"];
     }
     else if (e.DataSourceName == "Producto")
     {
         e.Data = Session["Producto"];
     }
     else if (e.DataSourceName == "Orden")
     {
         e.Data = Session["Orden"];
     }
     else if (e.DataSourceName == "Cotizacion")
     {
         e.Data = Session["Cotizacion"];
     }
 }
Ejemplo n.º 18
0
        protected void ASPxDashboard1_DataLoading(object sender, DataLoadingWebEventArgs e)
        {
            if (e.DataId.StartsWith("ods|"))
            {
                string[] names = e.DataId.Split("|".ToCharArray());
                List <DashboardSqlDataSource> dataSources = (List <DashboardSqlDataSource>)Session["ds" + e.DashboardId];
                DashboardSqlDataSource        dataSource  = dataSources.First(ds => ds.ComponentName == names[1]);
                SqlQuery query = dataSource.Queries.First(q => q.Name == names[2]);

                XElement dsXML = dataSource.SaveToXml();
                DevExpress.DataAccess.Sql.SqlDataSource sqlDS = new DevExpress.DataAccess.Sql.SqlDataSource();
                sqlDS.LoadFromXml(dsXML);
                sqlDS.ConnectionName = dataSource.ConnectionName;
                sqlDS.Fill(query.Name);

                ResultSet   rSet   = ((IListSource)sqlDS).GetList() as ResultSet;
                ResultTable rTable = rSet.Tables.First(t => t.TableName == query.Name);

                if (query.Name == "Invoices")
                {
                    var dt = ConvertResultTableToDataTable(rTable);
                    for (int i = dt.Rows.Count - 1; i >= 0; i--)
                    {
                        if (((DateTime)dt.Rows[i]["OrderDate"]).Year < 2016)
                        {
                            dt.Rows.RemoveAt(i);
                        }
                    }
                    e.Data = dt;
                }
                else
                {
                    e.Data = rTable;
                }
            }
        }
 protected void ASPxDashboard1_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     //if(e.DataId == "odsSales") {
     //    e.Data = ViewModel.CreateData();
     //}
 }
 protected void ASPxDashboard1_DataLoading(object sender, DataLoadingWebEventArgs e)
 {
     DashboardMainDemo.DataLoader.LoadData(e);
 }
Ejemplo n.º 21
0
 void DataLoading(object sender, DataLoadingWebEventArgs e) {
     if (e.Data == null) {
         var dsType = Definition.DashboardTypes.First(t => t.Caption == e.DataSourceName).Type;
         e.Data = _objectSpace.CreateDashboardDataSource(dsType);
     }
 }
Ejemplo n.º 22
0
 public static void DefaultOnDataLoading(object sender, DataLoadingWebEventArgs e)
 {
     //if (e.DataSourceName == DashboardUtilities.OBJECT_DATASOURCE_NAME) {
     e.Data = GetData(e);
 }
Ejemplo n.º 23
0
        public static void LoadData(DataLoadingWebEventArgs e)
        {
            switch (e.DataSourceComponentName)
            {
            case "siteVisitosDataSource":
                WebsiteStatisticsDataGenerator data = new WebsiteStatisticsDataGenerator();
                e.Data = data.WebsiteStatistics;
                break;

            case "dsMonthlySales":
                SalesPerformanceDataGenerator dataGeneratorMS = new SalesPerformanceDataGenerator(LoadSales());
                dataGeneratorMS.Generate();
                e.Data = dataGeneratorMS.MonthlySales;
                break;

            case "dsTotalSales":
                SalesPerformanceDataGenerator dataGeneratorTS = new SalesPerformanceDataGenerator(LoadSales());
                dataGeneratorTS.Generate();
                e.Data = dataGeneratorTS.TotalSales;
                break;

            case "dsKeyMetrics":
                SalesPerformanceDataGenerator dataGeneratorKM = new SalesPerformanceDataGenerator(LoadSales());
                dataGeneratorKM.Generate();
                e.Data = dataGeneratorKM.KeyMetrics;
                break;

            case "dsEmployees":
                HumanResourcesData humanResourcesDataEmployees = new HumanResourcesData(LoadEmployees());
                e.Data = humanResourcesDataEmployees.EmployeeData;
                break;

            case "dsDepartments":
                HumanResourcesData humanResourcesDataDepartments = new HumanResourcesData(LoadEmployees());
                e.Data = humanResourcesDataDepartments.DepartmentData;
                break;

            case "dsCountries":
                e.Data = EnergyStaticticsDataHelper.Generate(LoadEuroEnergyStatistics());
                break;

            case "dsSales":
                SalesOverviewDataGenerator salesOverviewDataGenerator = new SalesOverviewDataGenerator(LoadSales());
                salesOverviewDataGenerator.Generate();
                e.Data = salesOverviewDataGenerator.Data;
                break;

            case "dsSalesDetails":
                SalesDetailsDataGenerator salesDetailsDataGenerator = new SalesDetailsDataGenerator(LoadSales());
                salesDetailsDataGenerator.Generate();
                e.Data = salesDetailsDataGenerator.Data;
                break;

            case "dsStatistics":
                e.Data = RevenueByIndustryDataHelper.Generate(LoadRevenueByIndustry());
                break;

            case "dsRevenueAnalysis":
                RevenueAnalysisDataGenerator revenueAnalysisDataGenerator = new RevenueAnalysisDataGenerator(LoadSales());
                revenueAnalysisDataGenerator.Generate();
                e.Data = revenueAnalysisDataGenerator.Data;
                break;

            case "dsCustomerSupport":
                CustomerSupportData customerSupportData = new CustomerSupportData(LoadCustomerSupport(), LoadEmployees());
                e.Data = customerSupportData.CustomerSupport;
                break;

            case "dsConsumptionTotal":
                e.Data = EnergyConsumptionDataHelper.GenerateTotal(LoadEnergyConsumptionTotal());
                break;

            case "dsConsumptionBySector":
                e.Data = EnergyConsumptionDataHelper.GenerateBySector(LoadEnergyConsumptionBySector());
                break;
            }
        }
        /// <summary>
        /// Provides data to the datasources
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void m_DashboardViewer_DataLoading(object sender, DataLoadingWebEventArgs e)
        {
            string      componentName  = String.Empty;
            string      dataSourceName = String.Empty;
            object      dataCollection = null;
            Preferences subkey         = null;

            //
            // Get the information about the datasource
            //
            componentName  = e.DataSourceComponentName;
            dataSourceName = e.DataSourceName;

            /*
            ** Check if this is a JAMS DataSource and if so, load the data.
            */
            try
            {
                //
                // We must have a preferences object to load JAMS datasources
                //
                if (m_Preferences != null)
                {
                    // Get the Preferences subkey for this datasource
                    subkey = m_Preferences.OpenSubKey(dataSourceName);

                    if (subkey != null)
                    {
                        // History datasource
                        if (componentName.StartsWith("HistoryDS"))
                        {
                            //
                            // Load each History parameter from Preferences and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string folderName           = GetParameterValue(subkey, "QueryFolderName", @"\");
                            string jobName              = GetParameterValue(subkey, "QueryJobName", "*");
                            string setupName            = GetParameterValue(subkey, "QuerySetupName", "*");
                            string startDateRaw         = GetParameterValue(subkey, "QueryStartDate", "Today");
                            string startTime            = GetParameterValue(subkey, "QueryStartTime", "00:00:00.00");
                            string endDateRaw           = GetParameterValue(subkey, "QueryEndDate", "Tomorrow");
                            string endTime              = GetParameterValue(subkey, "QueryEndTime", "00:00:00.00");
                            string withinDelta          = GetParameterValue(subkey, "QueryWithin", "0");
                            string includeSuccess       = GetParameterValue(subkey, "QueryIncludeSuccess", "true");
                            string includeInfo          = GetParameterValue(subkey, "QueryIncludeInfo", "true");
                            string includeWarning       = GetParameterValue(subkey, "QueryIncludeWarning", "true");
                            string includeError         = GetParameterValue(subkey, "QueryIncludeError", "true");
                            string includeFatal         = GetParameterValue(subkey, "QueryIncludeFatal", "true");
                            string checkSched           = GetParameterValue(subkey, "QueryCheckSched", "true");
                            string checkHold            = GetParameterValue(subkey, "QueryCheckHold", "true");
                            string checkStart           = GetParameterValue(subkey, "QueryCheckStart", "true");
                            string checkCompletion      = GetParameterValue(subkey, "QueryCheckCompletion", "true");
                            string searchRecursivelyRaw = GetParameterValue(subkey, "QuerySearchRecursively", "true");
                            bool   useDates             = subkey.GetBoolean("QueryUseDates", true);

                            DateTime           startDate            = DateTime.MinValue;
                            DateTime           endDate              = DateTime.MinValue;
                            bool               searchRecursively    = Boolean.Parse(searchRecursivelyRaw);
                            ComparisonOperator searchFolderOperator = ComparisonOperator.MatchFolder;

                            //
                            // Determine the Start & End dates based either on the WithinTime or date range
                            //
                            if (useDates)
                            {
                                startDate  = Date.Evaluate(startDateRaw, Server).Date;
                                startDate += Date.Evaluate(startTime, Server).TimeOfDay;

                                endDate  = Date.Evaluate(endDateRaw, Server).Date;
                                endDate += Date.Evaluate(endTime, Server).TimeOfDay;
                            }
                            else
                            {
                                //
                                //  They are using the "Within..." controls,
                                //  the end date is right now and the start date is the current time minus the delta.
                                //
                                startDate = DateTime.Now - DeltaTime.Parse(withinDelta).TimeSpan;
                                endDate   = DateTime.Now;
                            }

                            //
                            // Add History Search Criteria
                            //
                            List <HistorySelection> selectionList = new List <HistorySelection>();
                            selectionList.Add(new HistorySelection(HistorySelectionField.JobName, ComparisonOperator.Like, jobName));
                            selectionList.Add(new HistorySelection(HistorySelectionField.SetupName, ComparisonOperator.Like, setupName));

                            if (searchRecursively)
                            {
                                searchFolderOperator = ComparisonOperator.MatchFolderRecursively;
                            }
                            selectionList.Add(new HistorySelection(HistorySelectionField.FolderName, searchFolderOperator, folderName));


                            //
                            // Query History using the supplied values
                            //
                            dataCollection = JAMS.History.Find(selectionList,
                                                               startDate,
                                                               endDate,
                                                               Boolean.Parse(includeSuccess),
                                                               Boolean.Parse(includeInfo),
                                                               Boolean.Parse(includeWarning),
                                                               Boolean.Parse(includeError),
                                                               Boolean.Parse(includeFatal),
                                                               Boolean.Parse(checkSched),
                                                               Boolean.Parse(checkHold),
                                                               Boolean.Parse(checkStart),
                                                               Boolean.Parse(checkCompletion),
                                                               HistorySearchOptions.None,
                                                               Server);
                        }
                        else if (componentName.StartsWith("CompletionsBySeverityDS"))
                        {
                            DateTime  startDate        = DateTime.Now;
                            DeltaTime lookbackInterval = DeltaTime.Zero;

                            //
                            // Load the lookbackInterval from Preferences and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string lookbackIntervalRaw = GetParameterValue(subkey, "QueryLookBackInterval", "00:00:00.00");

                            //
                            // The startDate will be the current time minus the lookback interval
                            //
                            if (DeltaTime.TryParse(lookbackIntervalRaw, out lookbackInterval))
                            {
                                startDate = startDate.Subtract(lookbackInterval.ToTimeSpan());
                            }

                            //
                            // Retrieve the completion data that occured within 24 hours before the startDate
                            //
                            dataCollection = Statistics.GetCompletionsBySeverity(startDate, Server);
                        }
                        else if (componentName.StartsWith("QueueDS"))
                        {
                            //
                            // Load the BatchQueue mask parameter and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string queueMask = GetParameterValue(subkey, "QueryQueueName", "*");

                            //
                            // Retrieve the queue data
                            //
                            dataCollection = BatchQueue.Find(queueMask, Server);
                        }
                        else if (componentName.StartsWith("ResourceDS"))
                        {
                            //
                            // Load the Resource mask parameter and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string resourceMask = GetParameterValue(subkey, "QueryResourceName", "*");

                            //
                            // Retrieve the Resource data
                            //
                            dataCollection = Resource.Find(resourceMask, Server);
                        }
                        else if (componentName.StartsWith("AgentDS"))
                        {
                            //
                            // Load the Agent mask parameter and if the value starts with '$'
                            //  try to get the value from a matching Dashboard parameter.
                            //
                            string agentMask = GetParameterValue(subkey, "QueryAgentName", "*");

                            //
                            // Retrieve the Agent data
                            //
                            dataCollection = Agent.Find(agentMask, Server);
                        }
                        else if (componentName.StartsWith("PowerShellDS"))
                        {
                            dataCollection = GetPowerShellDataSourceData(subkey);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (dataCollection != null)
            {
                e.Data = dataCollection;
            }
        }