Exemplo n.º 1
0
        public IEnumerable <Client> getClientByFilter(ClientFilterModel model)
        {
            List <SQLiteParameter> lstParameter = new List <SQLiteParameter>();

            lstParameter.Add(new SQLiteParameter("@NAME", "%" + model.Name + "%"));
            lstParameter.Add(new SQLiteParameter("@SEGMENT", "%" + model.Segment + "%"));
            if (model.CreationDateBegin == null)
            {
                lstParameter.Add(new SQLiteParameter("@DATEBEGIN", System.DateTime.MinValue));
            }
            else
            {
                lstParameter.Add(new SQLiteParameter("@DATEBEGIN", model.CreationDateBegin));
            }
            if (model.CreationDateEnd == null)
            {
                lstParameter.Add(new SQLiteParameter("@DATEEND", System.DateTime.MaxValue));
            }
            else
            {
                lstParameter.Add(new SQLiteParameter("@DATEEND", model.CreationDateEnd));
            }

            IEnumerable <Client> lstClient = new List <Client>();

            foreach (var item in Queries.Scripts)
            {
                if (item.Name == "SELECT_CLIENT_BY_FILTER")
                {
                    lstClient = DALHelper <Client> .GetDataReader(item.Value.ToString(), lstParameter, new ClientAdapter());
                }
            }

            foreach (Client client in lstClient)
            {
                List <SQLiteParameter> lstParameterClient = new List <SQLiteParameter>();
                lstParameter.Add(new SQLiteParameter("@ID", client.Id));
                foreach (var item in Queries.Scripts)
                {
                    if (item.Name == "SELECT_PRODUCT_BY_CLIENT")
                    {
                        client.ProductList = DALHelper <Product> .GetDataReader(item.Value.ToString(), lstParameter, new ProductAdapter());
                    }
                }
            }

            return(lstClient);
        }
Exemplo n.º 2
0
        private void BtnFilter_Click(object sender, RoutedEventArgs e)
        {
            {
                try
                {
                    ClientBS          productBs = new ClientBS();
                    ClientFilterModel model     = new ClientFilterModel();
                    model.Name              = txtName.Text;
                    model.Segment           = txtSegment.Text;
                    model.CreationDateBegin = dtBegin.SelectedDate;
                    model.CreationDateEnd   = dtEnd.SelectedDate;

                    clientList = productBs.getClientByFilter(model);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERRO: " + ex.Message);
                }
                grdClient.ItemsSource = clientList;
            }
        }
        public IActionResult GetClients([FromQuery] ClientFilterModel filter)
        {
            IEnumerable <ClientDTO> clients = clientAdminService.FindClients(mapper.Map <ClientFilterDTO>(filter));

            return(Ok(mapper.Map <IEnumerable <ClientDTO>, IEnumerable <ClientModel> >(clients)));
        }
Exemplo n.º 4
0
        public IEnumerable <Client> getClientByFilter(ClientFilterModel model)
        {
            ClientDB clientDb = new ClientDB();

            return(clientDb.getClientByFilter(model));
        }