public void ACServicioDetalle(ServiciosMantenimientoDetalleModels Datos) { try { object[] Parametros = { Datos.NuevoRegistro, Datos.IDServicioDetalle ?? string.Empty, Datos.IDServicio ?? string.Empty, Datos.TipoServicio.IDTipoServicio ?? string.Empty, Datos.Encargado ?? string.Empty, Datos.Importe, Datos.ImporteRefacciones, Datos.Observaciones ?? string.Empty, Datos.Usuario ?? string.Empty }; object Result = SqlHelper.ExecuteScalar(Datos.Conexion, "spCSLDB_Mantenimiento_ac_ServiciosDetalle", Parametros); if (Result != null) { int Resultado = 0; int.TryParse(Result.ToString(), out Resultado); Datos.Resultado = Resultado; if (Resultado == 1) { Datos.Completado = true; } } } catch (Exception ex) { throw ex; } }
public ServiciosMantenimientoModels ObtenerDetalleServicioXID(string Conexion, string IDServicio) { try { ServiciosMantenimientoModels Result = new ServiciosMantenimientoModels(); List <ServiciosMantenimientoDetalleModels> Lista = new List <ServiciosMantenimientoDetalleModels>(); ServiciosMantenimientoDetalleModels Item; DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "spCSLDB_Mantenimiento_get_DetalleServicioXID", IDServicio); if (Ds != null) { if (Ds.Tables.Count == 2) { if (Ds.Tables[0] != null) { if (Ds.Tables[0].Rows[0][0] != null) { Result.Vehiculo = new CatVehiculoModels { IDVehiculo = Ds.Tables[0].Rows[0][0].ToString() }; } } DataTableReader Dr = Ds.Tables[1].CreateDataReader(); while (Dr.Read()) { Item = new ServiciosMantenimientoDetalleModels(); Item.IDServicioDetalle = !Dr.IsDBNull(Dr.GetOrdinal("IDServicioDetalle")) ? Dr.GetString(Dr.GetOrdinal("IDServicioDetalle")) : string.Empty; Item.TipoServicio.Descripcion = !Dr.IsDBNull(Dr.GetOrdinal("TipoServicio")) ? Dr.GetString(Dr.GetOrdinal("TipoServicio")) : string.Empty; Item.Encargado = !Dr.IsDBNull(Dr.GetOrdinal("Encargado")) ? Dr.GetString(Dr.GetOrdinal("Encargado")) : string.Empty; Item.Observaciones = !Dr.IsDBNull(Dr.GetOrdinal("Observaciones")) ? Dr.GetString(Dr.GetOrdinal("Observaciones")) : string.Empty; Item.Importe = !Dr.IsDBNull(Dr.GetOrdinal("Importe")) ? Dr.GetDecimal(Dr.GetOrdinal("Importe")) : 0; Item.ImporteRefacciones = !Dr.IsDBNull(Dr.GetOrdinal("ImporteRefacciones")) ? Dr.GetDecimal(Dr.GetOrdinal("ImporteRefacciones")) : 0; Lista.Add(Item); } } } Result.ListaDetalle = Lista; return(Result); } catch (Exception ex) { throw ex; } }
public void EliminarServicioDetalle(ServiciosMantenimientoDetalleModels Datos) { try { object[] Parametros = { Datos.IDServicioDetalle, Datos.Usuario }; object Result = SqlHelper.ExecuteScalar(Datos.Conexion, "spCSLDB_Mantenimiento_del_ServicioDetalleXID", Parametros); if (Result != null) { int Resultado = 0; int.TryParse(Result.ToString(), out Resultado); Datos.Resultado = Resultado; if (Resultado == 1) { Datos.Completado = true; } } } catch (Exception ex) { throw ex; } }