Exemplo n.º 1
0
        private void btnGraph_Click(object sender, EventArgs e)
        {
            double cAmount  = double.Parse(txtChangeAmount.Text);
            double maxPrice = double.Parse(txtMaxPrice.Text);
            double minPrice = double.Parse(txtMinPrice.Text);

            if (chbIncludeExtra.Checked && !ExtraFunctions.ValidateExtraConfiguration(txtPeriod.Text, tbExtraPeriod.Text,
                                                                                      cbPeriodType.SelectedIndex, cbExtraPeriodType.SelectedIndex))
            {
                showError(Constancts.ErrorMessagePeriodType);
            }
            double basePrice  = double.Parse(txtBasePrice.Text);
            int    period     = int.Parse(txtPeriod.Text);
            int    periodType = cbPeriodType.SelectedIndex;
            double newPrice   = basePrice;

            SetImport2FirstPeriods(period, basePrice);

            for (int i = period; i < _importDateData.Count; i++)
            {
                newPrice = AlgorithmFunctions.GetNewPrice(newPrice, period, periodType, _exportDateData, _exportSalesData, cAmount, maxPrice, minPrice);
                _exportPriceData.Add(newPrice);
                _exportSalesData.Add(AlgorithmFunctions.CalculateSales(newPrice, _importSalesData.ToArray()[i], double.Parse(txtBasePrice.Text)));
            }

            DateTime[] x  = _importDateData.ToArray();
            int[]      y  = _importSalesData.ToArray();
            int[]      y2 = _exportSalesData.ToArray();

            Grahps grahps = new Grahps(Constancts.CompareTitule, Constancts.Serie1, x, y, Constancts.Serie2, y2);

            grahps.ShowGrahpVaues();
        }
Exemplo n.º 2
0
        private void btnGraphReal_Click(object sender, EventArgs e)
        {
            //Form form = CreateFormGrahp();
            DateTime[] x = _importDateData.ToArray();
            int[]      y = _importSalesData.ToArray();

            Grahps grahps = new Grahps(Constancts.ImportedTitule, Constancts.Serie1, x, y);

            grahps.ShowGrahpVaues();
        }