Ejemplo n.º 1
0
        public List <ParametrosInyeccion> PRO_Parametros_Consulta()
        {
            List <ParametrosInyeccion> oList = new List <ParametrosInyeccion>();

            try {
                using (SqlConnection conn = new SqlConnection(RecuperarCadenaDeConexion("coneccionSQL"))) {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand(CONS_USP_PRO_PARAMETROS_CONSULTA, conn)) {
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader reader = cmd.ExecuteReader()) {
                            while (reader.Read())
                            {
                                ParametrosInyeccion obj = new ParametrosInyeccion();

                                obj.Presion1    = decimal.Parse(reader["Presion1"].ToString());
                                obj.Presion2    = decimal.Parse(reader["Presion2"].ToString());
                                obj.Presion3    = decimal.Parse(reader["Presion3"].ToString());
                                obj.Velocidad1  = decimal.Parse(reader["Velocidad1"].ToString());
                                obj.Velocidad2  = decimal.Parse(reader["Velocidad2"].ToString());
                                obj.Velocidad3  = decimal.Parse(reader["Velocidad3"].ToString());
                                obj.PosicionC1  = decimal.Parse(reader["PosicionC1"].ToString());
                                obj.PosicionC2  = decimal.Parse(reader["PosicionC2"].ToString());
                                obj.PresionC1   = decimal.Parse(reader["PresionC1"].ToString());
                                obj.PresionC2   = decimal.Parse(reader["PresionC2"].ToString());
                                obj.VelocidadC1 = decimal.Parse(reader["VelocidadC1"].ToString());
                                obj.VelocidadC2 = decimal.Parse(reader["VelocidadC2"].ToString());
                                obj.Posicion    = reader["Posicion"].ToString();
                                obj.Presion     = decimal.Parse(reader["Presion"].ToString());
                                obj.Velocidad   = decimal.Parse(reader["Velocidad"].ToString());
                                obj.Retardo     = decimal.Parse(reader["RetardEnfria"].ToString());
                                obj.Zona4       = decimal.Parse(reader["Zona4"].ToString());
                                obj.Zona3       = decimal.Parse(reader["Zona3"].ToString());
                                obj.Zona2       = decimal.Parse(reader["Zona2"].ToString());
                                obj.Zona1       = decimal.Parse(reader["Zona1"].ToString());
                                obj.Observa     = reader["Observa"].ToString();
                                obj.Cavidades   = reader["Cavidades"].ToString();
                                obj.Fecha       = reader["Fecha"].ToString();
                                obj.Hora        = reader["Hora"].ToString();

                                oList.Add(obj);
                            }
                        }
                    }
                }
                return(oList);
            } catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 2
0
 private void CargaDatos()
 {
     oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
     try {
         ParametrosInyeccion Obj = oEnsamble.PRO_Parametros_Obtener();
         if (Obj != null)
         {
             txtPresion1.Text    = decimal.Parse(Obj.Presion1.ToString()) == 0 ? "" : Obj.Presion1.ToString();
             txtPresion2.Text    = decimal.Parse(Obj.Presion2.ToString()) == 0 ? "" : Obj.Presion2.ToString();
             txtPresion3.Text    = decimal.Parse(Obj.Presion3.ToString()) == 0 ? "" : Obj.Presion3.ToString();
             txtVelocidad1.Text  = decimal.Parse(Obj.Velocidad1.ToString()) == 0 ? "" : Obj.Velocidad1.ToString();
             txtVelocidad2.Text  = decimal.Parse(Obj.Velocidad2.ToString()) == 0 ? "" : Obj.Velocidad2.ToString();
             txtVelocidad3.Text  = decimal.Parse(Obj.Velocidad3.ToString()) == 0 ? "" : Obj.Velocidad3.ToString();
             txtPosicionC1.Text  = decimal.Parse(Obj.PosicionC1.ToString()) == 0 ? "" : Obj.PosicionC1.ToString();
             txtPosicionC2.Text  = decimal.Parse(Obj.PosicionC2.ToString()) == 0 ? "" : Obj.PosicionC2.ToString();
             txtPresionC1.Text   = decimal.Parse(Obj.PresionC1.ToString()) == 0 ? "" : Obj.PresionC1.ToString();
             txtPresionC2.Text   = decimal.Parse(Obj.PresionC2.ToString()) == 0 ? "" : Obj.PresionC2.ToString();
             txtVelocidadC1.Text = decimal.Parse(Obj.VelocidadC1.ToString()) == 0 ? "" : Obj.VelocidadC1.ToString();
             txtVelocidadC2.Text = decimal.Parse(Obj.VelocidadC2.ToString()) == 0 ? "" : Obj.VelocidadC2.ToString();
             txtPosicion.Text    = Obj.Posicion.ToString();
             //txtPresion.Text = Obj.Presion.ToString();
             txtVelocidad.Text = decimal.Parse(Obj.Velocidad.ToString()) == 0 ? "" : Obj.Velocidad.ToString();
             txtRetardo.Text   = decimal.Parse(Obj.Retardo.ToString()) == 0 ? "" : Obj.Retardo.ToString();
             txtZona1.Text     = decimal.Parse(Obj.Zona1.ToString()) == 0 ? "" : Obj.Zona1.ToString();
             txtZona2.Text     = decimal.Parse(Obj.Zona2.ToString()) == 0 ? "" : Obj.Zona2.ToString();
             txtZona3.Text     = decimal.Parse(Obj.Zona3.ToString()) == 0 ? "" : Obj.Zona3.ToString();
             txtZona4.Text     = decimal.Parse(Obj.Zona4.ToString()) == 0 ? "" : Obj.Zona4.ToString();
             txtObserva.Text   = Obj.Observa.ToString();
             txtCavidades.Text = Obj.Cavidades.ToString();
         }
     } catch (Exception ex) {
         throw ex;
     } finally {
         oEnsamble = null;
     }
 }