Beispiel #1
0
        /// <summary>
        /// Sends the data XML.
        /// </summary>
        private void ProcessResponseData()
        {
            DataRequestEventArgs args = new DataRequestEventArgs(
                Request[_dymanicDataHandler],
                Request[_dymanicDataType],
                StartIndex,
                ItemCount,
                ColumnCount,
                Request[_columnKey],
                IsAscSort);

            switch (args.HandlerType)
            {
            case _handlerKeyDataSource:
                GetDataFromDataSource(args, DataSourceId);
                break;

            case _handlerKeyAjax:
                GetDataFromAJAXSource(args);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private void GetDataFromAJAXSource(DataRequestEventArgs args)
        {
            AJAXHandler handler = (AJAXHandler)FindControl(DataSourceId.Replace('_', '$'));

            if (handler != null && handler.ContentProcessor != null)
            {
                Response.Write(handler.ContentProcessor(args));
            }
        }
        /// <summary>
        /// Gets the data table.
        /// </summary>
        /// <returns></returns>
        public override DataTable GetDataTable(DataRequestEventArgs args)
        {
            if (DataTableSource == null)
            {
                return(null);
            }

            return(DataTableSource(args));
        }
Beispiel #4
0
        /// <summary>
        /// Raises the AJAXRequest event.
        /// </summary>
        /// <param name="args">The <see cref="NewWayMedia.Common.Controls.DataRequestEventArgs"/> instance containing the event data.</param>
        /// <returns></returns>
        protected virtual string OnAJAXRequest(DataRequestEventArgs args)
        {
            switch (handler.Action)
            {
            case actionKeySaveSettings:
                SaveSettings();
                break;

            default:
                break;
            }

            return(string.Empty);
        }
Beispiel #5
0
        /// <summary>
        /// Raises the    AJAXRequest event.
        /// </summary>
        /// <param name="args">The <see cref="NewWayMedia.Common.Controls.DataRequestEventArgs"/> instance containing the event data.</param>
        /// <returns></returns>
        protected override string OnAJAXRequest(DataRequestEventArgs args)
        {
            try
            {
                PageEx p      = Page as PageEx;
                int?   height = p.GetRequestInt("height");
                int?   width  = p.GetRequestInt("width");



                chart.Height = height ?? 250;
                chart.Width  = width ?? 250;

                switch (handler.Action)
                {
                case actionKeyApplyGraphType:
                    int?type = p.GetRequestInt("type");
                    settings.ChartType = (ChartType)(type ?? 0);
                    chartDashboardSettingsProvider.Save(settings, ClientID);
                    break;

                case actionKeyApplyTimeFrame:
                    int?timeFrame = p.GetRequestInt("frame");
                    settings.TimeFrameType = (TimeFrameType)(timeFrame ?? 0);
                    chartDashboardSettingsProvider.Save(settings, ClientID);
                    break;

                case actionKeyShow:
                    break;


                default:
                    return(base.OnAJAXRequest(args));
                }
                chart.Type      = settings.ChartType;
                chart.TimeFrame = settings.TimeFrameType;
                if (datasource != null)
                {
                    chart.DataSource = datasource();
                }

                return(ControlHelper.GetControlHtml(chart));
            }
            catch (Exception ex)
            {
                Util.Log.Error("OnAJAXRequest", ex);
            }
            return(string.Empty);
        }
Beispiel #6
0
 private void GetDataFromDataSource(DataRequestEventArgs args, string dataSourceId)
 {
     if (!string.IsNullOrEmpty(dataSourceId))
     {
         dataSourceId = dataSourceId.Replace('_', '$');
         DynamicGridDataSource dataSource = (DynamicGridDataSource)FindControl(dataSourceId);
         if (dataSource == null)
         {
             OnDataSourceNotFound(dataSourceId);
             dataSource = (DynamicGridDataSource)FindControl(dataSourceId);
         }
         if (dataSource != null)
         {
             Response.Write(dataSource.GetDataXml(args));
         }
     }
     else
     {
         OnGetGridXmlData(args);
     }
 }
Beispiel #7
0
        /// <summary>
        /// Gets the data XML.
        /// </summary>
        /// <returns></returns>
        public virtual string GetDataXml(DataRequestEventArgs args)
        {
            DataTable table = GetDataTable(args);


            StringBuilder builder = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(builder))
            {
                writer.WriteStartElement(RootElementName);
                writer.WriteAttributeString(PosAttrName, (args.StartIndex ?? 0).ToString());

                if (table != null)
                {
                    ProcessRows(writer, table.Rows);
                }

                writer.WriteEndElement();
            }

            return(builder.ToString());
        }
Beispiel #8
0
 /// <summary>
 /// Gets the data table.
 /// </summary>
 /// <returns></returns>
 public virtual DataTable GetDataTable(DataRequestEventArgs args)
 {
     return(null);
 }
Beispiel #9
0
 /// <summary>
 /// Is used to provide grid data
 /// </summary>
 /// <param name="args">The <see cref="NewWayMedia.Common.Controls.DataRequestEventArgs"/> instance containing the event data.</param>
 protected virtual void OnGetGridXmlData(DataRequestEventArgs args)
 {
     Response.Write(args.Output);
 }