public List <ItemFacturaNE> MostrarItemFactura(int NumeroFactura)
        {
            IDbConnection con = DBComun.Conexion();

            con.Open();
            SqlCommand Command = new SqlCommand("SELECT * From ItemFactura where NumeroFactura=@NumeroFactura", con as SqlConnection);

            Command.Parameters.Add(new SqlParameter("@NumeroFactura", NumeroFactura));
            IDataReader          reader = Command.ExecuteReader();
            List <ItemFacturaNE> Lista  = new List <ItemFacturaNE>();

            while (reader.Read())
            {
                ItemFacturaNE ObjetoFacturaItemNE = new ItemFacturaNE();
                ObjetoFacturaItemNE.IdProducto     = reader.GetInt32(0);
                ObjetoFacturaItemNE.NombreProducto = reader.GetString(1);
                ObjetoFacturaItemNE.Cantidad       = reader.GetInt32(2);
                ObjetoFacturaItemNE.PrecioCosto    = reader.GetInt32(3);
                ObjetoFacturaItemNE.Monto          = reader.GetInt32(4);
                ObjetoFacturaItemNE.NumeroFactura  = reader.GetInt32(5);

                Lista.Add(ObjetoFacturaItemNE);
            }
            con.Close();
            return(Lista);
        }
        public static int ModificarItemFactura(ItemFacturaNE iNE)
        {
            IDbConnection con = CapaDA.DBComun.Conexion();

            con.Open();

            SqlCommand Comand = new SqlCommand(" UPDATE ItemFactura SET NombreProducto=@NombreProducto , Cantidad=@Cantidad , PrecioCosto=@PrecioCosto, Monto=@Monto WHERE IdProducto = @IdProducto", con as SqlConnection);

            Comand.Parameters.Add(new SqlParameter("@NombreProducto", iNE.NombreProducto));
            Comand.Parameters.Add(new SqlParameter("@IdProducto", iNE.IdProducto));
            Comand.Parameters.Add(new SqlParameter("@Cantidad", iNE.Cantidad));
            Comand.Parameters.Add(new SqlParameter("@PrecioCosto", iNE.PrecioCosto));
            Comand.Parameters.Add(new SqlParameter("@Monto", iNE.Monto));

            int Resultado = Comand.ExecuteNonQuery();

            con.Close();
            return(Resultado);
        }
        public static int AgregarItemFactura(ItemFacturaNE iNE)
        {
            IDbConnection con = CapaDA.DBComun.Conexion();

            con.Open();

            SqlCommand Comand = new SqlCommand("INSERT INTO ItemFactura ( IdProducto, NombreProducto , Cantidad, PrecioCosto, Monto, NumeroFactura) VALUES ( @IdProducto, @NombreProducto , @Cantidad, @PrecioCosto, @Monto, @NumeroFactura)", con as SqlConnection);

            Comand.Parameters.Add(new SqlParameter("@IdProducto", iNE.IdProducto));
            Comand.Parameters.Add(new SqlParameter("@NombreProducto", iNE.NombreProducto));
            Comand.Parameters.Add(new SqlParameter("@Cantidad", iNE.Cantidad));
            Comand.Parameters.Add(new SqlParameter("@PrecioCosto", iNE.PrecioCosto));
            Comand.Parameters.Add(new SqlParameter("@Monto", iNE.Monto));
            Comand.Parameters.Add(new SqlParameter("@NumeroFactura", iNE.NumeroFactura));


            int Resultado = Comand.ExecuteNonQuery();

            con.Close();
            return(Resultado);
        }
Exemple #4
0
 public int ModificarItemFactura(ItemFacturaNE ifac)
 {
     return(ItemFacturaDA.ModificarItemFactura(ifac));
 }
Exemple #5
0
 public int AgregarItemFactura(ItemFacturaNE ObjetoItemFacturaNE)
 {
     return(CapaDA.ItemFacturaDA.AgregarItemFactura(ObjetoItemFacturaNE));
 }