Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox2.Text != "" && textBox3.Text != "")
                {
                    var v = new DVehiculo();
                    v.Idvehiculo     = Convert.ToInt32(textBox1.Text);
                    v.Nombrevehiculo = textBox2.Text.ToUpper();
                    v.Volumen        = Convert.ToInt32(textBox3.Text);

                    if (NVehiculo.agregar(v))
                    {
                        MessageBox.Show("Datos guardados correctamente.");
                        limpiar();
                        Id();
                        listado();
                    }
                    else
                    {
                        MessageBox.Show("Error, Verifique que los datos sean correctos.");
                    }
                }

                else
                {
                    MessageBox.Show("Debe ingresar datos en los dos campos.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         var v = new DVehiculo();
         v.Idvehiculo = Convert.ToInt32(textBox1.Text);
         if (NVehiculo.eliminar(v))
         {
             MessageBox.Show("Se elimino Correctamente.");
             limpiar();
             Id();
             listado();
             button1.Enabled = true;
             button2.Enabled = false;
             button3.Enabled = false;
             button4.Enabled = false;
         }
         else
         {
             MessageBox.Show("Error verifique sus datos");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 public Inicio()
 {
     InitializeComponent();
     cbTipoVehiculo.DisplayMemberPath = "Nombre";
     cbTipoVehiculo.SelectedValuePath = "Id_Tipo";
     cbTipoVehiculo.ItemsSource       = NVehiculo.MostrarTipo().DefaultView;
 }
        private void BtnSalidaVehiculo_Click(object sender, RoutedEventArgs e)
        {
            if (TxtPlaca.Text != "")
            {
                DataTable dtv = NVehiculo.VerificarVehiculo(TxtPlaca.Text);
                if (dtv.Rows.Count > 0)
                {
                    DataTable dt = new DataTable();
                    dt = NVehiculo.SalidaVehiculo(TxtPlaca.Text);
                    DataRow dr = dt.Rows[0];

                    factura.TxtTiempo.Text = dr[0].ToString() + " horas con " + dr[1].ToString() + " minutos.";
                    factura.TxtTotal.Text  = dr[2].ToString();
                    factura.ShowDialog();
                }
                else
                {
                    MessageBox.Show("El vehiculo no se encuentra en el estacionamiento");
                }
            }
            else
            {
                MessageBox.Show("Ingrese el numero de placa. ");
            }

            TxtPlaca.Clear();
        }
Ejemplo n.º 5
0
 private void Id()
 {
     try
     {
         var i = new DVehiculo();
         i.Idvehiculo  = NVehiculo.Id() + 1;
         textBox1.Text = Convert.ToString(i.Idvehiculo);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 6
0
 private void listado()
 {
     try
     {
         DataTable datos = new DataTable();
         datos = NVehiculo.ListadoVechiculos();
         dataGridView1.DataSource = datos;
         dataGridView1.Refresh();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 7
0
        private void PVehiculo_Load(object sender, EventArgs e)
        {
            vehiculo                = new NVehiculo();
            comboTipo.DataSource    = tipo.ShowTipos();
            comboTipo.ValueMember   = "id";
            comboTipo.DisplayMember = "descripcion";



            comboCliente.DataSource    = cliente.ShowClientes();
            comboCliente.DisplayMember = "nombre";
            comboCliente.ValueMember   = "id";

            dataGridView1.DataSource = vehiculo.ShowVehiculos();
        }
        public Vehiculo()
        {
            InitializeComponent();
            DataTable             dt    = NVehiculo.MostrarVehiculo();
            IList <VehiculoLista> Lista = new List <VehiculoLista>();

            foreach (DataRow dr in dt.Rows)
            {
                Lista.Add(new VehiculoLista
                {
                    Placa         = dr[0].ToString(),
                    Tipo_Vehiculo = dr[1].ToString(),
                });
            }
            LbVehiculo.ItemsSource = Lista;
        }
Ejemplo n.º 9
0
        public Estacionamiento()
        {
            InitializeComponent();
            DataTable dt = NVehiculo.MostrarEstacionamiento();
            IList <EstacionamientoLista> Lista = new List <EstacionamientoLista>();

            foreach (DataRow dr in dt.Rows)
            {
                Lista.Add(new EstacionamientoLista
                {
                    Placa         = dr[0].ToString(),
                    Tipo_Vehiculo = dr[1].ToString(),
                    Hora_Ingreso  = dr[2].ToString()
                });
            }
            LbEstacionamiento.ItemsSource = Lista;
        }
 private void BtnIngresarVehiculo_Click(object sender, RoutedEventArgs e)
 {
     if (TxtPlaca.Text != "" && cbTipoVehiculo.SelectedItem != null)
     {
         DataTable dt = NVehiculo.VerificarVehiculo(TxtPlaca.Text);
         if (dt.Rows.Count < 1)
         {
             rpta = NVehiculo.IngresoVehiculo(TxtPlaca.Text, Convert.ToInt32(cbTipoVehiculo.SelectedValue));
             MessageBox.Show(rpta);
         }
         else
         {
             MessageBox.Show("El vehiculo ya esta en el estacionamiento");
         }
     }
     else
     {
         MessageBox.Show("Seleccione o escriba un valor.");
     }
     TxtPlaca.Clear();
 }
Ejemplo n.º 11
0
        public Reporte()
        {
            InitializeComponent();
            DataTable            dt    = NVehiculo.MostrarReporte();
            IList <ReporteLista> Lista = new List <ReporteLista>();

            foreach (DataRow dr in dt.Rows)
            {
                Lista.Add(new ReporteLista
                {
                    Placa        = dr[0].ToString(),
                    Hora_Entrada = dr[1].ToString(),
                    Hora_Salida  = dr[2].ToString(),
                    Tiempo       = dr[3].ToString(),
                    Total        = dr[4].ToString(),
                    Fecha        = dr[5].ToString()
                });
                ingresototal = ingresototal + Convert.ToInt32(dr[4]);
            }
            tbIngresos.Text = ingresototal.ToString();
            LbReporteGeneral.ItemsSource = Lista;
        }
Ejemplo n.º 12
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente Desea Eliminar los Registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                if (Opcion == DialogResult.OK)
                {
                    string ID;
                    string respuesta = "";

                    foreach (DataGridViewRow row in dgvListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            ID        = Convert.ToString(row.Cells[1].Value);
                            respuesta = NVehiculo.Eliminar(Convert.ToInt32(ID));

                            if (respuesta.Equals("OK"))
                            {
                                this.MensajeOk("Se Eliminó Correctamente el registro");
                            }
                            else
                            {
                                this.MensajeError(respuesta);
                            }
                        }
                    }
                    this.Mostrar();
                    this.chbEliminar.Checked = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 13
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = "";
                if (this.txtModelo.Text == string.Empty || this.txtMarca.Text == string.Empty || this.cbxCategoria.Text == string.Empty || this.txtColor.Text == string.Empty || this.txtAno.Text == string.Empty || this.txtDescripcion.Text == string.Empty || this.txtPrecio.Text == string.Empty || this.txtProveedor.Text == string.Empty || this.txtIDProveedor.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos relevantes");
                    errorIcono.SetError(txtModelo, "Ingrese un Valor");
                    errorIcono.SetError(txtMarca, "Ingrese un Valor");
                    errorIcono.SetError(cbxCategoria, "Ingrese un Valor");
                    errorIcono.SetError(txtColor, "Ingrese un Valor");
                    errorIcono.SetError(txtAno, "Ingrese un Valor");
                    errorIcono.SetError(txtDescripcion, "Ingrese un Valor");
                    errorIcono.SetError(txtPrecio, "Ingrese un Valor");
                    errorIcono.SetError(txtProveedor, "Ingrese un Valor");
                    errorIcono.SetError(txtIDProveedor, "Ingrese un Valor");
                }
                else
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    this.pbxImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                    byte[] imagen = ms.GetBuffer();


                    if (this.IsNuevo)
                    {
                        respuesta = NVehiculo.Insertar(this.txtModelo.Text.Trim().ToUpper(), this.txtMarca.Text.Trim().ToUpper(), this.cbxCategoria.Text, txtColor.Text, txtAno.Text, txtDescripcion.Text, Convert.ToDecimal(txtPrecio.Text), imagen, Convert.ToInt32(this.txtIDProveedor.Text));
                    }
                    else
                    {
                        respuesta = NVehiculo.Editar(Convert.ToInt32(this.txtID.Text), this.txtModelo.Text.Trim().ToUpper(), this.txtMarca.Text.Trim().ToUpper(), this.cbxCategoria.Text, txtColor.Text, txtAno.Text, txtDescripcion.Text, Convert.ToDecimal(txtPrecio.Text), imagen, Convert.ToInt32(this.txtIDProveedor.Text));
                    }

                    if (respuesta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se Insertó de forma correcta el registro");
                        }
                        else
                        {
                            this.MensajeOk("Se Actualizó de forma correcta el registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(respuesta);
                    }

                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                    this.pbxImagen.Image = null;
                }
                gbxListado.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 14
0
 private void vehiculo()
 {
     comboBox3.DataSource    = NVehiculo.ListadoVechiculos();
     comboBox3.DisplayMember = "Vehiculo";
     comboBox3.ValueMember   = "Id_Vehiculo";
 }
Ejemplo n.º 15
0
 //Método Mostrar
 private void Mostrar()
 {
     this.dgvListado.DataSource = NVehiculo.Mostrar();
     this.OcultarColumnas();
 }
Ejemplo n.º 16
0
 //Método Buscar Modelo
 private void BuscarModelo()
 {
     this.dgvListado.DataSource = NVehiculo.BuscarModelo(this.txtBusqueda.Text);
     this.OcultarColumnas();
 }
Ejemplo n.º 17
0
 //Método Buscar Proveedor
 private void BuscarProveedor()
 {
     this.dgvListado.DataSource = NVehiculo.BuscarProveedor(this.txtBusqueda2.Text);
     this.OcultarColumnas();
 }