예제 #1
0
 protected void btn1_Click(object sender, EventArgs e)
 {
     ReportsDataSource.Insert();
     ReportsDataSource.DataBind();
     Label1.ForeColor = System.Drawing.Color.Green;
     Label1.Text      = "Your report has been submitted successfully!" + " To check the status access manage my report page";
     Button1.Visible  = true;
     Button2.Visible  = true;
 }
        public ReportSelectorController(PagedViewController pageController, bool getFinanceReport)
            : base(UITableViewStyle.Grouped, null)
        {
            this.pageController = pageController;
            reportSource = (ReportsDataSource)pageController.PagedViewDataSource;
            if (reportSource == null) {
                reportSource = new ReportsDataSource ();
            }
            Root = new RootElement ("");

            Autorotate = true;
            BuildInterface ();
            //get finance report upfront
            if (getFinanceReport) {
                reportType = FINANCIAL_STATUS;
                getAsyncReportData ();
            }
        }
        //        UIBarButtonItem btnClose;
        //        bool isStartingUp;
        //
        public ReportSelectorController(PagedViewController pageController, bool getFinanceReport)
            : base(UITableViewStyle.Grouped, null)
        {
            this.pageController = pageController;
            reportSource = (ReportsDataSource)pageController.PagedViewDataSource;
            if (reportSource == null) {
                reportSource = new ReportsDataSource ();
            }
            this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, delegate(object sender, EventArgs e) {
                this.NavigationController.PopViewControllerAnimated (true);
            });
            Root = new RootElement ("");

            Autorotate = true;
            BuildInterface ();
            //get finance report upfront
            if (getFinanceReport) {
                reportType = FINANCIAL_STATUS;
                getAsyncReportData ();
            }
        }
        /// <summary>
        /// Создает и заполняет DataSet
        /// </summary>
        private DataSet FillDataSet(List<DSRouterEventValue> events,
            Dictionary<Tuple<UInt16, UInt32, UInt32, string>, List<Tuple<DateTime, object>>> trends,
            Dictionary<DateTime, Tuple<object, object, object, object>> trendsWithFixStep)
        {
            var dataSet = new ReportsDataSource();

            if (events != null)
            {
                var eventsTable = dataSet.Tables["Events"];

                foreach (var dsRouterEvent in events)
                {
                    eventsTable.Rows.Add(dsRouterEvent.EventTime, dsRouterEvent.EventText);
                }
            }

            if (trends != null)
            {
                var tagsDescriptionTable = dataSet.Tables["TagsDescription"];
                var trendsValuesTable = dataSet.Tables["TrendsValues"];

                foreach (var trend in trends)
                {
                    var row = tagsDescriptionTable.Rows.Add(trend.Key.Item1, trend.Key.Item2, trend.Key.Item3, trend.Key.Item4);
                    var tagId = (int)row[4];

                    foreach (var trendValue in trend.Value)
                    {
                        trendsValuesTable.Rows.Add(tagId, trendValue.Item1, trendValue.Item2);
                    }
                }
            }

            if (trendsWithFixStep != null)
            {
                var fixTrendsValuesTable = dataSet.Tables["FixTrendsValues"];

                foreach (var tuple in trendsWithFixStep)
                {
                    fixTrendsValuesTable.Rows.Add(tuple.Key, tuple.Value.Item1, tuple.Value.Item2, tuple.Value.Item3, tuple.Value.Item4);
                }
            }

            return dataSet;
        }