Exemple #1
0
 public void ModificarCabecera(Encabezado en)
 {
     try
     {
         string cnx = db.Database.Connection.ConnectionString;
         con     = new SqlConnection(cnx);
         comando = new SqlCommand("usp_EncabezadoUpdate", con);
         comando.Parameters.AddWithValue("@Id_cliente", en.Id_cliente);
         comando.Parameters.AddWithValue("@fechaCheque", en.fechaCheque);
         comando.Parameters.AddWithValue("@Id_Vendedor", en.Id_Vendedor);
         comando.Parameters.AddWithValue("@Total_Venta", en.Total_Venta);
         comando.Parameters.AddWithValue("@Id_Moneda", en.Id_Moneda);
         comando.Parameters.AddWithValue("@Id_FormaPago", en.Id_FormaPago);
         comando.Parameters.AddWithValue("@Id_Encab", en.Id_Encab);
         comando.Parameters.AddWithValue("@IGV", en.IGV);
         comando.Parameters.AddWithValue("@ide", en.Estado_Docmto);
         comando.Parameters.AddWithValue("@nota", en.Notas);
         comando.Parameters.AddWithValue("@estado", en.Estado_Pago);
         comando.CommandType = System.Data.CommandType.StoredProcedure;
         con.Open();
         reader = comando.ExecuteReader();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         con.Close();
     }
 }
Exemple #2
0
        public Int64 InsertarCabecera(Encabezado en)
        {
            try
            {
                string numero = obtener();
                en.Encab_Numero = numero.ToString().PadLeft(8, '0');
                Int64  id  = 0;
                string cnx = db.Database.Connection.ConnectionString;
                con     = new SqlConnection(cnx);
                comando = new SqlCommand("usp_EncabezdoInsert", con);
                comando.Parameters.AddWithValue("@Id_cliente", en.Id_cliente);
                comando.Parameters.AddWithValue("@fechaCheque", en.fechaCheque);
                comando.Parameters.AddWithValue("@Id_Vendedor", en.Id_Vendedor);
                comando.Parameters.AddWithValue("@Total_Venta", en.Total_Venta);
                comando.Parameters.AddWithValue("@Id_Moneda", en.Id_Moneda);
                comando.Parameters.AddWithValue("@Id_FormaPago", en.Id_FormaPago);
                comando.Parameters.AddWithValue("@IGV", en.IGV);
                comando.Parameters.AddWithValue("@EncabNum", en.Encab_Numero);
                comando.Parameters.AddWithValue("@nota", en.Notas);
                comando.Parameters.AddWithValue("@ide", en.Estado_Docmto);
                comando.Parameters.AddWithValue("@estado", en.Estado_Pago);
                comando.CommandType = System.Data.CommandType.StoredProcedure;
                con.Open();
                id = Convert.ToInt64(comando.ExecuteScalar().ToString());
                //reader = comando.ExecuteReader();

                return(id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }