public List <v_ListarPedidoFecha> ListarPedidosVendedor(int id) { List <v_ListarPedidoFecha> listaClientes = new List <v_ListarPedidoFecha>(); string findAll = "select* from v_ListarPedidoFecha where fechaCheque=Convert(DATE,Getdate()) and Id_Vendedor='" + id + "'order by Encab_Numero Asc"; try { string cnx = db.Database.Connection.ConnectionString; con = new SqlConnection(cnx); comando = new SqlCommand(findAll, con); con.Open(); SqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { v_ListarPedidoFecha objCliente = new v_ListarPedidoFecha(); objCliente.Id_Encab = Convert.ToInt32(reader[0].ToString()); objCliente.CodNom = reader[2].ToString(); objCliente.fechaCheque = Convert.ToDateTime(reader[1]).ToString("dd-MM-yyyy"); objCliente.Total_Venta = Convert.ToDecimal(reader[3].ToString()); objCliente.Desc_Large = reader[4].ToString(); objCliente.Encab_Numero = reader[7].ToString(); objCliente.FormaPago = reader[8].ToString(); listaClientes.Add(objCliente); } } catch (Exception) { throw; } finally { con.Close(); } return(listaClientes); }
public List <v_ListarPedidoFecha> ListarPedidosFecha(string fi, string ff, string id, string idforma) { List <v_ListarPedidoFecha> listaClientes = new List <v_ListarPedidoFecha>(); //string findAll = "select* from v_AcEn where fechaCheque between '"+ fi +" and "+ ff + "'"; try { string cnx = db.Database.Connection.ConnectionString; con = new SqlConnection(cnx); comando = new SqlCommand("usp_ListarPedidosFecha", con); comando.Parameters.AddWithValue("@fi", fi); comando.Parameters.AddWithValue("@ff", ff); comando.Parameters.AddWithValue("@idclie", id); comando.Parameters.AddWithValue("@forma", idforma); comando.CommandType = System.Data.CommandType.StoredProcedure; con.Open(); SqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { v_ListarPedidoFecha objCliente = new v_ListarPedidoFecha(); objCliente.Id_Encab = Convert.ToInt32(reader[0].ToString()); objCliente.CodNom = reader[2].ToString(); objCliente.fechaCheque = Convert.ToDateTime(reader[1]).ToString("dd-MM-yyyy"); objCliente.Total_Venta = Convert.ToDecimal(reader[3].ToString()); objCliente.Desc_Large = reader[4].ToString(); objCliente.Nombres = reader[6].ToString(); objCliente.Encab_Numero = reader[7].ToString(); objCliente.FormaPago = reader[8].ToString(); objCliente.estado = reader[11].ToString(); listaClientes.Add(objCliente); } } catch (Exception ex) { throw ex; } finally { con.Close(); } return(listaClientes); }
public List <v_ListarPedidoFecha> ListarPedidosFechaVendedor(string fi, string ff, int id) { List <v_ListarPedidoFecha> listaClientes = new List <v_ListarPedidoFecha>(); try { string cnx = db.Database.Connection.ConnectionString; con = new SqlConnection(cnx); comando = new SqlCommand("usp_ListarPedidosFechaVendedor", con); comando.Parameters.AddWithValue("@fi", fi); comando.Parameters.AddWithValue("@ff", ff); comando.Parameters.AddWithValue("@id", id); comando.CommandType = System.Data.CommandType.StoredProcedure; con.Open(); SqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { v_ListarPedidoFecha objCliente = new v_ListarPedidoFecha(); objCliente.Id_Encab = Convert.ToInt32(reader[0].ToString()); objCliente.CodNom = reader[2].ToString(); objCliente.fechaCheque = reader[1].ToString(); objCliente.Total_Venta = Convert.ToDecimal(reader[3].ToString()); objCliente.Desc_Large = reader[4].ToString(); objCliente.Nombres = reader[6].ToString(); objCliente.Encab_Numero = reader[7].ToString(); listaClientes.Add(objCliente); } } catch (Exception ex) { throw ex; } finally { con.Close(); } return(listaClientes); }