コード例 #1
0
        public List <ConsultaModels> consulta()
        {
            var configuracion = Config_StringDB.GetConfiguration();

            using (SqlConnection sql = new SqlConnection(configuracion.GetSection("ConnectionStrings").GetSection("DefaultConnection11").Value))

            {
                sql.Open();

                using (SqlCommand cmd = new SqlCommand("sp_Transferencias", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    // cmd.Parameters.Add(new SqlParameter("@saldo", c.Saldo));
                    cmd.ExecuteReader();

                    //ConsultaModels[] response = new ConsultaModels[100];


                    // var respo = List<new ConsultaModels>();

                    sql.OpenAsync();

                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            //       respo.Add(MapToValue(reader));
                        }
                    }
                    //cmd.Connection = sql;
                    //ConsultaModels response = new ConsultaModels();

                    /* ConsultaModels c = new ConsultaModels();
                     * DataSet ds = new DataSet();
                     * SqlDataAdapter da = new SqlDataAdapter(cmd);
                     * da.Fill(ds);
                     * c = da;
                     * i = 1;*/
                }
                //sql.Close();
            }


            return(null);
        }
コード例 #2
0
        // Consulta Saldo
        public static float ConsultaSaldoAsync(string ID)
        {
            var configuracion = Config_StringDB.GetConfiguration();


            float req = 0;


            using (SqlConnection sql = new SqlConnection(configuracion.GetSection("ConnectionStrings").GetSection("DefaultConnection11").Value))
            {
                /*/https://localhost:44320/api/Cuenta/10000000000001 */


                using (SqlCommand cmd = new SqlCommand("sp_ConsultaSaldo", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    SqlParameter paramID =
                        new SqlParameter("@nro_cuenta", SqlDbType.VarChar, 14);
                    paramID.Value = ID;
                    cmd.Parameters.Add(paramID);


                    SqlParameter paramSumary = new SqlParameter("@saldo", SqlDbType.Decimal)
                    {
                        Precision = 12, Scale = 2
                    };
                    paramSumary.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(paramSumary);
                    sql.Open();

                    cmd.ExecuteScalar();
                    Debug.WriteLine(paramSumary.Value);
                    req = (float)Convert.ToDecimal(cmd.Parameters["@saldo"].Value);
                    sql.Close();
                }
            }

            return(req);
        }
コード例 #3
0
        public static MovimientoModels Retiro(MovimientoModels c)
        {
            var configuracion = Config_StringDB.GetConfiguration();

            using (SqlConnection sql = new SqlConnection(configuracion.GetSection("ConnectionStrings").GetSection("DefaultConnection11").Value))

            {
                sql.Open();

                using (SqlCommand cmd = new SqlCommand("sp_retiro", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@NRO_CUENTA", c.NroCuenta));
                    cmd.Parameters.Add(new SqlParameter("@IMPORTEm", c.Importe));


                    cmd.ExecuteNonQuery();
                }
                sql.Close();
                return(c);
            }
        }
コード例 #4
0
        public static TransferenciaModels transferencia(TransferenciaModels t)
        {
            var configuracion = Config_StringDB.GetConfiguration();

            using (SqlConnection sql = new SqlConnection(configuracion.GetSection("ConnectionStrings").GetSection("DefaultConnection11").Value))

            {
                sql.Open();

                using (SqlCommand cmd = new SqlCommand("sp_Transferencias", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@cuenta1", t.nrocuenta1));
                    cmd.Parameters.Add(new SqlParameter("@cuenta2", t.nrocuenta2));
                    cmd.Parameters.Add(new SqlParameter("@monto", t.monto));

                    cmd.ExecuteNonQuery();
                }
                sql.Close();
                return(t);
            }
        }