/// <summary> /// /// </summary> /// <param name="cliente"></param> /// <returns></returns> public static PerfilClientes getPerfilCliente(int Cliente) { try { using (MsSqlFacade<PerfilClientes, PerfilClientesMapper> facade = new MsSqlFacade<PerfilClientes, PerfilClientesMapper>()) { return facade.Get(Cliente); } } catch { /// in case that fails, we give an empty list return null; } }
/// <summary> /// /// </summary> /// <param name="Compra"></param> /// <param name="Estado"></param> /// <returns></returns> public static int EstadoPromocion(int Compra, int Estado) { try { using (MsSqlFacade<ComprasPromociones, ComprasPromocionesMapper> facade = new MsSqlFacade<ComprasPromociones, ComprasPromocionesMapper>()) { /// we now get the entity ComprasPromociones entity = facade.Get(Compra); /// this entity we now update entity.Estado = Estado; entity.FechaCambioEstado = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); /// this will return the entity update return facade.Update(entity); } } catch { /// in case that fails, we give an empty list return -1; } }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public static List<Clientes> GetSeguidoresPorMercante(int id) { try { using (MsSqlFacade<ClientesMercantes, ClientesMercantesMapper> facade = new MsSqlFacade<ClientesMercantes, ClientesMercantesMapper>()) { /// client list to fill List<Clientes> clientes = new List<Clientes>(); /// first thing is to get the clients form the merchant so we lookup List<ClientesMercantes> list = facade.Read().Where(p => p.Mercante == id).ToList<ClientesMercantes>(); /// we now iterate to get the clients foreach (ClientesMercantes parent in list) { /// we release and use disposable using (MsSqlFacade<Clientes, ClientesMapper> facade1 = new MsSqlFacade<Clientes, ClientesMapper>()) { /// we now get the client form db Clientes cliente = facade1.Get(parent.Cliente); /// we now check for null if (cliente != null) { /// add to client clientes.Add(cliente); } } } /// we return the clients return clientes; } } catch { /// in case that fails, we give an empty list return null; } }
/// <summary> /// /// </summary> /// <param name="Mercante"></param> /// <returns></returns> public static data.entities.Positions GetPositions(int id) { try { using (MsSqlFacade<Positions, PositionsMapper> facade = new MsSqlFacade<Positions, PositionsMapper>()) { //// we use the Collection to build the broker entity on an abstract phase to manage it as a all return facade.Get(id); } } catch { return null; } }
/// <summary> /// /// </summary> /// <param name="Collection"></param> /// <returns></returns> public static data.entities.Mercantes getMercantePorID(int Mercante) { try { using (MsSqlFacade<Mercantes, MercantesMapper> facade = new MsSqlFacade<Mercantes, MercantesMapper>()) { // we now select all the promotions that are active but we make it into a linear research // thus is not woow efficient is enought for it's end. return facade.Get(Mercante); } } catch { /// in case that fails, we give an empty list return null; } }