private void lvClientsProducts_SelectedIndexChanged(object sender, EventArgs e) { if (lvClientsProducts.SelectedRows.Count == 0) { return; } pbClientProductPhoto.Image = ImgConverter.ImageFromString(lClientsProducts[lvClientsProducts.SelectedRows[0].Index] .Product.photo); }
private void FEditProduct_Load(object sender, EventArgs e) { tbName.Text = product.title; tbCategory.Text = product.category; tbSize.Text = product.size.ToString(); tbColor.Text = product.color; pictureBoxPhoto.Image = ImgConverter.ImageFromString(product.photo); tbPrice.Text = product.price.ToString(); tbCount.Text = product.count.ToString(); }
private void lvProductSrecOffer_SelectionChanged(object sender, EventArgs e) { try { if (lvProductSrecOffer.SelectedRows.Count == 0) { return; } Image photo = ImgConverter.ImageFromString(lProductSrecOffer[lvProductSrecOffer.SelectedRows[0].Index].photo); pbImage.Image = photo; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnCreate_Click(object sender, EventArgs e) { flpProductsView.Controls.Clear(); upm.MinPrice = decimal.Parse(tbPriceBegin.Text); upm.MaxPrice = decimal.Parse(tbPriceEnd.Text); upm.ApplyUserFilter(); productsList = upm.GetPreferenceList(); foreach (PRODUCT entity in productsList) { string description = entity.title + Environment.NewLine + entity.category + Environment.NewLine + entity.color + Environment.NewLine + entity.price.ToString(); ProductViewPanel pvPanel = new ProductViewPanel(); pvPanel.pbPhoto.Image = ImgConverter.ImageFromString(entity.photo); pvPanel.tbDescription.Text = description; flpProductsView.Controls.Add(pvPanel); } }
private void panelMannequin_DragDrop(object sender, DragEventArgs e) { //индекс = индекс в listProduct int index_selected_product = Int32.Parse(e.Data.GetData(DataFormats.Text).ToString()); Image img = ImgConverter.ImageFromString(listProduct[index_selected_product].photo); if (listSelectedProduct.Contains(listProduct[index_selected_product])) { return; } clothes.Add(img); DrawClothesOnMannequin(clothes); //отрисовка всех изображений на манекене // //вывод в листбокс выбранных нами продуктов // listSelectedProduct.Add(listProduct[index_selected_product]); //сначала добавляем их в обычный список PRODUCT selPoduct = listProduct[index_selected_product]; //выбранный продукт UpdateMannequinList(); }
private void lvProducts_SelectedIndexChanged(object sender, EventArgs e) { try { if (lvProducts.SelectedRows.Count == 0) { return; } Image photo = ImgConverter.ImageFromString(lProducts[lvProducts.SelectedRows[0].Index].photo); pictureBoxPhoto.Image = photo; PRODUCT product = lProducts[lvProducts.SelectedRows[0].Index]; lProductStructure.Clear(); lProductStructure = productsControlS.GetProductStructure(product); UpdateListViewProductStruct(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void UpdateBasketList() { try { listControls.Clear(); panelProduct.Controls.Clear(); for (int i = 0; i < listSelectedProduct.Count; i++) { PRODUCT pr = listSelectedProduct[i]; bool availability = orderModule.CheckForAvailability(pr); string s = ""; switch (availability) { case true: s = "Наличие на складе: Да"; break; case false: s = "Наличие на складе: Нет -> "; break; } UserControlBasket us = new UserControlBasket(); us.ID = i; /// ///Проверка на возможность пошить товар, если его нет на складе /// if (availability) { us.nUDCount.Value = 1; us.nUDCount.Maximum = orderModule.GetProductLimit(pr); } else { us.nUDCount.Value = 0; us.nUDCount.Maximum = orderModule.GetSewingLimit(pr); if (us.nUDCount.Maximum == 0) { s += "В данный момент отсутствуют материалы для пошива этого товара"; } else { s += "Вы можете заказать этот товар на пошив"; } } us.tbInfo.Text = "Наименование: " + pr.title + Environment.NewLine + "Размер: " + pr.size + Environment.NewLine + "Цвет: " + pr.color + Environment.NewLine + "Цена: " + pr.price + Environment.NewLine + s; us.pb.Image = ImgConverter.ImageFromString(pr.photo); us.tbTotal.Text = (us.nUDCount.Value * pr.price).ToString(); us.nUDCount.ValueChanged += nUDCount_ValueChanged; listControls.Add(us); panelProduct.Controls.Add(us); us.btnRemove.Click += BtnRemove_Click; } SetProductInfo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FTanyaModule_Load(object sender, EventArgs e) { lbasket = basketService.All(); Allproducts = productServise.All(); foreach (BASKET b in lbasket) { if (b.id_order != -1) { listOrder.Add(b); } } try { if (listOrder.Count < 10) { foreach (BASKET b in listOrder) { foreach (PRODUCT p in Allproducts) { if (b.id_product == p.id_product) { if (!productsList.Contains(p)) { productsList.Add(p); } } } } } else { int count = (20 * listOrder.Count) / 100; while (count > 0) { foreach (BASKET b in listOrder) { foreach (PRODUCT p in Allproducts) { if (b.id_product == p.id_product) { if (!productsList.Contains(p)) { productsList.Add(p); } } } } count--; } } candidates_list = tModule.ShoppersList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (productsList != null) { foreach (PRODUCT entity in productsList) { string description = entity.title + Environment.NewLine + entity.category + Environment.NewLine + entity.color + Environment.NewLine + entity.price.ToString(); ProductViewPanel pvPanel = new ProductViewPanel(); pvPanel.pbPhoto.Image = ImgConverter.ImageFromString(entity.photo); pvPanel.tbDescription.Text = description; flpProductsView.Controls.Add(pvPanel); } } if (candidates_list != null) { foreach (var c in candidates_list) { string str = c.login + c.name + c.mail; listView1.Items.Add(new ListViewItem(new string[] { c.id_client.ToString(), c.login, c.surname, c.name, c.mail, c.phone_number.ToString() })); } } }
private void LoadProductView() { try { if (client.sex == 1) { mannequinImg = Image.FromFile(@"res\images\Man.png"); } else { mannequinImg = Image.FromFile(@"res\images\Woman.png"); } listProduct.Clear(); if (tanyaM.ShoppersList() .Where(x => x.id_client == client.id_client) .ToList().Count != 0) { ProductSaleContainer prodSaleC = Serializer.DeserializeClass(typeof(ProductSaleContainer), "ProductSale.xml") as ProductSaleContainer; if (prodSaleC != null) { saleSize = prodSaleC.sale; listProduct = orderControl.AllProducts(); for (int i = 0; i < listProduct.Count; i++) { if (prodSaleC.productsId.Contains(listProduct[i].id_product)) { listProduct[i].price = DecrementPercentages(listProduct[i].price, saleSize); } } lblSaleInfo.Text = "Вам предоставлена специальная скидка на товары в размере " + saleSize + "%"; } else { listProduct = orderControl.AllProducts(); lblSaleInfo.Text = ""; } } else { listProduct = orderControl.AllProducts(); lblSaleInfo.Text = ""; } //рисуем изначальный манекен DrawClothesOnMannequin(clothes); // извлекаются все изображения и добавляются в imagelist imageList.Images.Clear(); foreach (var product in listProduct) { imageList.Images.Add(ImgConverter.ImageFromString(product.photo)); } //все продукты добавляются в listView UpdateListViewProducts(); clothes.Clear(); //очищаем список добавленных на манекен вещей listSelectedProduct.Clear(); //очищаем список выбранных нами вещей } catch (Exception ex) { MessageBox.Show(ex.Message); } }