Exemple #1
0
        private void chartSandCMovingAvg_Load(object sender, EventArgs e)
        {
            lqtChart1.Series["Input"].ChartType = SeriesChartType.Line;

            for (int i = 1; i < 4; i++)
            {
                lqtChart1.Legends["Default"].CustomItems[i].Cells[0].ImageTransparentColor = Color.Red;
            }

            lqtChart1.Legends["Default"].CustomItems[1].Cells[0].Image = Checked_Image_Path;
            lqtChart1.Legends["Default"].CustomItems[2].Cells[0].Image = Checked_Image_Path;
            // lqtChart1.Legends["Default"].CustomItems[3].Cells[0].Image = Checked_Image_Path;
            lqtChart1.Legends["Default"].CustomItems[3].Cells[0].Image = Checked_Image_Path;

            // Set tag property for all custom items to appropriate series
            lqtChart1.Legends["Default"].CustomItems[1].Tag = lqtChart1.Series["Simple"];
            lqtChart1.Legends["Default"].CustomItems[2].Tag = lqtChart1.Series["Exponential"];
            // lqtChart1.Legends["Default"].CustomItems[3].Tag = lqtChart1.Series["Triangular"];
            lqtChart1.Legends["Default"].CustomItems[3].Tag = lqtChart1.Series["Weighted"];

            _finfo = DataRepository.GetForecastInfoById(_ForecastId);
            if (_finfo.StatusEnum == ForecastStatusEnum.CLOSED)
            {
                doCalculations = true;
            }

            BindDataToChart();
        }
    public void GetForecast()
    {
        _yandexForecastURIBuilder.SetParameter(_geoIDname, _geoIDField.text);
        _yandexForecastURIBuilder.SetParameter("limit", 2);     //we get info for today and tomorrow
        _yandexForecastURIBuilder.SetParameter("hours", false); //we get info about day periods(not about every hour)
        using (UnityWebRequest request = UnityWebRequest.Get(_yandexForecastURIBuilder.GetURI()))
        {
            request.SetRequestHeader(_yandexKeyName, _yandexKeyValue);

            request.SendWebRequest();

            while (!request.isDone)
            {
            }

            if (!request.isNetworkError & !request.isHttpError)
            {
                forecast = JsonConvert.DeserializeObject <ForecastInfo>(request.downloadHandler.text);
                ShowForecast();
            }
            else
            {
                _cityText.text = request.error;
            }
        }
    }
        public async Task <List <List> > GetForecast()
        {
            var url    = $"http://api.openweathermap.org/data/2.5/forecast?q={Location}&appid=c276e11cf8bfc48f24c61bd35615ca70&units=metric";
            var result = await ApiColler.Get(url);

            if (result.Succsessful)
            {
                List <List> allList = new List <List>();
                try
                {
                    forecastInfo = JsonConvert.DeserializeObject <ForecastInfo>(result.Response);
                    if (forecastInfo != null)
                    {
                        foreach (var list in forecastInfo.list)
                        {
                            var date = DateTime.Parse(list.dt_txt);

                            if (date > DateTime.Now && date.Hour == 0 && date.Minute == 0 && date.Second == 0)
                            {
                                allList.Add(list);
                            }
                        }

                        DetailsPage.rain    = allList[0].rain;
                        DetailsPage.wind    = allList[0].wind;
                        DetailsPage.weather = allList[0].weather;
                        DetailsPage.clouds  = allList[0].clouds;
                        DetailsPage.main    = allList[0].main;

                        DetailsPage.rain2    = allList[1].rain;
                        DetailsPage.wind2    = allList[1].wind;
                        DetailsPage.weather2 = allList[1].weather;
                        DetailsPage.clouds2  = allList[1].clouds;
                        DetailsPage.main2    = allList[1].main;

                        CurrentWeatherConst.DayOneTxt  = DateTime.Parse(allList[0].dt_txt).ToString("dddd");
                        CurrentWeatherConst.DateOneTxt = DateTime.Parse(allList[0].dt_txt).ToString("dd MMM");
                        CurrentWeatherConst.IconOneImg = $"w{ allList[0].weather[0].icon}";
                        CurrentWeatherConst.TempOneTxt = allList[0].main.temp.ToString("0");


                        CurrentWeatherConst.DayTwoTxt  = DateTime.Parse(allList[1].dt_txt).ToString("dddd");
                        CurrentWeatherConst.DateTwoTxt = DateTime.Parse(allList[1].dt_txt).ToString("dd MMM");
                        CurrentWeatherConst.IconTwoImg = $"w{ allList[1].weather[0].icon}";
                        CurrentWeatherConst.TempTwoTxt = allList[1].main.temp.ToString("0");

                        // Mediator.Notify("GetCityWeatherScreen", Location);
                    }
                }
                catch /*(Exception ex)*/
                {
                    //await DisplayAlert("Weather Info", "Weather Info", ex.Message, "ok");
                }
                return(allList);
            }
            else
            {
                return(null);
            }
        }
        private async void GetForecastForCity()
        {
            HttpClient client = new HttpClient();

            Uri uri = new Uri("http://api.openweathermap.org/data/2.5/forecast?q=San+Marcos,us&units=imperial&APPID=d0d471a1a152669ddd200968f56c54a3");

            var response = await client.GetAsync(uri);

            ForecastInfo forecastData = null;

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();

                forecastData = ForecastInfo.FromJson(content);
                FiveDay      = forecastData;
            }
            int j = 0;

            for (int i = 0; i < 5; i++)
            {
                FiveDay.list[j].dt_txt = FiveDay.list[j].dt_txt.Substring(5, 5);

                j += 8;
            }
        }
