Example #1
0
        public List <Equipo> Leer(Letras letra)
        {
            try
            {
                string query = string.Format("SELECT * FROM Equipos WHERE grupo = '{0}'", letra);
                comando = new SqlCommand(query, conexion);
                conexion.Open();
                dataReader = comando.ExecuteReader();
                Equipo        equipo;
                List <Equipo> listaEquipo = new List <Equipo>();
                string        nombre;
                int           id;

                while (dataReader.Read())
                {
                    nombre = dataReader["nombre"].ToString();
                    id     = Convert.ToInt32(dataReader["id"]);
                    equipo = new Equipo(id, nombre);
                    listaEquipo.Add(equipo);
                }
                return(listaEquipo);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                conexion.Close();
                dataReader.Close();
            }
        }
Example #2
0
        public void Comecar()
        {
            if (string.IsNullOrEmpty(Expressao))
            {
                Source.SetResult(null);
            }
            else
            {
                var letras = new Letras();

                if (ContarEspacos)
                {
                    letras.Espacos = Expressao.ToCharArray().Count(x => x == ' ');
                }
                if (ContarVogais)
                {
                    letras.Vogais = Expressao.ToCharArray().Count(x => "aeiou".Contains(x.ToString()));
                }
                if (ContarConsonantes)
                {
                    letras.Consoantes = Expressao.ToCharArray().Count(x => !"aeiou".Contains(x.ToString()));
                }

                Source.SetResult(letras);
            }
        }
Example #3
0
        public ContadorLetras()
        {
            MainPage2 = new MainPage2();
            MainPage2.PublicButtonCancelar.Clicked += (sender, args) =>
            {
                Navigation.PopModalAsync(true);
                Source.SetResult(null);
            };

            MainPage2.PublicButtonConfirmar.Clicked += async(sender, args) =>
            {
                var letras = new Letras();

                if (MainPage2.PublicSwitchEspacos.IsToggled)
                {
                    letras.Espacos = Expressao.ToCharArray().Count(x => x == ' ');
                }
                if (MainPage2.PublicSwitchVogais.IsToggled)
                {
                    letras.Vogais = Expressao.ToCharArray().Count(x => "aeiou".Contains(x.ToString()));
                }
                if (MainPage2.PublicSwitchConsoantes.IsToggled)
                {
                    letras.Consoantes = Expressao.ToCharArray().Count(x => !"aeiou".Contains(x.ToString()));
                }

                await Navigation.PopModalAsync(true);

                Source.SetResult(letras);
            };
        }
