public Servicio_Vehiculo_Entity verServicio(int codigo) { Servicio_Vehiculo_Entity sve = new Servicio_Vehiculo_Entity(); Servicio_Vehiculo_DAL veruno = new Servicio_Vehiculo_DAL(); return(veruno.verUnServicio(codigo)); }
public Servicio_Vehiculo_Entity verUnServicio(int vh) { DataTable dtRegistros = new DataTable(); Servicio_Vehiculo_Entity st = new Servicio_Vehiculo_Entity(); dtRegistros = cnn.getSQL("SELECT * FROM MORDENSERVICIOV " + " WHERE idordenserv = " + vh); foreach (DataRow row in dtRegistros.Rows) { foreach (DataColumn column in dtRegistros.Columns) { st.idtransporte = Convert.ToInt32(row["idtransporte"]); st.idorden = Convert.ToInt32(row["idordenserv"]); st.factura = row["facturataller"].ToString(); st.fecha = row["fechaservicio"].ToString(); st.fechaprox = row["fechaproximoservicio"].ToString(); st.kmsactual = Convert.ToDecimal(row["kmsactuales"]); st.kmsprox = Convert.ToDecimal(row["kmsproximoservicio"]); st.monto = Convert.ToDecimal(row["monto"]); if (row["idAutorizacion"].ToString() == "") { st.idAutorizacion = 0; } else { st.idAutorizacion = 1; } //st.idAutorizacion = Convert.ToInt32(row["idAutorizacion"]); } } return(st); }
public void actualizarServicio(Servicio_Vehiculo_Entity st) { cnn.updateSQL(string.Format("UPDATE MORDENSERVICIOV SET facturataller = '{0}', fechaservicio = '{1}', kmsactuales = {2}, kmsproximoservicio = {3}, monto = {4} WHERE idordenserv = {5}", st.factura, st.fecha, st.kmsactual, st.kmsprox, st.monto, st.idorden)); actualizaKMS(st.idtransporte, st.kmsactual); }
//MRP_BD cnn = new MRP_BD("ivan", "developer1993", "SAD2017", @"DESKTOP-F4L56EU\SQLEXPRESS"); // MRP_BD cnn = new MRP_BD("r40usr", "Inter$2013", "SAD2017", "SDESRUTA40"); public void insertarServicio(Servicio_Vehiculo_Entity st) { cnn.insertSQL("INSERT INTO MORDENSERVICIOV (idtransporte, facturataller, fechaservicio, fechaproximoservicio, kmsactuales, kmsproximoservicio, monto, idtiposerviciovh) " + " VALUES(" + st.idtransporte + ", '" + st.factura + "',\'" + st.fecha + "\', \'" + st.fechaprox + "\', " + st.kmsactual + ", " + st.kmsprox + "," + st.monto + "," + st.idTipoServicio + ")"); actualizaKMS(st.idtransporte, st.kmsactual); }
private void btnGuardar_Click(object sender, EventArgs e) { decimal kmsvehiculo = Convert.ToDecimal(lblKmsVehiculo.Text); if (txtFactura.Text == "" || txtKmsProx.Text == "" || txtIdKms.Text == "" || txtTotal.Text == "") { MessageBox.Show("Debe de llenar todos los campos"); } else { Servicio_Vehiculo_Entity st = new Servicio_Vehiculo_Entity(); st.idtransporte = Convert.ToInt32(txtIdVehiculo.Text.Trim()); st.factura = txtFactura.Text; st.fecha = dtpFecha.Value.Year + "/" + dtpFecha.Value.Month + "/" + dtpFecha.Value.Day; //st.fecha = dtpFecha.Value.Day + "/" + dtpFecha.Value.Month + "/" + dtpFecha.Value.Year; st.kmsactual = Convert.ToDecimal(txtIdKms.Text.Trim()); st.kmsprox = Convert.ToDecimal(txtKmsProx.Text.Trim()); st.monto = Convert.ToDecimal(txtTotal.Text.Trim()); st.idTipoServicio = 1;// Convert.ToInt32(cmbTipoServicio.SelectedValue); if (st.kmsactual < kmsvehiculo) { MessageBox.Show("El kilometraje que está intentando ingresar es menor al kilometraje actual del vehiculo "); } else { if (st.kmsactual > st.kmsprox) { MessageBox.Show("El kilometraje del próximo servicio debe de ser mayor al kilometraje actual"); } else { if (txtIdOrdenServicio.Text == "0" || txtIdOrdenServicio.Text == "") { try { new BO.Servicio_Vehiculo_BO().guardarServicio(st); MessageBox.Show("Registro guardado exitosamente"); txtLimpiar(); ActualizarGrid(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { try { st.idorden = Convert.ToInt32(txtIdOrdenServicio.Text.Trim()); new BO.Servicio_Vehiculo_BO().actualizarServicio(st); MessageBox.Show("Registro guardado exitosamente"); txtLimpiar(); ActualizarGrid(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } } }
public void actualizarServicio(Servicio_Vehiculo_Entity st) { Servicio_Vehiculo_DAL guardar = new Servicio_Vehiculo_DAL(); guardar.actualizarServicio(st); }
public void guardarServicio(Servicio_Vehiculo_Entity st) { Servicio_Vehiculo_DAL guardar = new Servicio_Vehiculo_DAL(); guardar.insertarServicio(st); }