Exemple #5
0
        public ImportSerForm(ForecastInfo finfo)
        {
            this._forecastInfo = finfo;
            InitializeComponent();

            txtForecastid.Text  = _forecastInfo.ForecastNo;
            txtPeriod.Text      = _forecastInfo.Period;
            txtSdate.Text       = _forecastInfo.StartDate.ToShortDateString();
            txtExtension.Text   = _forecastInfo.Extension.ToString();
            txtMethodology.Text = _forecastInfo.Methodology;
            txtDusage.Text      = _forecastInfo.DataUsage;

            if (_forecastInfo.DatausageEnum == DataUsageEnum.DATA_USAGE3)
            {
                lvImport.Columns.Remove(lvImport.Columns[2]);
                lvImport.Columns.Remove(lvImport.Columns[2]);

                _noColumn = 6;
            }
            else
            {
                lvImport.Columns.Remove(lvImport.Columns[1]);
                _noColumn = 7;
            }
        }
Exemple #6
0
        public ForecastInfo GetForecastInfoById(int id)
        {
            string sql = "SELECT SELECT [ForecastID], [ForecastDate], [StartingMonth], [StartingYear] ";

            sql += "FROM ForecastInfo where ForecastId = @Id ";
            sql += "SELECT [ForecastId], [FacilityId], [TestId], [Id], [TestType], [IsHistorical], [HistoricalValue], [ForecastValue], ";
            sql += " [DurationDateTime], [TotalForecastValue]  FROM ForecastedResult where ForecastId = @Id ";

            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                con.Open();

                using (SqlCommand cm = new SqlCommand(sql, con))
                {
                    DatabaseHelper.InsertInt32Param("@TestId", cm, id);

                    using (SqlDataReader dr = cm.ExecuteReader())
                    {
                        if (dr != null)
                        {
                            if (dr.HasRows)
                            {
                                dr.Read();
                                ForecastInfo test = FetchForecastInfo(dr);
                                FetchForecastedResult(dr, test);
                                return(test);
                            }
                        }
                    }
                }
            }
            return(null);
        }
        private DataSet GetSummary()
        {
            ForecastInfo _finfo = DataRepository.GetForecastInfoById(_ForecastId);
            SqlCommand   cmd    = cn.CreateCommand();

            cmd.CommandType = CommandType.StoredProcedure;

            if (_finfo.DatausageEnum == DataUsageEnum.DATA_USAGE1 || _finfo.DatausageEnum == DataUsageEnum.DATA_USAGE2)
            {
                if (_finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION)
                {
                    //consumption site
                    cmd.CommandText = "spConsumptionForecastTotalSummary";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@siteid", SqlDbType.Int).Value     = _siteorCatId;
                    _dataSet = new DataSet("spConsumptionForecastTotalSummary");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spConsumptionForecastTotalSummary");
                    _chartTitle = "Consumption Statistics Total Product Usage By Product Type";
                }
                else
                {
                    //service site
                    cmd.CommandText = "spServiceForecastNoofTestTotalSummary";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@siteid", SqlDbType.Int).Value     = _siteorCatId;
                    _dataSet = new DataSet("spServiceForecastNoofTestTotalSummary");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spServiceForecastNoofTestTotalSummary");
                    _chartTitle = "Service Statistics Total Test By TestingArea";
                }
            }
            else
            {
                if (_finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION)
                {
                    //consumption category
                    cmd.CommandText = "spConsumptionForecastTotalSummary";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@catid", SqlDbType.Int).Value      = _siteorCatId;
                    _dataSet = new DataSet("spConsumptionForecastTotalSummary");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spConsumptionForecastTotalSummary");
                    _chartTitle = "Consumption Statistics Total Product Usage By Product Type";
                }
                else
                {
                    //service category

                    cmd.CommandText = "spServiceForecastNoofTestTotalSummary";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@catid", SqlDbType.Int).Value      = _siteorCatId;
                    _dataSet = new DataSet("spServiceForecastNoofTestTotalSummary");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spServiceForecastNoofTestTotalSummary");
                    _chartTitle = "Service Statistics Total Test By TestingArea";
                }
            }
            return(_dataSet);
        }
