public async Task <PagedResult <Product> > QueryPagedAsync(QueryProducts query)
        {
            var products = await _repostory.QueryPagedAsync(p => p.Price >= query.PriceFrom &&
                                                            p.Price < query.PriceTo, query);

            return(products);
        }
Exemple #2
0
        public MovementEditForm(MovementsListForm instance)
        {
            this.instance = instance;
            InitializeComponent();

            query      = new QueryContractMove();
            queryStore = new QueryStore();
            queryProd  = new QueryProducts();

            this.Text         = Properties.Resources.Movement;
            label1.Text       = Properties.Resources.Good;
            label7.Text       = Properties.Resources.Amount;
            label2.Text       = Properties.Resources.Date;
            label3.Text       = Properties.Resources.FromStorage;
            label4.Text       = Properties.Resources.FromCell;
            label6.Text       = Properties.Resources.ToStorage;
            label5.Text       = Properties.Resources.ToCell;
            buttonCancel.Text = Properties.Resources.Cancel;
            buttonOK.Text     = Properties.Resources.OK;

            List <ObjectComboBox> lObj1 = new List <ObjectComboBox>();

            foreach (var item in queryStore.querySelectStorehouses())
            {
                lObj1.Add(new ObjectComboBox(item.Id, item.Name));
            }

            comboBoxStorehouseFrom.DataSource    = lObj1;
            comboBoxStorehouseFrom.ValueMember   = "Id";
            comboBoxStorehouseFrom.DisplayMember = "Name";

            List <ObjectComboBox> lObj3 = new List <ObjectComboBox>();

            foreach (var item in queryStore.querySelectStorehouses())
            {
                lObj3.Add(new ObjectComboBox(item.Id, item.Name));
            }

            comboBoxStorehouseTo.DataSource    = lObj3;
            comboBoxStorehouseTo.ValueMember   = "Id";
            comboBoxStorehouseTo.DisplayMember = "Name";

            List <ObjectComboBox> lObjPr = new List <ObjectComboBox>();

            foreach (var item in queryProd.querySelectProducts())
            {
                lObjPr.Add(new ObjectComboBox(item.Id, item.Name));
            }

            comboBoxProducts.DataSource = lObjPr;

            comboBoxProducts.ValueMember   = "Id";
            comboBoxProducts.DisplayMember = "Name";
        }
Exemple #3
0
        private void EditarProducto_Load(object sender, EventArgs e)
        {
            //load Productos en combobox
            var Productos = QueryProducts.listaProducts();

            foreach (var dato in Productos)
            {
                cmbBuscarProd.Items.Add(dato);
            }
            //load ids type
            var ids = QueryType.listaIdtypes();

            foreach (var dato in ids)
            {
                cmbTypeUpdate.Items.Add(dato);
            }
            //load colores
            var colores = QueryColor.listaColores();

            foreach (var dato in colores)
            {
                cmbColorUpdate.Items.Add(dato);
            }
            //load Brands
            var brand = QueryBrand.listaBrands();

            foreach (var dato in brand)
            {
                cmbMarcaUpdate.Items.Add(dato);
            }
            //load Provider
            var prov = QueryProvider.listaProvider();

            foreach (var dato in prov)
            {
                cmbProveeUpdate.Items.Add(dato);
            }
            //load catalog
            var cat = QueryCatalog.listaCatalog();

            foreach (var dato in cat)
            {
                cmbCatalogoUpdate.Items.Add(dato);
            }
            //load Tallas
            var size = QueryTalla.listaTallas();

            foreach (var dato in size)
            {
                cmboSize.Items.Add(dato);
            }
        }
        public IActionResult QuerySpecificProducts([FromServices] QueryProducts productQuery, [FromBody] List <Guid> ids)
        {
            Logger.Debug("Specific Product Query: {@Ids} ", ids);

            CatalogPage <Product> products = productQuery.Query(ids);

            if (!productQuery.IsSuccesful)
            {
                Logger.Warn("Specific product query failed, ids searched: {@ids} ", ids);
                return(BadRequest(productQuery.Errors));
            }
            return(Ok(products));
        }
        public SuppluEditForm(SupplyListForm instance)
        {
            this.instance = instance;

            InitializeComponent();

            query            = new QueryContractSupply();
            queryProd        = new QueryProducts();
            queryContractors = new QueryContractors();

            this.Text             = Properties.Resources.Supply;
            labelId.Text          = Properties.Resources.SupplyContract;
            label2.Text           = Properties.Resources.Date;
            label3.Text           = Properties.Resources.Goods;
            label4.Text           = Properties.Resources.Number;
            labelAmount.Text      = Properties.Resources.Amount;
            labelWasReceived.Text = Properties.Resources.Received;
            labelContractors.Text = Properties.Resources.Contractor;

            buttonCancel.Text = Properties.Resources.Cancel;
            buttonOK.Text     = Properties.Resources.OK;

            ArrayList lObjPr = new ArrayList();

            foreach (var item in queryProd.querySelectProducts())
            {
                lObjPr.Add(new { Id = item.Id, Name = item.Name });
            }

            comboBoxProducts.DataSource    = lObjPr;
            comboBoxProducts.ValueMember   = "Id";
            comboBoxProducts.DisplayMember = "Name";

            List <bool> lObjBool = new List <bool> {
                true, false
            };

            comboBoxWasReceived.DataSource = lObjBool;

            ArrayList lObjContr = new ArrayList();

            foreach (var item in queryContractors.querySelectContractors(2))
            {
                lObjContr.Add(new { Id = item.Id, Name = item.Name });
            }

            comboBoxContractors.DataSource    = lObjContr;
            comboBoxContractors.ValueMember   = "Id";
            comboBoxContractors.DisplayMember = "Name";
        }
