private double MostrarTotalFacturado(EVehiculos vehiculo) { double retorno = 0; if (this.Vehiculos.Count > 0) { foreach (Vehiculo item in this.Vehiculos) { switch (vehiculo) { case EVehiculos.Auto: if (item is Auto) { retorno += this.precioAuto; } break; case EVehiculos.Camion: if (item is Camion) { retorno += this.precioCamion; } break; case EVehiculos.Moto: if (item is Moto) { retorno += this.precioMoto; } break; } } } return(retorno); }
public double MostrarTotalFacturado(EVehiculos vehiculos) { double retorno = 0; int contAutos = 0; int contCamion = 0; int contMotos = 0; foreach (Vehiculo item in this._vehiculos) { if (item is Auto) { contAutos++; } else if (item is Camion) { contCamion++; } else if (item is Moto) { contMotos++; } } switch (vehiculos) { case EVehiculos.Autos: { retorno = contAutos * Lavadero._precioAuto; } break; case EVehiculos.Camion: { retorno = contCamion * Lavadero._precioCamion; } break; case EVehiculos.Moto: { retorno = contMotos * Lavadero._precioMoto; } break; default: break; } /*if (vehiculos == EVehiculos.Autos) * { * retorno = contAutos * Lavadero._precioAuto; * } * else if (vehiculos == EVehiculos.Camion) * { * retorno = contCamion * Lavadero._precioCamion; * } * else if (vehiculos == EVehiculos.Moto) * { * retorno = contMotos * Lavadero._precioMoto; * }*/ return(retorno); }
private void FrmObservarVehiculos_OnDgvDoubleClick(object sender, EventArgs e) { try { EVehiculos eVehiculo = (EVehiculos)sender; FrmNuevoVehiculo frm = new FrmNuevoVehiculo { TopLevel = false, IsEditar = true }; Form FormComprobado = this.ComprobarExistencia(frm); frm.AsignarDatos(eVehiculo); if (FormComprobado != null) { FormComprobado.WindowState = FormWindowState.Normal; FormComprobado.Activate(); } else { this.panelPrincipal.Controls.Add(frm); this.panelPrincipal.Tag = frm; frm.Show(); } frm.BringToFront(); } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "FrmObservarVehiculos_OnDgvDoubleClick", "Hubo un error con el botón editar vehículo", ex.Message); } }
public double MostrarTotalFacturado(EVehiculos vehiculos) { double retorno = 0; foreach (Vehiculo v in this._vehiculos) { if (vehiculos == EVehiculos.Moto) { if (v is Moto) { retorno += this._precioMoto; } } if (vehiculos == EVehiculos.Camion) { if (v is Camion) { retorno += this._precioCamion; } } if (vehiculos == EVehiculos.Auto) { if (v is Auto) { retorno += this._precioAuto; } } } return(retorno); }
public double MostrarTotalFacturado(EVehiculos vehiculo) { double ganancia = 0; foreach (Vehiculo v in vehiculos) { switch (vehiculo) { case EVehiculos.Auto: if (v is Auto) { ganancia = +this.precioAuto; } break; case EVehiculos.Camion: if (v is Camion) { ganancia = +this.precioAuto; } break; case EVehiculos.Moto: if (v is Moto) { ganancia = +this.precioAuto; } break; default: break; } } return(ganancia); }
public double MostrarTotalFacturado(EVehiculos vehiculos) { double total = 0; foreach (Vehiculo vehiculo in this._vehiculos) { switch (vehiculos) { case EVehiculos.Auto: if (vehiculo is Auto) { total += Lavadero._precioAuto; } break; case EVehiculos.Moto: if (vehiculo is Moto) { total += Lavadero._precioMoto; } break; case EVehiculos.Camion: if (vehiculo is Camion) { total += Lavadero._precioCamion; } break; default: break; } } return(total); }
private void BtnEditar_Click(object sender, EventArgs e) { DataGridViewRow dataGridRow = this.dgvVehiculos.CurrentRow; if (dataGridRow != null) { if (frmNuevoVehiculo != null) { frmNuevoVehiculo.Close(); } DataRow row = ((DataRowView)dataGridRow.DataBoundItem).Row; EVehiculos eVehiculo = new EVehiculos(row); frmNuevoVehiculo = new FrmNuevoVehiculo { Dock = DockStyle.Fill, FormBorderStyle = FormBorderStyle.None, TopLevel = false, IsEditar = true }; frmNuevoVehiculo.AsignarDatos(eVehiculo); frmNuevoVehiculo.OnVehiculoEditSuccess += FrmNuevoVehiculo_OnVehiculoAddSuccess; this.container = new PoperContainer(frmNuevoVehiculo); frmNuevoVehiculo.Show(); this.container.Show(btnAgregar); } }
public Double MostrarTotalFacturado(EVehiculos eVehiculos) { Double suma = 0; Double precio = 0; if (eVehiculos == EVehiculos.Auto) { precio = this.precioAuto; } else if (eVehiculos == EVehiculos.Camion) { precio = this.precioCamion; } else if (eVehiculos == EVehiculos.Moto) { precio = this.precioMoto; } foreach (Vehiculo vehiculo in vehiculos) { if (vehiculo.GetType().ToString() == eVehiculos.ToString()) { suma += precio; } } return(suma); }
private double MostrarTotalFacturado(EVehiculos vehiculo) { double total = 0; foreach (Vehiculo item in this.Vehiculos) { if (EVehiculos.Auto == vehiculo) { if (item is Auto) { total += this._precioAuto; } } else if (EVehiculos.Moto == vehiculo) { if (item is Moto) { total += this._precioMoto; } } else if (EVehiculos.Camion == vehiculo) { if (item is Camion) { total += this._precioCamion; } } } return(total); }
public double MostrarTotalFacturado(EVehiculos vehiculo) { double ganacia = 0; foreach (Vehiculo v in this._vehiculos) { switch (vehiculo) { case EVehiculos.Auto: if (v is Auto) { ganacia += Lavadero._precioAuto; } break; case EVehiculos.Camion: if (v is Camion) { ganacia += Lavadero._precioCamion; } break; case EVehiculos.Moto: if (v is Moto) { ganacia += Lavadero._precioMoto; } break; } } return(ganacia); }
private void FrmObservarVehiculos_OnDgvDoubleClick(object sender, EventArgs e) { EVehiculos eVehiculo = (EVehiculos)sender; this.btnSeleccionar.Text = "Vehículo seleccionado: " + eVehiculo.Id_vehiculo; this.btnSeleccionar.Tag = eVehiculo; }
private void PanelVehiculos_OnBsPositionChanged(object sender, EventArgs e) { if (positionChanged != this.panelVehiculos.bs.Position) { DataTable dtVehiculos = (DataTable)sender; List <UserControl> controls = new List <UserControl>(); foreach (DataRow row in dtVehiculos.Rows) { EVehiculos eVehiculo = new EVehiculos(row); ECronogramas eCronograma = new ECronogramas { EVehiculo = eVehiculo, Fecha_cronograma = DateTime.Now, Estado_cronograma = "ACTIVO", }; VehiculoCronogramaSmall vehiculoCronogramaSmall = new VehiculoCronogramaSmall { ECronograma = eCronograma, }; vehiculoCronogramaSmall.OnBtnOkClick += VehiculoCronogramaSmall_OnBtnOkClick; controls.Add(vehiculoCronogramaSmall); } this.panelVehiculos.AddArrayControl(controls); } }
public double MostrarTotalFacturado(EVehiculos unVehiculo) { double ganancia = 0; foreach (Vehiculo autito in _vehiculos) { if (autito is Auto && unVehiculo.ToString() == "Auto") { ganancia += _precioAuto; } else { if (autito is Camion && unVehiculo.ToString() == "Camion") { ganancia += _precioCamion; } else { if (autito is Moto && unVehiculo.ToString() == "Moto") { ganancia += _precioMoto; } } } } return(ganancia); }
private void BuscarVehiculos(string tipo_busqueda, string texto_busqueda) { try { DataTable dtVehiculos = EVehiculos.BuscarVehiculos(tipo_busqueda, texto_busqueda, out string rpta); this.panelVehiculos.clearDataSource(); if (dtVehiculos != null) { this.panelVehiculos.BackgroundImage = null; this.panelVehiculos.PageSize = 10; this.panelVehiculos.OnBsPositionChanged += PanelVehiculos_OnBsPositionChanged; this.panelVehiculos.SetPagedDataSource(dtVehiculos, this.bindingNavigator1); } else { this.panelVehiculos.BackgroundImage = Properties.Resources.No_hay_vehiculos; this.panelVehiculos.BackgroundImageLayout = ImageLayout.Center; if (!rpta.Equals("OK")) { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BuscarVehiculos", "Hubo un error al buscar los vehículos", ex.Message); } }
public double MostrarTotalFacturado(EVehiculos vehiculo) { double retorno = 0; switch (vehiculo) { case EVehiculos.Auto: foreach (Auto v in this._vehiculos) { retorno += Lavadero._precioAuto; } break; case EVehiculos.Camion: foreach (Camion v in this._vehiculos) { retorno += Lavadero._precioCamion; } break; case EVehiculos.Moto: foreach (Moto v in this._vehiculos) { retorno += Lavadero._precioMoto; } break; default: break; } return(retorno); }
private void FrmCargarVehiculos_Load(object sender, EventArgs e) { this.lblResultados.Cursor = Cursors.Hand; this.CrearTablaErrores(); this.dtVehiculosExistentes = EVehiculos.BuscarVehiculos("COMPLETO", "", out string rpta); }
private void FrmNuevoVehiculo_Load(object sender, EventArgs e) { this.DtVehiculos = EVehiculos.BuscarVehiculos("COMPLETO", "", out string rpta); //if (dtVehiculos != null) //{ // EVehiculos eVehiculo = new EVehiculos(dtVehiculos, 0); // this.txtCodigo.Text = (eVehiculo.Id_vehiculo + 1).ToString(); //} }
private void AsignarDatos(EVehiculos eVehiculo) { StringBuilder cadena = new StringBuilder(); cadena.Append("Código: ").Append(eVehiculo.Id_vehiculo); cadena.Append(Environment.NewLine); cadena.Append("Placa: ").Append(eVehiculo.Placa); this.txtVehiculo.Text = cadena.ToString(); }
private void BtnIniciar_Click(object sender, EventArgs e) { try { if (this.VerificarEsquema()) { MensajeEspera.ShowWait("Cargando"); this.CrearTablaErrores(); List <EVehiculos> Vehiculos = new List <EVehiculos>(); foreach (DataRow row in this.dtVehiculosCargados.Rows) { int Id_vehiculo = Convert.ToInt32(row["Codigo"]); string Placa = Convert.ToString(row["Placa"]).Trim(); string Propietario = Convert.ToString(row["Propietario"]).Trim(); string Chofer = Convert.ToString(row["Chofer"]).Trim(); string Marca = Convert.ToString(row["Marca"]).Trim(); string Modelo = Convert.ToString(row["Modelo"]).Trim(); string Color = Convert.ToString(row["Color"]).Trim(); if (!this.VerificarVehiculo(out EVehiculos eVehiculo, Id_vehiculo, Placa, Propietario, Chofer, Marca, Modelo, Color)) { this.AddError("No se pudieron asignar y verificar los datos para crear la entidad Vehiculo"); break; } Vehiculos.Add(eVehiculo); } if (Vehiculos.Count > 0) { string rpta = EVehiculos.InsertarVehiculos(Vehiculos); if (!rpta.Equals("OK")) { this.AddError("Hubo un error al insertar un vehículo en la base de datos, detalles: " + rpta); } else { MensajeEspera.CloseForm(); Mensajes.MensajeInformacion("Se importaron " + Vehiculos.Count + " vehículos.", "Entendido"); this.Close(); } } MensajeEspera.CloseForm(); } } catch (Exception ex) { MensajeEspera.CloseForm(); Mensajes.MensajeErrorCompleto(this.Name, "BtnIniciar_Click", "Hubo un error al cargar los vehículos", ex.Message); } }
public void AsignarDatos(EVehiculos eVehiculo) { this.EVehiculo = eVehiculo; this.txtCodigo.Text = eVehiculo.Id_vehiculo.ToString(); this.txtPlaca.Text = eVehiculo.Placa; this.txtChofer.Text = eVehiculo.Chofer; this.txtMarca.Text = eVehiculo.Marca; this.txtModelo.Text = eVehiculo.Modelo; this.txtColor.Text = eVehiculo.Color; this.txtPropietario.Text = eVehiculo.Propietario; }
private bool VerificarVehiculo(out EVehiculos eVehiculo, int id_vehiculo, string placa, string propietario, string chofer, string marca, string modelo, string color) { eVehiculo = new EVehiculos(); bool result = true; try { if (dtVehiculosExistentes != null) { DataRow[] rows1 = dtVehiculosExistentes.Select("Placa = '" + placa + "'"); DataRow[] rows2 = dtVehiculosExistentes.Select("Id_vehiculo = '" + id_vehiculo + "'"); if (rows1.Length < 1) { rows1 = null; } if (rows2.Length < 1) { rows2 = null; } if (rows1 != null) { eVehiculo = new EVehiculos(rows1[0]); return(true); } else if (rows2 != null) { eVehiculo = new EVehiculos(rows2[0]); return(true); } } eVehiculo.Id_vehiculo = id_vehiculo; eVehiculo.Placa = placa; eVehiculo.Propietario = propietario; eVehiculo.Chofer = chofer; eVehiculo.Marca = marca; eVehiculo.Modelo = modelo; eVehiculo.Color = color; eVehiculo.Estado_vehiculo = "ACTIVO"; } catch (Exception) { result = false; } return(result); }
public void AsignarDatos(EVehiculos eVehiculo) { this.EVehiculo = eVehiculo; this.txtCodigo.Text = eVehiculo.Id_vehiculo.ToString(); this.txtPlaca.Text = eVehiculo.Placa; this.txtPropietario.Text = eVehiculo.Propietario; this.txtChofer.Text = eVehiculo.Chofer; this.txtMarca.Text = eVehiculo.Marca; this.txtModelo.Text = eVehiculo.Modelo; this.txtColor.Text = eVehiculo.Color; this.btnGuardar.Text = "Actualizar"; this.Text = "Editar vehículo"; this.textBox1.Text = "Edición de vehículo"; }
private void BuscarVehiculos(string tipo_busqueda, string texto_busqueda) { try { DataTable dtVehiculos = EVehiculos.BuscarVehiculos(tipo_busqueda, texto_busqueda, out string rpta); if (dtVehiculos != null) { this.btnEditar.Enabled = true; this.lblResultados.Text = "Se encontraron " + dtVehiculos.Rows.Count + " vehículos."; this.dgvVehiculos.Enabled = true; this.dgvVehiculos.PageSize = 15; this.dgvVehiculos.SetPagedDataSource(dtVehiculos, this.bindingNavigator1); this.dgvVehiculos.Columns["Id_vehiculo"].Visible = true; this.dgvVehiculos.Columns["Id_vehiculo"].HeaderText = "Código"; this.dgvVehiculos.Columns["Estado_vehiculo"].Visible = false; if (this.dgvVehiculos.Columns.Contains("Propietario")) { this.dgvVehiculos.Columns["Propietario"].Visible = false; } if (this.dgvVehiculos.Columns.Contains("Color")) { this.dgvVehiculos.Columns["Color"].Visible = false; } } else { this.btnEditar.Enabled = false; this.lblResultados.Text = "No se encontraron vehículos"; this.dgvVehiculos.Enabled = false; if (!rpta.Equals("OK")) { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BuscarVehiculos", "Hubo un error al buscar vehículos", ex.Message); } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { if (this.Comprobaciones(out EVehiculos eVehiculo)) { string rpta = ""; string mensaje = ""; if (this.IsEditar) { rpta = EVehiculos.EditarVehiculo(eVehiculo, this.EVehiculo.Id_vehiculo); mensaje = "Se actualizó correctamente el vehículo"; } else { rpta = EVehiculos.InsertarVehiculo(eVehiculo, eVehiculo.Id_vehiculo); mensaje = "Se agregó correctamente el vehículo"; } if (rpta.Equals("OK")) { if (this.IsEditar) { OnVehiculoEditSuccess?.Invoke(eVehiculo, e); } else { OnVehiculoAddSuccess?.Invoke(eVehiculo, e); } Mensajes.MensajeOkForm(mensaje); this.Close(); } else { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BtnGuardar_Click", "Hubo un error al guardar un vehículo", ex.Message); } }
/* * public double MostrarTotalFacturado(EVehiculos vehiculo) * { * double acum = 0; * foreach (Vehiculo item in this._vehiculos) * { * switch (vehiculo) * { * case EVehiculos.Auto: * if (item is Auto) * { * acum += Lavadero._precioAuto; * } * break; * * case EVehiculos.Moto: * if (item is Moto) * { * acum += Lavadero._precioMoto; * } * break; * * case EVehiculos.Camion: * if (item is Camion) * { * acum += Lavadero._precioCamion; * } * break; * default: * break; * } * } * * return acum; * } */ public double MostrarTotalFacturado(EVehiculos vehiculo) { double total = 0; double tot_auto = 0; //contadores double tot_moto = 0; //contadores double tot_camion = 0; //contadores foreach (Vehiculo v in this._vehiculos) { if (v is Auto) { tot_auto++; } if (v is Moto) { tot_moto++; } if (v is Camion) { tot_camion++; } } switch (vehiculo) { case EVehiculos.Auto: total = tot_auto * Lavadero._precioAuto; break; case EVehiculos.Moto: total = tot_moto * Lavadero._precioMoto; break; case EVehiculos.Camion: total = tot_camion * Lavadero._precioCamion; break; default: break; } return(total); }
private bool Comprobaciones(VehiculoCronogramaSmall cronogramaSmall, out ECronogramas eCronograma) { eCronograma = new ECronogramas(); EVehiculos eVehiculo = cronogramaSmall.ECronograma.EVehiculo; //Buscar en la lista de vehículos seleccionados el id del vehículo del control List <ECronogramas> eCronogramas = this.CronogramasSeleccionados.Where(x => x.EVehiculo.Id_vehiculo == eVehiculo.Id_vehiculo).ToList(); //Comprobar cantidad de resultados if (eCronogramas.Count > 0) { //Si el véhículo ya está en la lista devolvemos falso Mensajes.MensajeInformacion("El vehículo ya está en la lista", "Entendido"); return(false); } //Comprobar si no está en otro cronograma con la misma fecha DataTable dtCronogramas = ECronogramas.BuscarCronogramas("FECHA ID VEHICULO", cronogramaSmall.dateEstado.Value.ToString("yyyy-MM-dd"), eVehiculo.Id_vehiculo.ToString(), out string rpta); if (dtCronogramas != null) { //Si hay resultados significa que si hay un vehículo con una fecha en específico Mensajes.MensajeInformacion("El vehículo ya está programado para esta fecha", "Entendido"); return(false); } //Comprobar si se seleccionó un estado if (cronogramaSmall.btnEstado.Tag == null) { Mensajes.MensajeInformacion("Seleccione un estado", "Entendido"); return(false); } EEstados_vehiculos eEstado = (EEstados_vehiculos)cronogramaSmall.Tag; eCronograma.EEstado = eEstado; eCronograma.EVehiculo = eVehiculo; eCronograma.Fecha_cronograma = cronogramaSmall.dateEstado.Value; eCronograma.Estado_cronograma = "ACTIVO"; return(true); }
public double MostrarTotalFacturado(EVehiculos vehiculos) { double gananciaVehiculo = 0; switch (vehiculos) { case (EVehiculos)0: foreach (Vehiculo item in this._vehiculos) { if (item is Auto) { gananciaVehiculo += this._precioAuto; } } break; case (EVehiculos)1: foreach (Vehiculo item in this._vehiculos) { if (item is Camion) { gananciaVehiculo += this._precioCamion; } } break; case (EVehiculos)2: foreach (Vehiculo item in this._vehiculos) { if (item is Moto) { gananciaVehiculo += this._precioMoto; } } break; default: break; } return(gananciaVehiculo); }
public double MostrarTotalFacturado(EVehiculos vElegido) { int cant_Auto = 0, cant_Moto = 0, cant_Camion = 0; double total = 0; foreach (Vehiculo v in this._vehiculos) { if (v is Auto) { cant_Auto++; } if (v is Camion) { cant_Camion++; } if (v is Moto) { cant_Moto++; } } switch (vElegido) { case EVehiculos.Auto: total = cant_Auto * Lavadero._precioAuto; break; case EVehiculos.Camion: total = cant_Camion * Lavadero._precioCamion; break; case EVehiculos.Moto: total = cant_Moto * Lavadero._precioMoto; break; default: break; } return(total); }
public double MostrarTotalFacturado(EVehiculos tipo) { double facturado = 0; int contAuto = 0; int contCamion = 0; int contMoto = 0; foreach (Vehiculo v in this._vehiculos) { if (v is Auto) { contAuto++; } if (v is Camion) { contCamion++; } if (v is Moto) { contMoto++; } } switch (tipo) { case EVehiculos.Auto: facturado = contAuto * _precioAuto; break; case EVehiculos.Camion: facturado = contCamion * _precioCamion; break; case EVehiculos.Moto: facturado = contMoto * _precioMoto; break; default: break; } return(facturado); }
private void FrmObservarVehiculos_OnDgvDoubleClick(object sender, EventArgs e) { EVehiculos eVehiculo = (EVehiculos)sender; if (this.gbVehiculo.Controls.Count > 0) { this.gbVehiculo.Controls.Clear(); } this.EVehiculo = eVehiculo; FrmVehiculoCarrera FrmVehiculoCarrera = new FrmVehiculoCarrera { FormBorderStyle = FormBorderStyle.None, TopLevel = false, Dock = DockStyle.Fill }; FrmVehiculoCarrera.AsignarDatos(eVehiculo); this.gbVehiculo.Controls.Add(FrmVehiculoCarrera); FrmVehiculoCarrera.Show(); }