Exemple #8
0
        public void BuildMeapResultView(IList <MAPEResult> maperesult, ForecastInfo finfo)
        {
            DataTable Maper = new DataTable();


            IEnumerable <MAPEResult> sortedMAPE     = maperesult.OrderBy(meap => meap.DurationDateTime);
            IList <MAPEResult>       sortedMAPEList = sortedMAPE.ToList();

            Maper = LqtUtil.ToDataTable <MAPEResult>(CorrectMapeResultDates(sortedMAPEList, finfo));
            string x = "";
            string y = "";
            string z = "";

            if (finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION)
            {
                y = Maper.Columns[4].ColumnName;//product
            }
            else
            {
                y = Maper.Columns[3].ColumnName; //test
            }
            x = Maper.Columns[11].ColumnName;    //duration

            z = Maper.Columns[8].ColumnName;     //mape percentage value

            DataTable newDt = new DataTable();

            newDt = PivotTable.GetInversedDataTable(Maper, x, y, z, "-", false);

            gdvmeapresult.DataSource = newDt;
        }
        private static ForecastInfo ParseForecast(ISQLiteStatement row)
        {
            var forecast = new ForecastInfo();

            for (int x = 0; x < row.ColumnCount; x++)
            {
                var columnLabel = row.ColumnName(x);
                if (typeof(ForecastInfo).HasProperty(columnLabel))
                {
                    SQLiteType dataType = row.DataType(x);
                    if (columnLabel == "Name")
                    {
                        forecast.Name = row[x] as string;
                    }
                    else if (columnLabel == "Id")
                    {
                        forecast.Id = int.Parse(row[x].ToString());
                    }
                    else if (columnLabel == "CategoryId")
                    {
                        forecast.CategoryId = int.Parse(row[x].ToString());
                    }
                    else if (columnLabel == "ForecastNumber")
                    {
                        forecast.ForecastNumber = int.Parse(row[x].ToString());
                    }
                }
            }
            return(forecast);
        }
 public chartHistoricalUtilization(int forecastId, int siteorcatid)
 {
     _ForecastId  = forecastId;
     _siteorcatid = siteorcatid;
     InitializeComponent();
     _finfo = DataRepository.GetForecastInfoById(_ForecastId);
     BindTestingArea();
 }
 private void chartSandCForecast_Load(object sender, EventArgs e)
 {
     _finfo = DataRepository.GetForecastInfoById(_ForecastId);
     if (cobtestingarea.SelectedIndex > 0)
     {
         BindDataToChart();
     }
 }
Exemple #12
0
        public ConsumptionForm(ForecastInfo finfo, Form mdiparent)
        {
            this._forecastInfo = finfo;
            this._mdiparent    = mdiparent;

            InitializeComponent();
            PopPeriod();
            BindConsumption();
        }
