private void GenerarSerie()
        {
            try
            {
                Serie.Clear();
                int contador;
                contador = 0;
                if (rbnBoleta.Checked == true)
                {
                    foreach (clsVenta ELEMENTO in clsVenta.generarSerieNumeroComprobante("BOLETA"))
                    {
                        Serie.Add(ELEMENTO);
                        lblSerie.Text          = ELEMENTO.Serie.ToString();
                        lblNroCorrelativo.Text = ELEMENTO.NroVenta.ToString();
                        contador = contador + 1;
                    }

                    if (contador == 0)
                    {
                        lblSerie.Text          = "1";
                        lblNroCorrelativo.Text = "1";
                    }
                    else if (Convert.ToInt32(lblNroCorrelativo.Text) == 10)
                    {
                        lblSerie.Text          = (Convert.ToInt32(lblSerie.Text) + 1).ToString();
                        lblNroCorrelativo.Text = "1";
                    }
                    else
                    {
                        lblNroCorrelativo.Text = (Convert.ToInt32(lblNroCorrelativo.Text) + 1).ToString();
                    }
                }
                else
                {
                    foreach (clsVenta ELEMENTO in clsVenta.generarSerieNumeroComprobante("FACTURA"))
                    {
                        Serie.Add(ELEMENTO);
                        lblSerie.Text          = ELEMENTO.Serie.ToString();
                        lblNroCorrelativo.Text = ELEMENTO.NroVenta.ToString();
                        contador++;
                    }

                    if (contador == 0)
                    {
                        lblSerie.Text          = "1";
                        lblNroCorrelativo.Text = "1";
                    }
                    else if (Convert.ToInt32(lblNroCorrelativo.Text) == 10)
                    {
                        lblSerie.Text          = (Convert.ToInt32(lblSerie.Text) + 1).ToString();
                        lblNroCorrelativo.Text = "1";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public void Fill(UnitTest test)
        {
            serieFailed.Clear();
            serieSuccess.Clear();
            serieIgnored.Clear();
            serieTime.Clear();

            this.test = test;

            if (showLastTest)
            {
                if (timeScale)
                {
                    lastDateValue = DateTime.Now.Ticks;
                }
                else
                {
                    lastTestNumber = 0;
                }
            }

            UnitTestResult first = null;

            UnitTestResult[] results;
            UnitTestResult   lastResult = test.Results.GetLastResult(DateTime.Now);

            if (lastResult == null)
            {
                return;
            }

            if (timeScale)
            {
                DateTime startDate;
                if (showLastTest)
                {
                    startDate = lastResult.TestDate - currentSpan;
                    StartX    = startDate.Ticks;
                    EndX      = lastResult.TestDate.Ticks;
                    first     = test.Results.GetLastResult(startDate);
                    results   = test.Results.GetResults(startDate, lastResult.TestDate);
                }
                else
                {
                    DateTime endDate = new DateTime((long)lastDateValue);
                    startDate = endDate - currentSpan;
                    StartX    = (double)startDate.Ticks;
                    EndX      = (double)endDate.Ticks;
                    first     = test.Results.GetLastResult(startDate);
                    results   = test.Results.GetResults(startDate, lastResult.TestDate);
                }
                if (singleDayResult)
                {
                    first = test.Results.GetPreviousResult(new DateTime(startDate.Year, startDate.Month, startDate.Day));
                    ArrayList list = new ArrayList();
                    if (first != null)
                    {
                        list.Add(first);
                    }
                    for (int n = 0; n < results.Length - 1; n++)
                    {
                        DateTime d1 = results [n].TestDate;
                        DateTime d2 = results [n + 1].TestDate;
                        if (d1.Day != d2.Day || d1.Month != d2.Month || d1.Year != d2.Year)
                        {
                            list.Add(results [n]);
                        }
                    }
                    list.Add(results [results.Length - 1]);
                    results = (UnitTestResult[])list.ToArray(typeof(UnitTestResult));
                }

                if (resetCursors)
                {
                    SelectionEnd.Value = EndX;
                    if (results.Length > 1)
                    {
                        SelectionStart.Value = results [results.Length - 2].TestDate.Ticks;
                    }
                    else
                    {
                        SelectionStart.Value = EndX;
                    }
                    resetCursors = false;
                }
            }
            else
            {
                if (singleDayResult)
                {
                    ArrayList list = new ArrayList();
                    list.Add(lastResult);
                    while (list.Count < testCount + (int)lastTestNumber + 1)
                    {
                        UnitTestResult res = test.Results.GetPreviousResult(lastResult.TestDate);
                        if (res == null)
                        {
                            break;
                        }
                        if (res.TestDate.Day != lastResult.TestDate.Day || res.TestDate.Month != lastResult.TestDate.Month || res.TestDate.Year != lastResult.TestDate.Year)
                        {
                            list.Add(res);
                        }
                        lastResult = res;
                    }
                    results = (UnitTestResult[])list.ToArray(typeof(UnitTestResult));
                    Array.Reverse(results);
                }
                else
                {
                    results = test.Results.GetResultsToDate(DateTime.Now, testCount + (int)lastTestNumber + 1);
                }
                EndX   = lastTestNumber + testCount;
                StartX = lastTestNumber;

                if (resetCursors)
                {
                    SelectionStart.Value = StartX;
                    SelectionEnd.Value   = StartX + 1;
                    resetCursors         = false;
                }
            }


            currentResults = results;
            if (testRunAxis != null)
            {
                testRunAxis.CurrentResults = currentResults;
            }

            if (Type == TestChartType.Results)
            {
                if (first != null)
                {
                    double x = timeScale ? first.TestDate.Ticks : results.Length;
                    serieFailed.AddData(x, first.ErrorsAndFailures);
                    serieSuccess.AddData(x, first.Passed);
                    serieIgnored.AddData(x, first.TestsNotRun);
                }

                for (int n = 0; n < results.Length; n++)
                {
                    UnitTestResult res = results [n];
                    double         x   = timeScale ? res.TestDate.Ticks : results.Length - n - 1;
                    serieFailed.AddData(x, res.ErrorsAndFailures);
                    serieSuccess.AddData(x, res.Passed);
                    serieIgnored.AddData(x, res.TestsNotRun);
                }
            }
            else
            {
                if (first != null)
                {
                    double x = timeScale ? first.TestDate.Ticks : results.Length;
                    serieTime.AddData(x, first.Time.TotalMilliseconds);
                }
                for (int n = 0; n < results.Length; n++)
                {
                    UnitTestResult res = results [n];
                    double         x   = timeScale ? res.TestDate.Ticks : results.Length - n - 1;
                    serieTime.AddData(x, results [n].Time.TotalMilliseconds);
                }
            }
        }