예제 #1
0
        /// <summary>
        /// Agergar un cliente
        /// </summary>
        /// <param name="cliente"></param>
        /// <returns>1 si es satisactorio el cambio</returns>
        public int AgregarCliente(Cliente cliente)
        {
            PostgreDataAccess PsDB = new PostgreDataAccess();

            DAOClients DaoClient = new DAOClients()
            {
                BusinessID = cliente.BusinessID,
                Email      = cliente.Email,
                Phone      = cliente.Phone,
                DataAdded  = cliente.DataAdded,
                StartDate  = cliente.StartDate,
                EndDate    = cliente.EndDate,
                State      = cliente.State.ToLower().Trim() == "activo" ? true : false
            };

            return(PsDB.CreateCliente(DaoClient));
        }
예제 #2
0
        /// <summary>
        /// Actualizar un cliente existente
        /// </summary>
        /// <param name="cliente"></param>
        /// <returns>true si es satisactorio el cambio</returns>
        public bool ActualizarCliente(Cliente cliente)
        {
            PostgreDataAccess PsDB = new PostgreDataAccess();

            DAOClients DaoClient = new DAOClients()
            {
                SharedKey  = cliente.SharedKey,
                BusinessID = cliente.BusinessID,
                Email      = cliente.Email,
                Phone      = cliente.Phone,
                DataAdded  = cliente.DataAdded,
                StartDate  = cliente.StartDate,
                EndDate    = cliente.EndDate,
                State      = cliente.State.ToLower().Trim() == "activo" ? true : false
            };

            return(PsDB.ActualizarCliente(DaoClient));;
        }
예제 #3
0
        /// <summary>
        /// lista todos los clientes
        /// </summary>
        /// <returns>Listado de clientes</returns>
        public List <Cliente> ListarCliente()
        {
            PostgreDataAccess PsDB = new PostgreDataAccess();

            List <Cliente> ListaCliente = new List <Cliente>();

            foreach (var item in PsDB.ListarClientes())
            {
                Cliente cliente = new Cliente()
                {
                    SharedKey  = item.SharedKey,
                    BusinessID = item.BusinessID,
                    Email      = item.Email,
                    Phone      = item.Phone,
                    DataAdded  = item.DataAdded,
                    StartDate  = item.StartDate,
                    EndDate    = item.EndDate,
                    State      = item.State == true ? "Activo" : "Inactivo"
                };

                ListaCliente.Add(cliente);
            }
            return(ListaCliente);
        }
예제 #4
0
        /// <summary>
        /// Borrar un cliente Existente
        /// </summary>
        /// <param name="SharedKey"></param>
        /// <returns>true si es satisactorio el cambio</returns>
        public bool BorrarCliente(int SharedKey)
        {
            PostgreDataAccess PsDB = new PostgreDataAccess();

            return(PsDB.BorrarCliente(SharedKey));
        }