Exemple #13
0
        private DataSet GetDurationSummary()
        {
            ///
            ForecastInfo _finfo = DataRepository.GetForecastInfoById(_ForecastId);
            SqlCommand   cmd    = cn.CreateCommand();

            cmd.CommandType = CommandType.StoredProcedure;

            if (_finfo.DatausageEnum == DataUsageEnum.DATA_USAGE1 || _finfo.DatausageEnum == DataUsageEnum.DATA_USAGE2)
            {
                if (_finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION)
                {
                    //consumption site
                    cmd.CommandText = "spConsumptionPriceSummarybyDuration";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@siteid", SqlDbType.Int).Value     = _siteorCatId;
                    _dataSet = new DataSet("spConsumptionPriceSummarybyDuration");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spConsumptionPriceSummarybyDuration");
                }
                else
                {
                    //service site
                    cmd.CommandText = "spServicePriceSummarybyDuration";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@siteid", SqlDbType.Int).Value     = _siteorCatId;
                    _dataSet = new DataSet("spServicePriceSummarybyDuration");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spServicePriceSummarybyDuration");
                }
            }
            else
            {
                if (_finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION)
                {
                    //consumption category
                    cmd.CommandText = "spConsumptionPriceSummarybyDuration";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@catid", SqlDbType.Int).Value      = _siteorCatId;
                    _dataSet = new DataSet("spConsumptionPriceSummarybyDuration");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spConsumptionPriceSummarybyDuration");
                }
                else
                {
                    //service category

                    cmd.CommandText = "spServicePriceSummarybyDuration";
                    cmd.Parameters.Add("@forecastid", SqlDbType.Int).Value = _ForecastId;
                    cmd.Parameters.Add("@catid", SqlDbType.Int).Value      = _siteorCatId;
                    _dataSet = new DataSet("spServicePriceSummarybyDuration");
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(_dataSet, "spServicePriceSummarybyDuration");
                }
            }
            return(_dataSet);
        }
Exemple #14
0
        private void BindMapeSummaryChart(ForecastInfo finfo)
        {
            int    id         = -1;
            string seriesName = "";

            lqtChart2.Series["mape"].Points.Clear();

            foreach (Series s in lqtChart2.Series)
            {
                s.Points.Clear();
            }
            lqtChart2.Series.Clear();

            if (finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION)
            {
                IList <MAPEResult> maperesult = DataRepository.GetMAPESummaryByProduct(finfo.Id);
                BuildMeapResultView(maperesult, finfo);

                foreach (MAPEResult r in maperesult)
                {
                    if (id != r.ProductId)
                    {
                        seriesName = r.ProductName;
                        lqtChart2.Series.Add(seriesName);
                        lqtChart2.Series[seriesName].ChartType     = SeriesChartType.Line;
                        lqtChart2.Series[seriesName]["PointWidth"] = "0.5";
                        lqtChart2.Series[seriesName].LabelFormat   = "p";
                        // lqtChart2.Series[seriesName].IsValueShownAsLabel = true;
                    }

                    lqtChart2.Series[seriesName].Points.AddXY(r.DurationDateTime, r.MapeValue);
                    id = r.ProductId;
                }
            }
            else
            {
                IList <MAPEResult> maperesult = DataRepository.GetMAPESummaryByTest(finfo.Id);
                BuildMeapResultView(maperesult, finfo);
                foreach (MAPEResult r in maperesult)
                {
                    if (id != r.TestId)
                    {
                        seriesName = r.TestName;
                        lqtChart2.Series.Add(seriesName);
                        lqtChart2.Series[seriesName].ChartType     = SeriesChartType.Line;
                        lqtChart2.Series[seriesName]["PointWidth"] = "0.5";
                        lqtChart2.Series[seriesName].LabelFormat   = "p";
                        // lqtChart2.Series[seriesName].IsValueShownAsLabel = false;
                    }

                    lqtChart2.Series[seriesName].Points.AddXY(r.DurationDateTime, r.MapeValue);
                    id = r.TestId;
                }
            }
            lqtChart2.Invalidate();
        }
Exemple #15
0
        public void DeleteForecastInfo(ForecastInfo forecast)
        {
            string sql = "DELETE FROM ForecastInfo  WHERE ForecastID = @Id";

            using (SqlCommand cm = new SqlCommand(sql, DefaultConnection))
            {
                DatabaseHelper.InsertInt32Param("@Id", cm, forecast.Id);
                cm.ExecuteNonQuery();
            }
        }