Example #4
0
        public Grupo Leer()
        {
            GrupoDAO      grupo = null;
            SqlDataReader reader;

            try
            {
                string grupoStr;
                grupo = new GrupoDAO();
                grupo.sqlConnection.Open();
                grupo.command.CommandText = "SELECT * FROM Equipos";
                reader = grupo.command.ExecuteReader();
                while (reader.Read())
                {
                    grupoStr = reader["grupo"].ToString();
                    if (grupoStr == this.grupo.ToString())
                    {
                        this.equipos.Add(new Equipo(int.Parse(reader["id"].ToString()), reader["nombre"].ToString()));
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (!(grupo is null))
                {
                    grupo.sqlConnection.Close();
                }
            }
            return(this);
        }
Example #5
0
        public void ConstruirLetras(string sLetra, string sEquivalente)
        {
            Letras oLetra = new Letras();

            oLetra.Letra       = sLetra;
            oLetra.Equivalente = sEquivalente;
            ListaLetras.Add(oLetra);
        }
Example #6
0
        public void RetornaListaComAsPrimeirasNoveLetras(string resultado)
        {
            var letras = resultado.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            var lst    = Letras.PreencherLetras();

            foreach (var letra in letras)
            {
                lst.Should().Contain(letra);
            }
        }
        private void btn_imprimir_Click(object sender, EventArgs e)
        {
            string root     = @"N:\EXCEL";
            String fileName = @"N:\EXCEL\";

            if (!Directory.Exists(root))
            {
                Directory.CreateDirectory(root);
            }
            try
            {
                btn_imprimir.Enabled = false;
                int index = grd_Facturas.SelectedCells[0].RowIndex;

                objDocumentoCab = objListaDocumentoCab[index];

                formatearLetra();
                fileName = fileName + objDocumentoCab.DocumentoCabSerie.Substring(0, 1) + "-" + objDocumentoCab.DocumentoCabNro + ".xls";
                Letras cr = new Letras();


                cr.SetDataSource(objListaLetraReporte);

                ExportOptions              exportOpts      = new ExportOptions();
                ExcelFormatOptions         excelFormatOpts = new ExcelFormatOptions();
                DiskFileDestinationOptions diskOpts        = new DiskFileDestinationOptions();
                exportOpts = cr.ExportOptions;

                // Set the excel format options.
                excelFormatOpts.ExcelUseConstantColumnWidth = true;
                excelFormatOpts.ExcelTabHasColumnHeadings   = true;
                excelFormatOpts.ShowGridLines = true;
                exportOpts.ExportFormatType   = ExportFormatType.Excel;
                exportOpts.FormatOptions      = excelFormatOpts;

                // Set the disk file options and export.
                exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
                diskOpts.DiskFileName            = fileName;
                exportOpts.DestinationOptions    = diskOpts;

                cr.Export();

                PrintMyExcelFile(fileName);
                btn_imprimir.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
                btn_imprimir.Enabled = true;
            }
        }
Example #8
0
 public int InsertarLetras(Letras item)
 {
     lock (locker)
     {
         if (GetLetrasExists(item.IdLeccion) == true)
         {
             //Update Item
             database.Update(item);
             return(item.IdLeccion);
         }
         else
         {
             //Insert item
             return(database.Insert(item));
         }
     }
 }
Example #9
0
        public bool Leer()
        {
            Letras letra = Letras.A;

            do
            {
                string ruta      = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string finalPath = ruta + @"\grupo-" + letra + ".xml";
                //string ruta = string.Format("Grupo-{0}.xml", letra);
                if (File.Exists(finalPath))
                {
                    XmlTextReader reader = new XmlTextReader(finalPath);
                    XmlSerializer ser    = new XmlSerializer(typeof(Grupo));
                    Grupo         aux    = (Grupo)ser.Deserialize(reader);
                    reader.Close();
                    this.Grupos.Add(aux);
                }
                letra++;
            } while (letra < Letras.H);


            return(true);
        }
Example #10
0
        public ReporteView(String tipo)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.Manual;
            crystalReportViewer1.ToolPanelView = ToolPanelViewType.None;
            this.Location    = new Point(100, 0);
            this.MaximumSize = new Size(1500, 900);
            switch (tipo)
            {
            case "FF":
                FacturaFecha cr = new FacturaFecha();
                crystalReportViewer1.ReportSource = cr;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr.SetDataSource(FacturaReporte.objListFacturaReporte);
                FacturaReporte.objListFacturaReporte.Clear();
                break;

            case "BF":
                FacturaFecha cr2 = new FacturaFecha();
                crystalReportViewer1.ReportSource = cr2;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr2.SetDataSource(BoletaReporte.objListFacturaReporte);
                BoletaReporte.objListFacturaReporte.Clear();
                break;

            case "CF":
                NotaFecha cr3 = new NotaFecha();
                crystalReportViewer1.ReportSource = cr3;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr3.SetDataSource(NotaCreditoReporte.objListNotaReporte);
                NotaCreditoReporte.objListNotaReporte.Clear();
                break;

            case "DF":
                NotaFecha cr4 = new NotaFecha();
                crystalReportViewer1.ReportSource = cr4;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr4.SetDataSource(NotaDebitoReporte.objListNotaReporte);
                NotaDebitoReporte.objListNotaReporte.Clear();
                break;

            case "LF":
                FacturaFecha cr5 = new FacturaFecha();
                crystalReportViewer1.ReportSource = cr5;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr5.SetDataSource(ListaFactura.objListFacturaReporte);
                ListaFactura.objListFacturaReporte.Clear();
                break;

            case "LB":
                FacturaFecha cr6 = new FacturaFecha();
                crystalReportViewer1.ReportSource = cr6;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr6.SetDataSource(ListaBoleta.objListFacturaReporte);
                ListaBoleta.objListFacturaReporte.Clear();
                break;

            case "LC":
                NotaFecha cr7 = new NotaFecha();
                crystalReportViewer1.ReportSource = cr7;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr7.SetDataSource(ListaNotaCredito.objListNotaReporte);
                ListaNotaCredito.objListNotaReporte.Clear();
                break;

            case "LD":
                NotaFecha cr8 = new NotaFecha();
                crystalReportViewer1.ReportSource = cr8;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr8.SetDataSource(ListaNotaDebito.objListNotaReporte);
                ListaNotaDebito.objListNotaReporte.Clear();
                break;

            case "LL":
                Letras cr9 = new Letras();
                crystalReportViewer1.ReportSource = cr9;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr9.SetDataSource(ListaLetraCambio.objListaLetraReporte);
                ListaLetraCambio.objListaLetraReporte.Clear();
                break;

            case "EF":
                DocumentoExcel cr10 = new DocumentoExcel();
                crystalReportViewer1.ReportSource = cr10;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr10.SetDataSource(ReporteDocumentosPorFecha.objListaReporteExcel);
                ReporteDocumentosPorFecha.objListaReporteExcel.Clear();
                break;

            case "EC":
                DocumentoExcel cr11 = new DocumentoExcel();
                crystalReportViewer1.ReportSource = cr11;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr11.SetDataSource(ReporteDocumentosPorCliente.objListaReporteExcel);
                ReporteDocumentosPorCliente.objListaReporteExcel.Clear();
                break;

            case "VO":
                VoucherRpt cr12 = new VoucherRpt();
                crystalReportViewer1.ReportSource = cr12;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr12.SetDataSource(Caja.EmisionVoucher.objListaVoucherReporte);
                Caja.EmisionVoucher.objListaVoucherReporte.Clear();
                break;

            case "VOD":
                VoucherRptDolar cr13 = new VoucherRptDolar();
                crystalReportViewer1.ReportSource = cr13;
                // System.Web.HttpResponse res = new System.Web.HttpResponse();
                cr13.SetDataSource(Caja.EmisionVoucher.objListaVoucherReporte);
                Caja.EmisionVoucher.objListaVoucherReporte.Clear();
                break;

            case "LCRC":
                CanjeLetra cr14 = new CanjeLetra();
                crystalReportViewer1.ReportSource = cr14;
                cr14.SetDataSource(Facturacion.CanjeLetraNuevo.objListaLetraReporte);
                Facturacion.CanjeLetraNuevo.objListaLetraReporte.Clear();
                break;

            case "RDC":
                ReporteDiarioC cr15 = new ReporteDiarioC();
                crystalReportViewer1.ReportSource = cr15;
                cr15.SetDataSource(Reporte.ReporteDiario.objListaReporte);
                Reporte.ReporteDiario.objListaReporte.Clear();
                break;

            case "RFMP":
                ReporteMensualProveedor cr16 = new ReporteMensualProveedor();
                crystalReportViewer1.ReportSource = cr16;
                cr16.SetDataSource(Reporte.ReporteFacturaProveeodr.objListaVenReporte);
                Reporte.ReporteFacturaProveeodr.objListaVenReporte.Clear();
                break;

            case "RFTP":
                ReporteTotalizadoProveedor cr17 = new ReporteTotalizadoProveedor();
                crystalReportViewer1.ReportSource = cr17;
                cr17.SetDataSource(Reporte.ReporteFacturaProveedorTotalizado.objListaVenReporte);
                Reporte.ReporteFacturaProveedorTotalizado.objListaVenReporte.Clear();
                break;

            case "RLV":
                ReporteLetraVencimineto cr18 = new ReporteLetraVencimineto();
                crystalReportViewer1.ReportSource = cr18;
                cr18.SetDataSource(Facturacion.CanjeLetra.objListaVenReporte);
                Facturacion.CanjeLetra.objListaVenReporte.Clear();
                break;

            case "RLVC":
                ReporteLetraVencimineto cr19 = new ReporteLetraVencimineto();
                crystalReportViewer1.ReportSource = cr19;
                cr19.SetDataSource(Reporte.ReporteLetraCliente.objListaVenReporte);
                Reporte.ReporteLetraCliente.objListaVenReporte.Clear();
                break;
            }
        }
Example #11
0
        public void PassarLetrasERetornarNaoEstaNaOrdemAlfabetica()
        {
            Letras letras = new Letras('W', 'E');

            Assert.AreEqual(letras.ContarIntervaloLetras(), "Não está na ordem alfabética");
        }
Example #12
0
        public void PassarLetrasERetornar24()
        {
            Letras letras = new Letras('A', 'Z');

            Assert.AreEqual(letras.ContarIntervaloLetras(), "24");
        }
Example #13
0
        public void LetrasForaDaOrdemAlfabetica()
        {
            Letras letras = new Letras('K', 'E');

            Assert.IsFalse(letras.VerificarOrdem());
        }
Example #14
0
        public void LetrasDentroDaOrdemAlfabetica()
        {
            Letras letras = new Letras('B', 'H');

            Assert.IsTrue(letras.VerificarOrdem());
        }
 public ResultadoActivity()
 {
     _letras = new Letras();
 }
Example #16
0
 public Grupo(Letras grupo, short maxCantidad)
     : this()
 {
     this.grupo       = grupo;
     this.maxCantidad = maxCantidad;
 }
        private void btn_excel_Click(object sender, EventArgs e)
        {
            try
            {
                btn_excel.Enabled = false;
                // String fileName = @"C:\FACTURACION\EXCEL\";
                //String path = @"C:\FACTURACION\EXCEL";
                String fileName = @"N:\EXCEL\";
                String path     = @"N:\EXCEL";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                int index = grd_Facturas.SelectedCells[0].RowIndex;

                objDocumentoCab = objListaDocumentoCab[index];
                formatearLetra();
                Random rnd       = new Random();
                int    randomnum = rnd.Next(1000);


                fileName = fileName + objDocumentoCab.DocumentoCabSerie.Substring(0, 1) + " - " + objDocumentoCab.DocumentoCabNro + "-" + randomnum + ".xls";
                Letras cr = new Letras();


                cr.SetDataSource(objListaLetraReporte);

                ExportOptions              exportOpts      = new ExportOptions();
                ExcelFormatOptions         excelFormatOpts = new ExcelFormatOptions();
                DiskFileDestinationOptions diskOpts        = new DiskFileDestinationOptions();
                exportOpts = cr.ExportOptions;

                // Set the excel format options.
                excelFormatOpts.ExcelUseConstantColumnWidth = true;
                excelFormatOpts.ExcelTabHasColumnHeadings   = true;
                excelFormatOpts.ShowGridLines = true;
                exportOpts.ExportFormatType   = ExportFormatType.Excel;
                exportOpts.FormatOptions      = excelFormatOpts;

                // Set the disk file options and export.
                exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
                diskOpts.DiskFileName            = fileName;
                exportOpts.DestinationOptions    = diskOpts;

                cr.Export();
                FileInfo fi = new FileInfo(fileName);
                if (fi.Exists)
                {
                    System.Diagnostics.Process.Start(fileName);
                }
                else
                {
                    //file doesn't exist
                }

                btn_excel.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR :" + ex.Message);
                btn_excel.Enabled = true;
            }
        }