public ImportConForm(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; } }
public chartUtilization(int forecastId, int siteorcatid) { _ForecastId = forecastId; _siteorcatid = siteorcatid; InitializeComponent(); _finfo = DataRepository.GetForecastInfoById(_ForecastId); BindTestingArea(); }
public ConsumptionForm(ForecastInfo finfo, Form mdiparent) { this._forecastInfo = finfo; this._mdiparent = mdiparent; InitializeComponent(); PopPeriod(); BindConsumption(); }
public SCategory(ForecastInfo finfo) { this._forecastInfo = finfo; InitializeComponent(); base._lvHistData = lvTest; base._chartSd = chart1; InitGridView(); BindCategorys(); ShowSummary(); }
public CReported(ForecastInfo finfo) { this._forecastInfo = finfo; InitializeComponent(); base._lvHistData = lvProduct; base._chartSd = chart1; InitGridView(); BindSites(); ShowSummary(); }
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; }
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); }
public FrmMselectCon(ForecastInfo finfo) { _forecastInfo = finfo; InitializeComponent(); if (_forecastInfo.DatausageEnum != DataUsageEnum.DATA_USAGE3) BindSites(); else BindProductCategoryes(); BindProducts(); }
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); }
public bool ImportServiceStatistic() { ImportSerForm frm = new ImportSerForm(_forecastInfo); if (frm.ShowDialog() == DialogResult.OK) { _forecastInfo = frm.GetForecastInfo; OnForecastInfoDataChanged(); return true; } return false; }
public bool ImportConsumption() { ImportConForm frm = new ImportConForm(_forecastInfo); if (frm.ShowDialog() == DialogResult.OK) { _forecastInfo = frm.GetForecastInfo; OnForecastInfoDataChanged(); return true; } return false; }
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(); } }
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(); } }
private void comForecastinfo_SelectedIndexChanged(object sender, EventArgs e) { _forecastInfo = LqtUtil.GetComboBoxValue<ForecastInfo>(comForecastinfo); if (_forecastInfo != null) { txtPeriod.Text = _forecastInfo.Period; txtSdate.Text = _forecastInfo.StartDate.ToShortDateString(); txtExtension.Text = _forecastInfo.Extension.ToString(); txtMethodology.Text = _forecastInfo.Methodology; txtDusage.Text = _forecastInfo.DataUsage; txtWestage.Text = _forecastInfo.Westage.ToString(); txtAddby.Text = _forecastInfo.Scaleup.ToString(); txtStatus.Text = _forecastInfo.Status; txtRegressionType.Text = _forecastInfo.Method; //if (fi.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC) // txtWestage.Enabled = false; //else // txtWestage.Enabled = true; if (_forecastInfo.StatusEnum != ForecastStatusEnum.OPEN) { butSummary.Enabled = true; butToxml.Enabled = true; lnkshowmapesummary.Enabled = true; } else { butSummary.Enabled = false; butToxml.Enabled = false; lnkshowmapesummary.Enabled = false; } if (cboRegressionType.FindString(_forecastInfo.Method) >= 0) { cboRegressionType.Text = _forecastInfo.Method; cboRegressionType.SelectedText = _forecastInfo.Method; } butForecast.Enabled = true; } else { txtPeriod.Text = ""; txtSdate.Text = ""; txtExtension.Text = ""; txtMethodology.Text = ""; txtDusage.Text = ""; txtWestage.Text = ""; txtAddby.Text = ""; txtStatus.Text = ""; txtRegressionType.Text = ""; butSummary.Enabled = false; butToxml.Enabled = false; butForecast.Enabled = false; _doCalculations = false; } EnableCatInstUtilizationlink(); BuildNavigationTree(); }
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(); }
public static void DeleteForecastInfo(ForecastInfo t) { DaoFactory.GetDaoFactory().CreateForecastInfoDao().Delete(t); }
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(); }
private void ForcastSiteHistoricalData(ForecastInfo finfo) { foreach (ForecastSite s in finfo.ForecastSites) { if (finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) { IList<MasterProduct> products = s.GetUniqFSProduct(); if (this.progressBar1.InvokeRequired) { progressBar1.Invoke((MethodInvoker)delegate { progressBar1.Maximum = products.Count; progressBar1.Value = 0; }); } else { progressBar1.Maximum = products.Count; progressBar1.Value = 0; } foreach (MasterProduct p in products) { if (this.lblProgress.InvokeRequired) { lblProgress.Invoke((MethodInvoker)delegate { lblProgress.Text = String.Format("{0} -> {1} forecasted...", s.Site.SiteName, p.ProductName); }); } else lblProgress.Text = String.Format("{0} -> {1} forecasted...",s.Site.SiteName, p.ProductName); Application.DoEvents(); ClearChart1SeriesPoints(); IList<ForecastSiteProduct> fsiteProduct = DataRepository.GetFSiteProductByProId(s.Id, p.Id, SortDirection.Ascending); foreach (ForecastSiteProduct sp in fsiteProduct) { if (this.chart1.InvokeRequired) { chart1.Invoke((MethodInvoker)delegate { chart1.Series["Input"].Points.AddXY(sp.DurationDateTime.Value, sp.Adjusted); }); } else chart1.Series["Input"].Points.AddXY(sp.DurationDateTime.Value, sp.Adjusted); } //gets last Input date lastEntryDate = fsiteProduct[fsiteProduct.Count - 1].DurationDateTime.Value; if (this.chart1.InvokeRequired) chart1.Invoke((MethodInvoker)delegate { chart1.Invalidate(); }); else chart1.Invalidate(); CalculateChart1(finfo.Extension); DataSet ds = chart1.DataManipulator.ExportSeriesValues("Forecasting"); DataSet InputDs = chart1.DataManipulator.ExportSeriesValues("Input"); // ReadDataset(finfo, s.Site.Id, 0, p.Id, 0, ds,lastEntryDate,InputDs); if (this.progressBar1.InvokeRequired) progressBar1.Invoke((MethodInvoker)delegate { progressBar1.Value += 1; }); else progressBar1.Value += 1; Application.DoEvents(); } } else if (finfo.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC) { IList<Test> tests = s.GetUniqTest(); if (this.progressBar1.InvokeRequired) { progressBar1.Invoke((MethodInvoker)delegate { progressBar1.Maximum = tests.Count; progressBar1.Value = 0; }); } else { progressBar1.Maximum = tests.Count; progressBar1.Value = 0; } foreach (Test p in tests) { IList<ForecastSiteTest> fsiteTest = DataRepository.GetFSiteTestByTestId(s.Id, p.Id, SortDirection.Ascending); if (this.lblProgress.InvokeRequired) { lblProgress.Invoke((MethodInvoker)delegate { lblProgress.Text = String.Format("{0} -> {1} forecasted...", s.Site.SiteName, p.TestName); }); } else lblProgress.Text = String.Format("{0} -> {1} forecasted...", s.Site.SiteName, p.TestName); Application.DoEvents(); ClearChart1SeriesPoints(); foreach (ForecastSiteTest sp in fsiteTest) { if (this.chart1.InvokeRequired) chart1.Invoke((MethodInvoker)delegate { chart1.Series["Input"].Points.AddXY(sp.DurationDateTime.Value, sp.Adjusted); }); else chart1.Series["Input"].Points.AddXY(sp.DurationDateTime.Value, sp.Adjusted); } lastEntryDate = fsiteTest[fsiteTest.Count - 1].DurationDateTime.Value; DataSet InputDs = chart1.DataManipulator.ExportSeriesValues("Input"); if (this.chart1.InvokeRequired) chart1.Invoke((MethodInvoker)delegate { chart1.Invalidate(); }); else chart1.Invalidate(); CalculateChart1(finfo.Extension); DataSet ds = chart1.DataManipulator.ExportSeriesValues("Forecasting"); ReadDataset(finfo, s.Site.Id, 0, 0, p.Id, ds, lastEntryDate,InputDs); if (this.progressBar1.InvokeRequired) progressBar1.Invoke((MethodInvoker)delegate { progressBar1.Value += 1; }); else progressBar1.Value += 1; Application.DoEvents(); } } } }
private void ForcastCategoryHistoricalData(ForecastInfo finfo) { foreach (ForecastCategory c in finfo.ForecastCategories) { if (finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) { IList<MasterProduct> products = c.GetUniqFSProduct(); foreach (MasterProduct p in products) { ClearChart1SeriesPoints(); IList<ForecastCategoryProduct> fcatProduct = DataRepository.GetFCategoryProductByProId(c.Id, p.Id, SortDirection.Ascending); foreach (ForecastCategoryProduct cp in fcatProduct) { if (this.chart1.InvokeRequired) chart1.Invoke((MethodInvoker)delegate { chart1.Series["Input"].Points.AddXY(cp.DurationDateTime.Value, cp.Adjusted); }); else chart1.Series["Input"].Points.AddXY(cp.DurationDateTime.Value, cp.Adjusted); } lastEntryDate = fcatProduct[fcatProduct.Count - 1].DurationDateTime.Value; DataSet InputDs = chart1.DataManipulator.ExportSeriesValues("Input"); if (this.chart1.InvokeRequired) chart1.Invoke((MethodInvoker)delegate { chart1.Invalidate(); }); else chart1.Invalidate(); CalculateChart1(finfo.Extension); DataSet ds = chart1.DataManipulator.ExportSeriesValues("Forecasting"); ReadDataset(finfo,0, c.Id, p.Id, 0, ds,lastEntryDate,InputDs); } } else if (finfo.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC) { IList<Test> tests = c.GetUniqFCTest(); foreach (Test p in tests) { ClearChart1SeriesPoints(); IList<ForecastCategoryTest> fcatTest = DataRepository.GetFCategoryTestByTestId(c.Id, p.Id, SortDirection.Ascending); foreach (ForecastCategoryTest ft in fcatTest) { if (this.chart1.InvokeRequired) chart1.Invoke((MethodInvoker)delegate { chart1.Series["Input"].Points.AddXY(ft.DurationDateTime.Value, ft.Adjusted); }); else chart1.Series["Input"].Points.AddXY(ft.DurationDateTime.Value, ft.Adjusted); } lastEntryDate = fcatTest[fcatTest.Count - 1].DurationDateTime.Value; DataSet InputDs = chart1.DataManipulator.ExportSeriesValues("Input"); if (this.chart1.InvokeRequired) chart1.Invoke((MethodInvoker)delegate { chart1.Invalidate(); }); else chart1.Invalidate(); CalculateChart1(finfo.Extension); DataSet ds = chart1.DataManipulator.ExportSeriesValues("Forecasting"); ReadDataset(finfo, 0, c.Id, 0, p.Id, ds, lastEntryDate,InputDs); } } } }
private void EnableCatInstUtilizationlink() { _forecastInfo = LqtUtil.GetComboBoxValue<ForecastInfo>(comForecastinfo); if (_forecastInfo != null) { if (_forecastInfo.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC) { if (_forecastInfo.DatausageEnum == DataUsageEnum.DATA_USAGE3) lnkCatInstUtilizaiton.Visible = true; else lnkCatInstUtilizaiton.Visible = false; } else lnkCatInstUtilizaiton.Visible = false; } else lnkCatInstUtilizaiton.Visible = false; }
public ForecastForm() { InitializeComponent(); //DataUsageEnum.DATA_USAGE1.Description foreach (DataUsageEnum val in Enum.GetValues(typeof(DataUsageEnum))) { ComboboxItem item = new ComboboxItem(); item.Text = val.Description(); item.Value = val; comStatus.Items.Add(item); } //comStatus.Items.AddRange(Enum.GetNames(typeof(DataUsageEnum))); comStatus.Items.Insert(0, "--Select Here--"); comStatus.SelectedIndex = 0; comMethodologey.Items.AddRange(Enum.GetNames(typeof(MethodologyEnum))); comMethodologey.Items.Insert(0, "--Select Here--"); comMethodologey.SelectedIndex = 0; cboRegressionType.Items.AddRange(Enum.GetNames(typeof(ForecastingMethodEnum))); cboRegressionType.SelectedIndex = 0; cboOrder.SelectedIndex = 0; PopForecastInfo(); _forecastInfo = LqtUtil.GetComboBoxValue<ForecastInfo>(comForecastinfo); }
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; }
public IList<MAPEResult> CorrectMapeResultDates(IList<MAPEResult> maperesults, ForecastInfo finfo) { foreach (MAPEResult maperesult in maperesults) { DateTime date = new DateTime(); if (maperesult.DurationDateTime.Day > 28) { if (maperesult.DurationDateTime.Month == 12) date = new DateTime(maperesult.DurationDateTime.Year + 1, 1, 01); else date = new DateTime(maperesult.DurationDateTime.Year, maperesult.DurationDateTime.Month + 1, 01); } else { date = maperesult.DurationDateTime; } string duration = date.ToShortDateString(); if (finfo.PeriodEnum == ForecastPeriodEnum.Bimonthly || finfo.PeriodEnum == ForecastPeriodEnum.Monthly) duration = date.ToString("MMMM-yyyy"); if (finfo.PeriodEnum == ForecastPeriodEnum.Quarterly) duration = "Qua" + LqtUtil.GetQuarter(date).ToString() + "-" + date.Year.ToString(); if (finfo.PeriodEnum == ForecastPeriodEnum.Yearly) duration = date.Year.ToString(); maperesult.Duration = duration; } return maperesults; }
private void ShowResultForm(ForecastInfo finfo, string stime, string etime) { FrmForecastResult frm = new FrmForecastResult(finfo, stime,etime); frm.ShowDialog(); }
private void chartSandCForecast_Load(object sender, EventArgs e) { _finfo = DataRepository.GetForecastInfoById(_ForecastId); if (_finfo.StatusEnum == ForecastStatusEnum.CLOSED) doCalculations = true; BindDataToChart(); }
public void BuildNavFromSite(ForecastInfo finfo) { IList list; object[] row; if(finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) list = DataRepository.GetUniqueFType(finfo.Id, 1); else list = DataRepository.GetUniqueFType(finfo.Id, 0); TreeNode all = new TreeNode("All") { Tag = finfo.Id }; treeViewlocation.Nodes.Add(all); //TreeNode testarea = new TreeNode("Testing Area") { Tag = finfo.Id };//the same as all //treeViewlocation.Nodes.Add(testarea); //for (int i = 0; i < list.Count; i++) //{ // row = (object[])list[i]; // TreeNode test = new TreeNode(row[0].ToString()) { Tag =row[1]}; // testarea.Nodes.Add(test); //} foreach (ForecastSite ft in finfo.ForecastSites) { TreeNode rootNode = new TreeNode(ft.Site.SiteName) { Tag = ft.Id }; all.Nodes.Add(rootNode); ////---------------------------- //if (finfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) //{ // foreach (MasterProduct mp in ft.GetUniqFSProduct()) // { // rootNode.Nodes.Add(new TreeNode(mp.ProductName) { Tag = mp.Id }); // } //} //else //{ // foreach (Test t in ft.GetUniqTest()) // { // rootNode.Nodes.Add(new TreeNode(t.TestName) { Tag = t.Id }); // } //} } }
private void chartSandCForecast_Load(object sender, EventArgs e) { _finfo = DataRepository.GetForecastInfoById(_ForecastId); if (cobtestingarea.SelectedIndex>0) BindDataToChart(); }
private void ReadDataset(ForecastInfo finfo, int siteid,int catid, int proid, int testid,DataSet ds,DateTime lastDate,DataSet inputDs) { decimal prevValue = 0; int period = 0; foreach (DataRow row in ds.Tables[0].Rows) { DateTime ddate = Convert.ToDateTime(row[0]); //if (ddate.Day > 29) //{ // if (ddate.Month == 12) // ddate = new DateTime(ddate.Year + 1, 1, 1); // ddate = new DateTime(ddate.Year, ddate.Month+1, 1); //} ForecastedResult fresult = new ForecastedResult(); fresult.ForecastId = finfo.Id; fresult.SiteId = siteid; fresult.CategoryId = catid; fresult.TestId = testid; fresult.ProductId = proid; fresult.DurationDateTime = LqtUtil.CorrectDateTime(ddate.Date);//ddate.Date; if (Convert.ToDecimal(row[1]) < 0) fresult.ForecastValue = 0; else fresult.ForecastValue = Convert.ToDecimal(row[1]); if (ddate > lastDate) { fresult.IsHistory = false; fresult.HistoricalValue = 0; } else { DataRow rowinput = inputDs.Tables[0].Rows[period]; fresult.HistoricalValue = Convert.ToDecimal(rowinput[1]); fresult.IsHistory = true; } if (finfo.PeriodEnum == ForecastPeriodEnum.Monthly || finfo.PeriodEnum == ForecastPeriodEnum.Bimonthly) fresult.Duration = String.Format("{0}-{1}", LqtUtil.Months[fresult.DurationDateTime.Month - 1], fresult.DurationDateTime.Year); else if (finfo.PeriodEnum == ForecastPeriodEnum.Quarterly) fresult.Duration = String.Format("Qua{0}-{1}", LqtUtil.GetQuarter(fresult.DurationDateTime), fresult.DurationDateTime.Year); else fresult.Duration = String.Format("{0}", fresult.DurationDateTime.Year); fresult.TotalValue = fresult.ForecastValue + (fresult.ForecastValue * (_westage / 100)); fresult.TotalValue += prevValue * (_scaleup / 100); prevValue = fresult.TotalValue; fresult.ServiceConverted = false; //get TestingArea if (fresult.TestId > 0) { Test test = DataRepository.GetTestById(fresult.TestId); fresult.TestingArea = test.TestingArea.AreaName; } //get packQty if (fresult.ProductId > 0) { MasterProduct p = DataRepository.GetProductById(fresult.ProductId); //converting quantity to packsize commented out //int packSize = p.GetActiveProductPrice(fresult.DurationDateTime).PackSize; //fresult.PackQty = GetNoofPackage(packSize, fresult.TotalValue); //rounding forecasted pack quantity int Nopack = int.Parse(decimal.Round(fresult.TotalValue, 0).ToString()); if (Nopack < fresult.TotalValue) Nopack = Nopack + 1; if (Nopack == 0) Nopack = 0; fresult.TotalValue = Nopack; fresult.PackQty = Nopack; fresult.PackPrice = fresult.PackQty * p.GetActiveProductPrice(fresult.DurationDateTime).Price; fresult.ProductTypeId = p.ProductType.Id; fresult.ProductType = p.ProductType.TypeName; } _listFresult.Add(fresult); //test to product if (fresult.TestId > 0) { Test test = DataRepository.GetTestById(fresult.TestId); ForlabSite fsite = null; if (fresult.SiteId > 0) fsite = DataRepository.GetSiteById(fresult.SiteId); ForecastCategory fc = null; if (fresult.CategoryId > 0) fc = DataRepository.GetForecastCategoryById(fresult.CategoryId); foreach (ProductUsage pu in test.ProductUsages) { ForecastedResult cfresult = new ForecastedResult(); //copyvalues cfresult.ForecastId = fresult.ForecastId; cfresult.TestId = fresult.TestId; cfresult.DurationDateTime = fresult.DurationDateTime; //cfresult.ForecastValue = fresult.ForecastValue; //cfresult.TotalValue = fresult.TotalValue; cfresult.SiteId = fresult.SiteId; cfresult.CategoryId = fresult.CategoryId; cfresult.Duration = fresult.Duration; cfresult.IsHistory = fresult.IsHistory; //cfresult.HistoricalValue = fresult.HistoricalValue; cfresult.TestingArea = fresult.TestingArea; //endcopy if (finfo.DatausageEnum == DataUsageEnum.DATA_USAGE1 || finfo.DatausageEnum == DataUsageEnum.DATA_USAGE2) { if (fsite != null) { SiteInstrument siteins=fsite.GetSiteInstrumentByInsId(pu.Instrument.Id); if (siteins!=null) { decimal Qty = pu.Rate * fresult.TotalValue*siteins.TestRunPercentage/100; cfresult.TotalValue = Qty; int packSize = pu.Product.GetActiveProductPrice(fresult.DurationDateTime).PackSize; cfresult.ProductId = pu.Product.Id; cfresult.PackQty = GetNoofPackage(packSize, Qty); cfresult.PackPrice = cfresult.PackQty * pu.Product.GetActiveProductPrice(fresult.DurationDateTime).Price; cfresult.ProductTypeId = pu.Product.ProductType.Id; cfresult.ProductType = pu.Product.ProductType.TypeName; cfresult.ServiceConverted = true; _listFresult.Add(cfresult); } } } else { if (fsite != null) { ForecastCategoryInstrument fcins = DataRepository.GetForecastCategoryInstrumentById(pu.Instrument.Id); if (fcins != null) { decimal Qty = pu.Rate * fresult.TotalValue*fcins.TestRunPercentage; cfresult.TotalValue = Qty; int packSize = pu.Product.GetActiveProductPrice(fresult.DurationDateTime).PackSize; cfresult.ProductId = pu.Product.Id; cfresult.PackQty = GetNoofPackage(packSize, Qty); cfresult.PackPrice = cfresult.PackQty * pu.Product.GetActiveProductPrice(fresult.DurationDateTime).Price; cfresult.ProductTypeId = pu.Product.ProductType.Id; cfresult.ProductType = pu.Product.ProductType.TypeName; cfresult.ServiceConverted = true; _listFresult.Add(cfresult); } } } } } period++; } }
public static void SaveOrUpdateForecastInfo(ForecastInfo info) { DaoFactory.GetDaoFactory().CreateForecastInfoDao().SaveOrUpdate(info); }
private void lbtAddnew_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { ForecastInfo finfo = new ForecastInfo(); finfo.Methodology = _methoEnum.ToString(); if (_methoEnum == MethodologyEnum.CONSUMPTION) { ConsumptionForm frm = new ConsumptionForm(finfo, MdiParentForm); frm.ShowDialog(); } else if (_methoEnum == MethodologyEnum.SERVICE_STATISTIC) { ServiceForm frm = new ServiceForm(finfo, MdiParentForm); frm.ShowDialog(); } }