public static string GenerarArchivoCliente() { RepoCliente repoCli = new RepoCliente(); string devolucion = repoCli.GenerarArchivo(); return(devolucion); }
public static Cliente TraerClientePorRut(string rut) { Cliente cliente = new Cliente(); RepoCliente repoCli = new RepoCliente(); cliente = repoCli.BuscarPorRut(rut); return(cliente); }
public static Cliente TraerCliente(string rut) { Cliente cliente = new Cliente(); RepoCliente repoCli = new RepoCliente(); cliente = repoCli.BuscarPorId(Int32.Parse(rut)); return(cliente); }
public static List <Cliente> TraerClientes() { List <Cliente> clientes = new List <Cliente>(); RepoCliente repoCli = new RepoCliente(); clientes = repoCli.TraerTodo(); return(clientes); }
public static List <Cliente> ListarClientes() { List <Cliente> listaClientes = new List <Cliente>(); RepoCliente repoCliente = new RepoCliente(); listaClientes = repoCliente.TraerTodo(); return(listaClientes); }
public List <Producto> ProductosCliente(string rut) { List <Producto> productos = new List <Producto>(); string strCon = ConfigurationManager.ConnectionStrings["stringConBD"].ConnectionString; SqlConnection con = new SqlConnection(strCon); string sql = "SELECT * " + "FROM Producto, Cliente " + "WHERE Producto.rut = Cliente.rut AND Cliente.rut = @rut;"; SqlCommand com = new SqlCommand(sql, con); com.Parameters.AddWithValue("@rut", rut); try { con.Open(); RepoCliente repoCliente = new RepoCliente(); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { Cliente cliente = new Cliente { Id = reader.GetInt32(4), Rut = reader.GetString(5), Nombre = reader.GetString(6), FechaRegistro = reader.GetDateTime(7) }; Producto unP = new Producto { Id = reader.GetInt32(0), Nombre = reader.GetString(1), Peso = reader.GetDecimal(2), Cliente = cliente }; productos.Add(unP); } con.Close(); } catch (Exception ex) { throw; } finally { if (con.State == ConnectionState.Open) { con.Close(); } } return(productos); }
public static bool AltaCliente(string rut, string nombre, DateTime antiguedadFecha) { bool ret = false; Cliente clie = new Cliente() { Rut = rut, Nombre = nombre, AntiguedadFecha = antiguedadFecha }; RepoCliente repoCli = new RepoCliente(); ret = repoCli.Alta(clie); return(ret); }
public static decimal CalcularGananciaPorCliente(Object id) { RepoCliente repoCliente = new RepoCliente(); RepoImportacion r = new RepoImportacion(); decimal ganancia = repoCliente.ObtenerPorcentajeGanancia(); decimal descuento = repoCliente.ObtenerPorcentajeDescuento(); int antiguedad = repoCliente.ObtenerAntiguedadMinima(); decimal total = 0; foreach (Importacion i in r.ImportacionesEnStockCliente(id)) { total += i.GananciaPrevista(ganancia, descuento, antiguedad); } return(total); }
public static decimal CalcularGananciaPorImportacion(Importacion i) { RepoCliente repoCliente = new RepoCliente(); RepoImportacion r = new RepoImportacion(); decimal ganancia = repoCliente.ObtenerPorcentajeGanancia(); decimal descuento = repoCliente.ObtenerPorcentajeDescuento(); int antiguedad = repoCliente.ObtenerAntiguedadMinima(); decimal total = 0; if (i != null) { total = i.GananciaPrevista(ganancia, descuento, antiguedad); } return(total); }
public static Cliente BuscarClientePorId(string rut) { RepoCliente repoCliente = new RepoCliente(); return(repoCliente.BuscarPorId(rut)); }