/// <summary> /// количество заказанных продуктов когда-либо /// </summary> /// <param name="client"></param> /// <returns></returns> public bool FirstIf(CLIENT client) { try { int count = 0; foreach (var o in basketService.All()) { if (o.id_client == client.id_client) { if (o.id_product != 0) { count++; } } } if (count >= 3) { return(true); } return(false); } catch (Exception e) { throw e; } }
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() })); } } }