Exemple #16
0
        private void chartSandCForecast_Load(object sender, EventArgs e)
        {
            _finfo = DataRepository.GetForecastInfoById(_ForecastId);
            if (_finfo.StatusEnum == ForecastStatusEnum.CLOSED)
            {
                doCalculations = true;
            }

            BindDataToChart();
        }
Exemple #17
0
        public SReported(ForecastInfo finfo)
        {
            this._forecastInfo = finfo;
            InitializeComponent();

            base._lvHistData = lvTest;
            base._chartSd    = chart1;
            InitGridView();
            BindSites();
            ShowSummary();
        }
Exemple #18
0
 public CDataUsage(ForecastInfo finfo)
 {
     this._forecastInfo = finfo;
     InitializeComponent();
     base._lvHistData = lvProduct;
     base._chartSd    = chart1;
     InitGridView();
     BindSites();
     BindForecastSite();
     ShowSummary();
 }
Exemple #19
0
        public void UpdateForecastInfo(ForecastInfo forecast, SqlTransaction tr)
        {
            string sql = "Update Test SET ForecastDate = @ForecastDate, StartingMonth = @StartingMonth, StartingYear = @StartingYear where ForecastId = @Id ";

            using (SqlCommand cm = new SqlCommand(sql, DefaultConnection, tr))
            {
                DatabaseHelper.InsertInt32Param("@Id", cm, forecast.Id);
                SetForecastInfo(cm, forecast);
                cm.ExecuteNonQuery();
            }
        }
Exemple #20
0
        public CCategory(ForecastInfo finfo)
        {
            this._forecastInfo = finfo;
            InitializeComponent();
            base._lvHistData = lvProduct;
            base._chartSd    = chart1;
            InitGridView();

            BindCategorys();
            ShowSummary();
        }
Exemple #21
0
        private ForecastInfo FetchForecastInfo(SqlDataReader dr)
        {
            ForecastInfo t = new ForecastInfo()
            {
                Id            = DatabaseHelper.GetInt32("ForecastId", dr),
                ForecastDate  = DatabaseHelper.GetDateTime("ForecastDate", dr),
                StartingMonth = DatabaseHelper.GetString("StartingMonth", dr),
                StartingYear  = DatabaseHelper.GetInt32("StartingYear", dr)
            };

            return(t);
        }
Exemple #22
0
        public FrmForecastResult(ForecastInfo finfo, string stime, string etime)
        {
            InitializeComponent();
            forecastInfo           = finfo;
            lblmeapindicator3.Text = "no field color represents an" + Environment.NewLine + "accurate forecast, within 25%.";

            lblmeapindicator3.Text = "no field color represents an" + Environment.NewLine + "accurate forecast, within 25%.";
            lblgray.Text           = "represents insufficient data to" + Environment.NewLine + "complete the forecast";


            lblAddby.Text     = finfo.Scaleup.ToString();
            lblExtension.Text = finfo.Extension.ToString();
            //lblOrder.Text = finfo.Order;
            lblRegression.Text = finfo.Method;
            lblWestage.Text    = finfo.Westage.ToString();

            richTextBox1.AppendText("Start On: " + stime);
            richTextBox1.AppendText("End On: " + etime);
            richTextBox1.AppendText("Forecasting process completed successfully.");

            if (finfo.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC && finfo.DatausageEnum != DataUsageEnum.DATA_USAGE2)
            {
                IList result = DataRepository.GetBeyondMaxTPutResult(finfo.Id, finfo.MonthInPeriod);
                if (result.Count > 0)
                {
                    listView1.BeginUpdate();
                    listView1.Items.Clear();

                    foreach (object[] r in result)
                    {
                        ListViewItem li = new ListViewItem(r[0].ToString());
                        li.SubItems.Add(r[1].ToString());
                        li.SubItems.Add(r[2].ToString());
                        li.SubItems.Add(r[3].ToString());
                        li.SubItems.Add(r[4].ToString());
                        listView1.Items.Add(li);
                    }

                    listView1.EndUpdate();
                    richTextBox1.AppendText("But there is a forecast which exceed Maximum through-put of instrument.");
                    richTextBox1.AppendText("You can view the detail on 'Max-Through Put' tab.");
                }
                else
                {
                    tabResult.TabPages.Remove(tabMax);
                }
            }
            else
            {
                tabResult.TabPages.Remove(tabMax);
            }
            BindMapeSummaryChart(finfo);
        }
