Ejemplo n.º 1
0
        private void btnDisponibilidad_Click(object sender, EventArgs e)
        {
            BaseDeDatos bd  = new BaseDeDatos();
            DataSet     res = bd.CheckDisponibilidad(dtpFecha.Value.ToString("yyyyMMdd"));

            if (res.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("Fecha disponible.");
                this.Close();
            }
            else
            {
                MessageBox.Show("Fecha no disponible.");
                this.Close();
            }
        }
Ejemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         BaseDeDatos bd = new BaseDeDatos();
         dt = bd.GetPaqueteInfo1(Convert.ToInt32(cmbPaquete.SelectedValue));
         foreach (DataRow dr in dt.Rows)
         {
             dgvData.Rows.Add(dr.ItemArray);
         }
         dgvData.AutoResizeColumns();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            string       info   = DGVtoText(dgvData, '\t');
            BaseDeDatos  bd     = new BaseDeDatos();
            DialogResult dialog = MessageBox.Show("¿Desea Pagar con tarjeta?", "Metodo de Pago", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialog == DialogResult.No)
            {
                using (var efectivo = new FrmEfectivo(txbTotal.Text.ToString()))
                {
                    var result = efectivo.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        Boolean res = bd.RegistrarVenta(txbNotas.Text.ToString(), Convert.ToDouble(txbTotal.Text), dtpFecha.Value.ToString("yyyyMMdd"), Convert.ToInt32(lblidCliente.Text), Convert.ToInt32(cmbCotizacion.SelectedValue), info, efectivo.folio);
                        if (res)
                        {
                            PDF(efectivo.folio);
                        }
                        else
                        {
                            MessageBox.Show("No se registro la venta en la base de datos.");
                        }
                    }
                }
            }
            else if (dialog == DialogResult.Yes)
            {
                using (var tarjeta = new FrmTarjeta(txbTotal.Text.ToString()))
                {
                    var result = tarjeta.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        Boolean res = bd.RegistrarVenta(txbNotas.Text.ToString(), Convert.ToDouble(txbTotal.Text), dtpFecha.Value.ToString("yyyyMMdd"), Convert.ToInt32(lblidCliente.Text), Convert.ToInt32(cmbCotizacion.SelectedValue), info, tarjeta.folio);
                        if (res)
                        {
                            PDF(tarjeta.folio);
                        }
                        else
                        {
                            MessageBox.Show("No se registro la venta en la base de datos.");
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void btnCrear_Click(object sender, EventArgs e)
        {
            string      elementos = Elementos();
            BaseDeDatos bd        = new BaseDeDatos();

            if (String.IsNullOrWhiteSpace(txbNombre.Text))
            {
                MessageBox.Show("Ingrese un nombre.");
            }
            Boolean res = bd.RegistrarPaquete(txbNombre.Text.ToString(), elementos, Convert.ToDouble(tbxCosto.Text));

            if (res)
            {
                MessageBox.Show("Se registro el paquete.");
            }
            else
            {
                MessageBox.Show("No se registro el paquete.");
            }
        }
Ejemplo n.º 5
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txbNombre.Text) && !String.IsNullOrWhiteSpace(txbCosto.Text))
            {
                BaseDeDatos bd  = new BaseDeDatos();
                Boolean     res = bd.RegistrarProducto(txbNombre.Text.ToString(), Convert.ToDouble(txbCosto.Text));

                if (res)
                {
                    MessageBox.Show("Producto Registrado");
                }
                else
                {
                    MessageBox.Show("No se pudo registrar producto.");
                }
            }
            else
            {
                MessageBox.Show("Llene todos los campos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txbNombre.Text) && !String.IsNullOrWhiteSpace(txbApellido.Text) && !String.IsNullOrWhiteSpace(txbDireccion.Text) && !String.IsNullOrWhiteSpace(txbCorreo.Text) && !String.IsNullOrWhiteSpace(txbTelefono.Text) && !String.IsNullOrWhiteSpace(txbUsuario.Text) && !String.IsNullOrWhiteSpace(txbPsswd.Text))
            {
                BaseDeDatos bd = new BaseDeDatos();

                Boolean res = bd.RegistrarUsuario(txbNombre.Text.ToString() + " " + txbApellido.Text.ToString(), txbDireccion.Text.ToString(), txbCorreo.Text.ToString(), txbTelefono.Text.ToString(), txbUsuario.Text.ToString(), txbPsswd.Text.ToString());

                if (res)
                {
                    MessageBox.Show("Se registro Usuario");
                }
                else
                {
                    MessageBox.Show("No se pudo registrar");
                }
            }
            else
            {
                MessageBox.Show("Llene todos los campos.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 7
0
        private void btnSelec_Click(object sender, EventArgs e)
        {
            BaseDeDatos bd     = new BaseDeDatos();
            int         a      = Convert.ToInt32(cmbCotizacion.SelectedValue);
            DataSet     ds     = bd.GetCotizacionInfo(a);
            var         nombre = ds.Tables[0].Rows[0][2];

            txbNombreCliente.Text = nombre.ToString();
            var idCliente = ds.Tables[0].Rows[0][1];

            lblidCliente.Text = idCliente.ToString();
            var notas = ds.Tables[0].Rows[0][4];

            txbNotas.Text = notas.ToString();
            var total = ds.Tables[0].Rows[0][5];

            txbTotal.Text = total.ToString();
            var       info = ds.Tables[0].Rows[0][3];
            DataTable temp = ProductInfo(info.ToString());

            dgvData.DataSource = temp;
        }
Ejemplo n.º 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            BaseDeDatos bd = new BaseDeDatos();

            if (String.IsNullOrWhiteSpace(txbNombre.Text) || String.IsNullOrWhiteSpace(txbDireccion.Text) || String.IsNullOrWhiteSpace(txbTelefono.Text) || String.IsNullOrWhiteSpace(tbxCorreo.Text))
            {
                MessageBox.Show("Llene todos los campos");
            }
            else
            {
                Boolean res = bd.RegistrarCliente(txbNombre.Text.ToString(), txbDireccion.Text.ToString(), txbTelefono.Text.ToString(), tbxCorreo.Text.ToString());
                if (res)
                {
                    MessageBox.Show("Cliente Registrado con Exito.", "", MessageBoxButtons.OK);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("No se pudo registrar el cliente");
                    this.Close();
                }
            }
        }
Ejemplo n.º 9
0
        private void btnEntregado_Click(object sender, EventArgs e)
        {
            BaseDeDatos bd  = new BaseDeDatos();
            Boolean     res = bd.RegistrarEntrega(Convert.ToInt32(dgvData.SelectedRows[0].Cells[0].Value), xEstado);

            if (res)
            {
                if (Convert.ToInt32(BaseDeDatos.rol) == 4)
                {
                    SendEmail();
                    MessageBox.Show("Se marco como entregado. Encuesta Enviada");
                }
                else
                {
                    MessageBox.Show("Se marco como elaborado.");
                }
            }

            foreach (DataGridViewRow row in dgvData.SelectedRows)
            {
                dgvData.Rows.RemoveAt(row.Index);
            }
        }
Ejemplo n.º 10
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         string      id     = dgvData.SelectedCells[0].Value.ToString();
         string      nombre = dgvData.SelectedCells[1].Value.ToString();
         string      costo  = dgvData.SelectedCells[2].Value.ToString();
         BaseDeDatos bd     = new BaseDeDatos();
         Boolean     res    = bd.UpdateProducto(nombre, costo, id);
         if (res)
         {
             MessageBox.Show("Producto actualizado con exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             FillDGV();
         }
         else
         {
             MessageBox.Show("No se actualizo el producto", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Seleccione alguna columna", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 11
0
        private void FrmVentas_Load(object sender, EventArgs e)
        {
            //dgvData.Columns.Add("idProducto", "idProducto");
            //dgvData.Columns.Add("NombreProducto", "Nombre del Producto");
            //dgvData.Columns.Add("Costo", "Costo");

            BaseDeDatos bd = new BaseDeDatos();

            //Fill idCotizacion
            DataSet cot = bd.GetCotizacion();

            cmbCotizacion.DataSource    = cot.Tables[0];
            cmbCotizacion.DisplayMember = "idCotizacion";
            cmbCotizacion.ValueMember   = "idCotizacion";
            cmbCotizacion.SelectedIndex = -1;

            DataSet paquetes = bd.GetPaquete();

            cmbPaquetes.DataSource    = paquetes.Tables[0];
            cmbPaquetes.DisplayMember = "NombrePaquete";
            cmbPaquetes.ValueMember   = "idPaquete";
            cmbPaquetes.SelectedIndex = -1;

            DataSet producto = bd.GetProductos();

            cmbProductos.DataSource    = producto.Tables[0];
            cmbProductos.DisplayMember = "NombreProducto";
            cmbProductos.ValueMember   = "idProducto";
            cmbProductos.SelectedIndex = -1;

            cmbCotizacion.Select();
            if (idCotizacion != "")
            {
                cmbCotizacion.SelectedValue = idCotizacion;
            }
        }
Ejemplo n.º 12
0
        private void PDF(string folio)
        {
            BaseDeDatos bd = new BaseDeDatos();

            string[]    datos    = bd.GetLastVenta().ToArray();
            PdfDocument document = new PdfDocument();

            document.Info.Title = "Venta";
            Console.WriteLine(datos[0]);
            Console.ReadLine();

            // Create an empty page
            PdfPage page = document.AddPage();

            page.Size = PageSize.Statement;

            // Get an XGraphics object for drawing
            XGraphics gfx  = XGraphics.FromPdfPage(page);
            XFont     font = new XFont("Times New Roman", 14, XFontStyle.Regular);

            XTextFormatter tf = new XTextFormatter(gfx);

            //idCotizacion
            idcotizacion = datos[0];
            string idcot = "Venta#" + datos[0] + @"
Folio de Pago: " + folio;
            XRect  rect  = new XRect(-20, 12, page.Width, page.Height);

            font = new XFont("Times New Roman", 12, XFontStyle.Bold);
            gfx.DrawRectangle(XBrushes.White, rect);
            tf.Alignment = XParagraphAlignment.Right;
            tf.DrawString(idcot, font, XBrushes.Black, rect, XStringFormats.TopLeft);

            //Titulo
            string titulo = "Reposteria";

            rect = new XRect(0, 60, page.Width, page.Height);
            font = new XFont("Times New Roman", 24, XFontStyle.Bold);
            gfx.DrawRectangle(XBrushes.White, rect);
            tf.Alignment = XParagraphAlignment.Center;
            tf.DrawString(titulo, font, XBrushes.Black, rect, XStringFormats.TopLeft);

            //Datos Cliente
            string cliente = "idCliente: " + datos[1] + @"
Nombre del Cliente: " + datos[2];

            rect = new XRect(40, 90, page.Width, page.Height);
            font = new XFont("Times New Roman", 12, XFontStyle.Bold);
            gfx.DrawRectangle(XBrushes.White, rect);
            tf.Alignment = XParagraphAlignment.Left;
            tf.DrawString(cliente, font, XBrushes.Black, rect, XStringFormats.TopLeft);

            //Fecha
            string fecha = "Fecha: " + datos[3];

            rect = new XRect(-20, 120, page.Width, page.Height);
            font = new XFont("Times New Roman", 12, XFontStyle.Bold);
            gfx.DrawRectangle(XBrushes.White, rect);
            tf.Alignment = XParagraphAlignment.Right;
            tf.DrawString(fecha, font, XBrushes.Black, rect, XStringFormats.TopLeft);

            //Notas y Precio
            string notprec = "Detalles: " + datos[4] + @"
Costo: $" + datos[5];

            rect = new XRect(40, 150, page.Width, page.Height);
            font = new XFont("Times New Roman", 12, XFontStyle.Bold);
            gfx.DrawRectangle(XBrushes.White, rect);
            tf.Alignment = XParagraphAlignment.Left;
            tf.DrawString(notprec, font, XBrushes.Black, rect, XStringFormats.TopLeft);

            string prodTI = @"Productos

";

            rect = new XRect(40, 190, page.Width, page.Height);
            font = new XFont("Times New Roman", 12, XFontStyle.Bold);
            gfx.DrawRectangle(XBrushes.White, rect);
            tf.Alignment = XParagraphAlignment.Left;
            tf.DrawString(prodTI, font, XBrushes.Black, rect, XStringFormats.TopLeft);


            //Productos
            string prod = datos[6];

            rect = new XRect(0, 220, page.Width, page.Height);
            font = new XFont("Times New Roman", 12, XFontStyle.BoldItalic);
            gfx.DrawRectangle(XBrushes.White, rect);
            tf.Alignment = XParagraphAlignment.Center;
            tf.DrawString(prod, font, XBrushes.Black, rect, XStringFormats.TopLeft);


            string filename = "Venta.pdf";

            document.Save(filename);

            Process.Start(filename);
        }