Exemple #6
0
        private void btnSearchProd_Click(object sender, EventArgs e) //btn buscar producto
        {
            try
            {
                var  Idproducto = QueryProducts.EncuentraIdProducts(cmbBuscarProd.Text.Trim());
                var  a          = QueryProducts.DP_SP(Idproducto); //traer el registro usando el SP
                bool logico     = a.IsEnabled;
                cmbTypeUpdate.Text        = Convert.ToString(a.IdType);
                cmbColorUpdate.Text       = QueryColor.EncuentraNombreColor(Convert.ToInt32(a.IdColor));
                cmbMarcaUpdate.Text       = QueryBrand.EncuentraNombreBrand(Convert.ToInt32(a.IdBrand));
                cmbProveeUpdate.Text      = QueryProvider.EncuentraNombreProvider(Convert.ToInt32(a.IdProvider));
                cmbCatalogoUpdate.Text    = QueryCatalog.EncuentraNombreCatalog(Convert.ToInt32(a.IdCatalog));
                txtTitleUpdate.Text       = a.Title;
                txtNombreUpdate.Text      = a.Nombre;
                txtDescUpdate.Text        = a.Description;
                txtObsUpdate.Text         = a.Observations;
                txtPriceDisUpdate.Text    = Convert.ToString(a.PriceDistributor);
                txtPriceClientUpdate.Text = Convert.ToString(a.PriceClient);
                txtPriceMemberUpdate.Text = Convert.ToString(a.PriceMember);
                if (logico == true)
                {
                    cmbEnableUpdate.Text = "YES";
                }
                else
                {
                    cmbEnableUpdate.Text = "NO";
                };
                txtKeywordsUpdate.Text = a.Keywords;

                var idImage = BuscaIdTablaImagen.search(Idproducto);
                if (idImage == 0)
                {
                }                     //por si la imagen es nula
                else
                {
                    using (DataProductsEntities ld = new DataProductsEntities())
                    {
                        var          oimg = ld.ImagesProduct.Find(idImage);
                        MemoryStream mstm = new MemoryStream(oimg.Image);
                        Bitmap       bmp  = new Bitmap(mstm);
                        pictureBox1.Image = bmp;
                    }
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Error: " + error.Message);
            }
        }
Exemple #7
0
        public GoodEditForm(GoodsListForm instance)
        {
            this.instance = instance;
            InitializeComponent();

            query = new QueryProducts();

            this.Text         = Properties.Resources.Good;
            label2.Text       = Properties.Resources.Title;
            label3.Text       = Properties.Resources.VendorCode;
            label4.Text       = Properties.Resources.Description;
            label5.Text       = Properties.Resources.Color;
            buttonCancel.Text = Properties.Resources.Cancel;
            buttonOK.Text     = Properties.Resources.OK;
        }
        public async Task <PagedResult <ProductDto> > HandleAsync(QueryProducts query)
        {
            var pagedResult = await _productRepository.QueryPagedAsync(query);

            var products = pagedResult.Items.Select(p => new ProductDto
            {
                Id          = p.Id,
                Name        = p.Name,
                Description = p.Description,
                Vendor      = p.Vendor,
                Price       = p.Price,
                Quantity    = p.Quantity
            });

            return(PagedResult <ProductDto> .From(pagedResult, products));
        }
        public IActionResult QueryProducts([FromServices] QueryProducts productQuery, [FromQuery] string searchString)
        {
            Logger.Debug("Product Query: {Search} ", searchString);
            var searchParameters = new SearchParameters()
            {
                SearchString = searchString
            };

            CatalogPage <Product> products = productQuery.Query(searchParameters);

            if (!productQuery.IsSuccesful)
            {
                Logger.Warn("Product query failed, search string: {@searchstring} ", searchString);
                return(BadRequest("Something went wrong."));
            }

            return(Ok(products));
        }
Exemple #10
0
        public CardEditForm(CardsListForm instance)
        {
            this.instance = instance;
            InitializeComponent();

            query     = new QueryTechnologicalCards();
            queryProd = new QueryProducts();

            this.Text         = Properties.Resources.Card;
            label1.Text       = Properties.Resources.Title;
            label2.Text       = Properties.Resources.InputGoods;
            label3.Text       = Properties.Resources.OutputGoods;
            label4.Text       = Properties.Resources.Date;
            buttonCancel.Text = Properties.Resources.Cancel;
            labelAmount1.Text = Properties.Resources.Amount;
            labelAmount2.Text = Properties.Resources.Amount;
            buttonOK.Text     = Properties.Resources.OK;

            List <ObjectComboBox> lObjPr1 = new List <ObjectComboBox>();

            foreach (var item in queryProd.querySelectProducts())
            {
                lObjPr1.Add(new ObjectComboBox(item.Id, item.Name));
            }

            comboBoxProductsImport.DataSource = lObjPr1;

            comboBoxProductsImport.ValueMember   = "Id";
            comboBoxProductsImport.DisplayMember = "Name";

            List <ObjectComboBox> lObjPr2 = new List <ObjectComboBox>();

            foreach (var item in queryProd.querySelectProducts())
            {
                lObjPr2.Add(new ObjectComboBox(item.Id, item.Name));
            }

            comboBoxProductsExport.DataSource = lObjPr2;

            comboBoxProductsExport.ValueMember   = "Id";
            comboBoxProductsExport.DisplayMember = "Name";
        }
Exemple #11
0
        private void btnUpdateReg_Click(object sender, EventArgs e) //btn guardar  registro Actualizado
        {
            //guardar una talla
            try
            {
                if (string.IsNullOrWhiteSpace(cmboSize.Text.Trim()))
                {
                }
                else
                {
                    //buscar id de la talla seleccionada
                    int IdSizze = SearchID.SearchIDSize(cmboSize.Text);
                    //buscar id del producto
                    var Idproducto = QueryProducts.EncuentraIdProducts(cmbBuscarProd.Text.Trim());
                    //Insertar la talla y el id del producto en tabla SizeOfProduct
                    InsertaProducto.InsertarTalla(Idproducto, IdSizze);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Error: " + error.Message);
            }

            //guardar el registro actualizado

            DateTime thisDay = DateTime.Today;
            var      fecha   = thisDay.ToString();
            //buscar id del producto
            var Idproducto2 = QueryProducts.EncuentraIdProducts(cmbBuscarProd.Text.Trim());
            //lista de datos
            List <string> cadenaUpdate = new List <string>();

            cadenaUpdate.Add(cmbTypeUpdate.Text);                                                        //typyId
            cadenaUpdate.Add(Convert.ToString(QueryColor.EncuentraIdColor(cmbColorUpdate.Text)));        //buscar el id del color y agregarlo a la lista
            cadenaUpdate.Add(Convert.ToString(QueryBrand.EncuentraIdBrand(cmbMarcaUpdate.Text)));        //busca id y agregar a la lista
            cadenaUpdate.Add(Convert.ToString(QueryProvider.EncuentraIdProvider(cmbProveeUpdate.Text))); // busca id y agrega a la lista
            cadenaUpdate.Add(Convert.ToString(QueryCatalog.EncuentraIdCatalog(cmbCatalogoUpdate.Text))); // busca id y agrega a la lista
            cadenaUpdate.Add(txtTitleUpdate.Text);                                                       // Title
            cadenaUpdate.Add(txtNombreUpdate.Text);                                                      // Nombre
            cadenaUpdate.Add(txtDescUpdate.Text);                                                        // Descripcion
            cadenaUpdate.Add(txtObsUpdate.Text);                                                         //observaciones
            cadenaUpdate.Add(txtPriceDisUpdate.Text);                                                    //price distributor
            cadenaUpdate.Add(txtPriceClientUpdate.Text);                                                 //price client
            cadenaUpdate.Add(txtPriceMemberUpdate.Text);                                                 //price Member
            cadenaUpdate.Add(cmbEnableUpdate.Text);                                                      //Enable
            cadenaUpdate.Add(txtKeywordsUpdate.Text);                                                    //keywords
            cadenaUpdate.Add(fecha);                                                                     //fecha y hora
            try
            {
                UpdateProducto.ActualizarProducto(Idproducto2, cadenaUpdate);    //envio de la cadena a la funcion
                MessageBox.Show("Registro Guardado");
            }
            catch (Exception error)
            {
                MessageBox.Show("Error: " + error.Message);
            }
            //guardar imagen
            var context = new DataProductsEntities();

            if (txtImgDesc.Text.Trim().Equals(""))
            {
            }                                           //si esta vacio no pasa nada, no es necesario guardar img, es opcional
            else
            {
                //crear memoria de bytes
                byte[] file     = null;
                Stream myStream = openFileDialog1.OpenFile();
                using (MemoryStream ms = new MemoryStream())
                {
                    myStream.CopyTo(ms);
                    file = ms.ToArray();
                }
                var logic = 0;
                if (cmbEnableUpdate.Text == "YES")
                {
                    logic = 1;
                }
                else
                {
                    logic = 0;
                }
                GuardarImagen.RegistraImagen(Idproducto2, txtImgDesc.Text.Trim(), file, fecha, logic);
                MessageBox.Show("Registro completado con exito");
            }
        }
        public GoodsListForm()
        {
            InitializeComponent();

            query = new QueryProducts();

            this.Text = Properties.Resources.Goods;

            labelSearch.Text = Properties.Resources.Search;
            labelColor.Text  = Properties.Resources.Color;

            buttonCreate.Text  = Properties.Resources.Create;
            buttonEdit.Text    = Properties.Resources.Edit;
            button1.Text       = Properties.Resources.Delete;
            buttonRefresh.Text = Properties.Resources.Refresh;

            dataGridView1.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.ReadOnly            = true;
            dataGridView1.AllowUserToAddRows  = false;
            dataGridView1.RowHeadersVisible   = false;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
            dataGridView1.ScrollBars          = ScrollBars.Both;

            searchNameBox.Text        = Properties.Resources.Title;
            searchArticleBox.Text     = Properties.Resources.VendorCode;
            searchDescriptionBox.Text = Properties.Resources.Description;
            buttonSearch.Text         = Properties.Resources.Search;

            DataGridViewTextBoxColumn col0 = new DataGridViewTextBoxColumn();

            col0.HeaderText = Properties.Resources.ID;

            DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn();

            col1.HeaderText = Properties.Resources.Title;

            DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn();

            col2.HeaderText = Properties.Resources.VendorCode;

            DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn();

            col3.HeaderText = Properties.Resources.Description;

            DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn();

            col4.HeaderText = Properties.Resources.Color;

            dataGridView1.Columns.Add(col0);
            dataGridView1.Columns.Add(col1);
            dataGridView1.Columns.Add(col2);
            dataGridView1.Columns.Add(col3);
            dataGridView1.Columns.Add(col4);

            addGridView(query.querySelectProducts());

            List <ObjectComboBox> lObj = new List <ObjectComboBox>();

            lObj.Add(new ObjectComboBox(0, Properties.Resources.All));

            int i = 1;

            foreach (string item in query.querySelectAllColors())
            {
                lObj.Add(new ObjectComboBox(i, item));
                i++;
            }
            comboBoxColors.DataSource    = lObj;
            comboBoxColors.ValueMember   = "Id";
            comboBoxColors.DisplayMember = "Name";
        }
        public async Task <PagedResult <ProductDto> > QueryPagedAsync([FromQuery] QueryProducts query)
        {
            var result = await QueryAsync(query);

            return(result);
        }