Пример #1
0
        public static List <ModelMilkoScan> Llenargrid()
        {
            var lista   = new List <ModelMilkoScan>();
            var connec  = ConexionMySql.ObtenerConexion();
            var comando = new MySqlCommand("SELECT * FROM milkoscan", connec);
            var reader  = comando.ExecuteReader();

            while (reader.Read())
            {
                var pModelMilkoScan = new ModelMilkoScan
                {
                    Id             = reader.GetInt32(0),
                    Identificacion = reader.GetString(1),
                    Rep            = reader.GetInt32(2),
                    Grasa          = reader.GetDouble(3),
                    Proteina       = reader.GetDouble(17),
                    Sng            = reader.GetDouble(4),
                    St             = reader.GetDouble(5),
                    Lactosa        = reader.GetDouble(6),
                    Caseina        = reader.GetDouble(7),
                    Urea           = reader.GetDouble(8),
                    Densidad       = reader.GetDouble(9),
                    Ph             = reader.GetDouble(10),
                    Acidez         = reader.GetDouble(11),
                    Crioscopia     = reader.GetDouble(12),
                    Ffa            = reader.GetDouble(13),
                    Fecha          = reader.GetString(14),
                    ProtCaseina    = reader.GetDouble(15),
                    ProtSuero      = reader.GetDouble(16)
                };
                lista.Add(pModelMilkoScan);
            }
            return(lista);
        }
Пример #2
0
        public static ModelMilkoScan ObtenerMilko(int pIdMilko)
        {
            var pMs     = new ModelMilkoScan();
            var connec  = ConexionMySql.ObtenerConexion();
            var comando = new MySqlCommand($"SELECT * FROM milkoscan WHERE ID ='{pIdMilko}'", connec);
            var reader  = comando.ExecuteReader();

            while (reader.Read())
            {
                MilkoScanSelect.Id             = reader.GetInt32(0);
                MilkoScanSelect.Identificacion = reader.GetString(1);
                MilkoScanSelect.Rep            = reader.GetInt32(2);
                MilkoScanSelect.Grasa          = reader.GetDouble(3);
                MilkoScanSelect.Proteina       = reader.GetDouble(17);
                MilkoScanSelect.Sng            = reader.GetDouble(4);
                MilkoScanSelect.St             = reader.GetDouble(5);
                MilkoScanSelect.Lactosa        = reader.GetDouble(6);
                MilkoScanSelect.Caseina        = reader.GetDouble(7);
                MilkoScanSelect.Urea           = reader.GetDouble(8);
                MilkoScanSelect.Densidad       = reader.GetDouble(9);
                MilkoScanSelect.Ph             = reader.GetDouble(10);
                MilkoScanSelect.Acidez         = reader.GetDouble(11);
                MilkoScanSelect.Crioscopia     = reader.GetDouble(12);
                MilkoScanSelect.Ffa            = reader.GetDouble(13);
                MilkoScanSelect.Fecha          = reader.GetString(14);
                MilkoScanSelect.ProtCaseina    = reader.GetDouble(15);
                MilkoScanSelect.ProtSuero      = reader.GetDouble(16);
            }
            connec.Close();
            return(pMs);
        }
Пример #3
0
        public static int Agregar(ModelMilkoScan pMs)
        {
            var connec  = ConexionMySql.ObtenerConexion();
            var comando =
                new MySqlCommand(
                    $"CALL SPMilkoScan('{pMs.Identificacion}','{pMs.Rep}','{pMs.Grasa}','{pMs.Sng}','{pMs.St}','{pMs.Lactosa}','{pMs.Caseina}','{pMs.Urea}','{pMs.Densidad}','{pMs.Ph}','{pMs.Acidez}','{pMs.Crioscopia}','{pMs.Ffa}','{pMs.Fecha}','{pMs.ProtCaseina}','{pMs.ProtSuero}','{pMs.Proteina}')",
                    connec);
            var retorno = comando.ExecuteNonQuery();

            return(retorno);
        }
Пример #4
0
        public static int Actualizar(ModelMilkoScan pModelMilko, int pAcMilko)
        {
            var          retorno  = 0;
            var          conexion = ConexionMySql.ObtenerConexion();
            MySqlCommand comando;

            {
                //actualizar los datos del milko
                comando = new MySqlCommand($"UPDATE milkoscan SET Identificacion = '{pModelMilko.Identificacion}', REP = '{pModelMilko.Rep}', Grasa = '{pModelMilko.Grasa}', SNG ='{pModelMilko.Sng}', ST = '{pModelMilko.St}', Lactosa = '{pModelMilko.Lactosa}', Caseina = '{pModelMilko.Caseina}', Urea = '{pModelMilko.Urea}', Densidad = '{pModelMilko.Densidad}', pH = '{pModelMilko.Ph}', Acidez = '{pModelMilko.Acidez}', Crioscopia = '{pModelMilko.Crioscopia}', FFA = '{pModelMilko.Ffa}', Fecha = '{pModelMilko.Fecha}', ProteinaC = '{pModelMilko.ProtCaseina}', ProteinaS = '{pModelMilko.ProtSuero}', Proteina = '{pModelMilko.Proteina}' WHERE ID = '{pModelMilko.Id}'", conexion);
                retorno = comando.ExecuteNonQuery();
            }
            return(retorno);
        }