Exemple #23
0
        public void SaveForecastInfo(ForecastInfo test, SqlTransaction tr)
        {
            string sql = "INSERT INTO ForecastInfo(ForecastDate, StartingMonth, StartingYear)";

            sql += "VALUES(@ForecastDate, @StartingMonth, @StartingYear) SELECT @@identity";

            using (SqlCommand cm = new SqlCommand(sql, DefaultConnection, tr))
            {
                SetForecastInfo(cm, test);
                test.Id = int.Parse(cm.ExecuteScalar().ToString());
            }
        }
Exemple #24
0
        public ImportForm(ForecastInfo finfo)
        {
            this._forecastInfo = finfo;
            InitializeComponent();

            txtForecastid.Text  = _forecastInfo.ForecastNo;
            txtPeriod.Text      = _forecastInfo.Period;
            txtSdate.Text       = _forecastInfo.StartDate.ToShortDateString();
            txtExtension.Text   = _forecastInfo.Extension.ToString();
            txtMethodology.Text = _forecastInfo.Methodology;
            txtDusage.Text      = _forecastInfo.DataUsage;
        }
Exemple #25
0
        private void buttonLaunchReport_Click(object sender, EventArgs e)
        {
            try
            {
                if (comMethodologey.Text == MethodologyEnum.DEMOGRAPHIC.ToString())
                {
                    _mforecast = LqtUtil.GetComboBoxValue <MorbidityForecast>(cbomforecast);
                    LoadReport(cboreport.SelectedIndex);
                }
                else
                {
                    FileInfo filinfo = null;

                    _finfo = LqtUtil.GetComboBoxValue <ForecastInfo>(comForecastinfo);
                    List <ReportParameter> param = new List <ReportParameter>();
                    ReportParameter        finfo = new ReportParameter("ForecastId", _finfo.Id.ToString());
                    param.Add(finfo);


                    FillReportDataSet();


                    if (rdosite.Checked)
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.ServiceQSummary)));
                    }
                    else
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.FullQSummary)));
                    }


                    _fileToLoad = filinfo;


                    FrmReportViewer frmRV = new FrmReportViewer(_fileToLoad, _rDataSet, param);



                    frmRV.Dock = DockStyle.Fill;
                    Close();
                    frmRV.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                new FrmShowError(new ExceptionStatus()
                {
                    message = "", ex = ex
                }).ShowDialog();
            }
        }
Exemple #26
0
        private void btnviewreport_Click(object sender, EventArgs e)
        {
            try
            {
                if (_parentId == 3)
                {
                    _mforecast = LqtUtil.GetComboBoxValue <MorbidityForecast>(cobforecast);
                    LoadReport(_subreportId);
                }
                else
                {
                    FileInfo filinfo = null;

                    _finfo = LqtUtil.GetComboBoxValue <ForecastInfo>(cobforecast);
                    List <ReportParameter> param = new List <ReportParameter>();
                    ReportParameter        finfo = new ReportParameter("ForecastId", _finfo.Id.ToString());
                    param.Add(finfo);


                    FillReportDataSet();


                    if (cobreporttype.SelectedIndex == 0)
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.ServiceQSummary)));
                    }
                    else
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.FullQSummary)));
                    }


                    _fileToLoad = filinfo;


                    FrmReportViewer frmRV = new FrmReportViewer(_fileToLoad, _rDataSet, param);



                    frmRV.Dock = DockStyle.Fill;
                    // Close();
                    frmRV.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                new FrmShowError(new ExceptionStatus()
                {
                    message = "", ex = ex
                }).ShowDialog();
            }
        }
Exemple #27
0
        ForecastInfo ReadForecast(Stream stream)
        {
            ForecastInfo forecast = null;

            try {
                DataContractJsonSerializer dc = new DataContractJsonSerializer(typeof(ForecastInfo));
                forecast = (ForecastInfo)dc.ReadObject(stream);
            }
            catch {
                forecast = null;
            }
            return(forecast);
        }
Exemple #28
0
 void forecastClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         ((WebClient)sender).OpenReadCompleted -= forecastClient_OpenReadCompleted;
         Stream      stream          = e.Result;
         CityWeather cityWeatherInfo = (CityWeather)e.UserState;
         Task.Factory.StartNew(() => {
             DataContractJsonSerializer dc = new DataContractJsonSerializer(typeof(ForecastInfo));
             ForecastInfo forecast         = (ForecastInfo)dc.ReadObject(stream);
             this.uiDispatcher.Invoke(new Action(() => { cityWeatherInfo.SetForecast(forecast.list); }));
         });
     }
 }
Exemple #29
0
 void forecastClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         forecastClient.OpenReadCompleted -= forecastClient_OpenReadCompleted;
         Stream      stream          = e.Result;
         CityWeather cityWeatherInfo = (CityWeather)e.UserState;
         Task.Factory.StartNew(() => {
             lock (forecastLocker) {
                 ForecastInfo forecast = ReadForecast(stream);
                 cityWeatherInfo.SetForecast(forecast);
             }
         });
     }
 }
Exemple #30
0
        public FrmForecastResult(ForecastInfo finfo)
        {
            InitializeComponent();

            forecastInfo           = finfo;
            lblmeapindicator3.Text = "no field color represents an" + Environment.NewLine + "accurate forecast, within 25%.";
            lblgray.Text           = "represents insufficient data to" + Environment.NewLine + "complete the forecast";
            lblAddby.Text          = finfo.Scaleup.ToString();
            lblExtension.Text      = finfo.Extension.ToString();
            //lblOrder.Text = finfo.Order;
            lblRegression.Text = finfo.Method;
            lblWestage.Text    = finfo.Westage.ToString();

            tabResult.TabPages.Remove(tabPage1);
            tabResult.TabPages.Remove(tabMax);
            BindMapeSummaryChart(finfo);
        }
Exemple #31
0
        /// <summary>
        /// Get the minimum and maximum temperatures for all the time periods
        /// </summary>
        private void GetMinMaxTemperatures(XElement xmlWeather, ObservableCollection<ForecastInfo> newForecastList)
        {
            XElement xmlCurrent;

            // Find the temperature parameters.   if first time period is "Tonight",
            // then the Daily Minimum Temperatures are listed first.
            // Otherwise the Daily Maximum Temperatures are listed first

            xmlCurrent = xmlWeather.Descendants("parameters").First();
            ForecastInfo newInfo;
            // then get the Daily Maximum Temperatures
            int count = 0;
            foreach (XElement curElement in xmlCurrent.Elements("temperature").
                ElementAt(0).Elements("value"))
            {
                count += 1;
            }

            double[] Ccfs = new double[count];
            int index = 0;
            foreach (XElement curElement in xmlCurrent.Elements("temperature").
                ElementAt(0).Elements("value"))
            {
                Ccfs[index] = double.Parse(curElement.Value);
                index += 1;
            }

            index = 0;
            foreach (XElement curElement in xmlCurrent.Elements("temperature").
                ElementAt(1).Elements("value"))
            {
                Ccfs[index] += double.Parse(curElement.Value);
                Ccfs[index] /= 2.0;
                index += 1;
            }

            int date = 19;
            for (index = 0; index < count; index += 1)
            {
                newInfo = new ForecastInfo();
                newInfo.Date = string.Format("4/{0}", date);
                newInfo.Ccf = Ccfs[index] * -0.0366 + 2.4553;
                newForecastList.Add(newInfo);
                date += 1;
            }

            /*
            int ElementIndex = 0;
            if (string.Compare(xmlCurrent.Elements("temperature").ElementAt(0).Attribute("type").ToString(), "maximum") == 0)
            {
                ElementIndex = 1;
            }

            // get the Daily Minimum Temperatures
            int Index = 19;
            ForecastInfo newInfo;
            // then get the Daily Maximum Temperatures
            foreach (XElement curElement in xmlCurrent.Elements("temperature").
                ElementAt(ElementIndex).Elements("value"))
            {

                newInfo = new ForecastInfo();
                newInfo.Date = string.Format("4/{0}", Index);
                newInfo.Ccf = double.Parse(curElement.Value)*-0.053 + 2.9164;
                Index += 1;
                newForecastList.Add(newInfo);
            }
             *
             * */
        }