private void RemoveSingleFromCart(Purchase toRemove) { purchasesList.Remove(toRemove); // update the stock of the product foreach (Buyable b in currentList) { if (b.Prod.ProductID == toRemove.PrdID) { b.LeftInStock = b.LeftInStock + toRemove.Amount; } } ProductGrid.CancelEdit(); ProductGrid.Items.Refresh(); String total = Convert.ToString(int.Parse(totalPrice1.Text) - (toRemove.Price) * (toRemove.Amount)); totalPrice1.Text = total; totalPrice2.Text = total; totalAmount.Text = Convert.ToString(int.Parse(totalAmount.Text) - toRemove.Amount); if (!purchasesList.Any()) { emptyCart.Visibility = Visibility.Visible; removals.Visibility = Visibility.Collapsed; } // update product and amount selected in a dictionary if (currentCart.Any()) { currentCart.Remove(toRemove.PrdID); } }
public void OpenPanel(Space spacenr) { placedProducts.Clear(); PlacedProduct.List.Clear(); PlacedProduct.StaticList.Clear(); ProductGrid grid = (ProductGrid)view; space = spacenr; //this.SpaceNumberTitle.Text = space.Room; grid.spaceNumberTextbox.Text = space.Room; grid.spaceSizeTextbox.Text = space.Length + " + " + space.Width; meterWidth = (float)space.Width / 100; meterHeight = (float)space.Length / 100; tileSize = meterWidth / 10; if (spacenr.Final) { ((ProductList)grid.Get(ProductGrid.PropertyEnum.List)).LockRoom(); } else { ((ProductList)grid.Get(ProductGrid.PropertyEnum.List)).UnlockRoom(); } LayoutChanged(this, null); //Update the data (size and colour of the PlacedProduct, information of the ProductList and ProductInfo) PlaceProducts(); grid.Invalidate(); grid.BringToFront(); }
/// <summary> /// 获取所有的组合方案 /// </summary> /// <param name="list"></param> /// <param name="index"></param> /// <returns></returns> private List <OutPutValue> GetAllCompose(List <ProductGrid> list, ProductGrid index) { List <OutPutValue> newlist = new List <OutPutValue>(); //先增加它本身 OutPutValue outPutValue_self = new OutPutValue(); outPutValue_self.productList.Add(index); newlist.Add(outPutValue_self); for (int y = 0; y < list.Count; y++) { List <ProductGrid> tempvalue = new List <ProductGrid>(); tempvalue.Add(index); for (int t = y; t < list.Count; t++) { if (list[t].WaiJing == index.WaiJing && list[t].BiHou == index.BiHou && list[t].CaiZhi == index.CaiZhi && list[t].Dengji == index.Dengji) { tempvalue.Add(list[t]); OutPutValue outPutValue = new OutPutValue(); foreach (var tempproduct in tempvalue) { outPutValue.productList.Add(tempproduct); } newlist.Add(outPutValue); } } } return(newlist); }
public List <ProductGrid> GetAllGrid() { List <ProductGrid> productgrids = new List <ProductGrid>(); try { if (_SqlConnection.State == System.Data.ConnectionState.Closed) { _SqlConnection.Open(); } string query = "Select product.Id AS ProductId, product.Name AS ProductName, Category.Name as CategoryName" + " FROM Products as product " + "INNER JOIN Category ON product.CategoryId = Category.Id"; using (SqlCommand command = new SqlCommand(query, _SqlConnection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { ProductGrid productgrid = new ProductGrid { Id = Convert.ToInt32(reader["ProductId"].ToString()), Name = reader["ProductName"].ToString(), CategoryName = reader["CategoryName"].ToString() }; productgrids.Add(productgrid); } } } } catch (SqlException exp) { throw exp; } return(productgrids); }
private void ProductForm_VisibleChanged(object sender, EventArgs e) { if (Visible && productID == -1) { ProductGrid.ClearSelection(); } }
public SellerOrderPage() { InitializeComponent(); pGrid = new ProductGrid(textBlock_product_id_value, textBlock_product_name_value, textBlock_product_price_value, textBlock_product_rating_value, image_product); PopulateOrderLists(); ToggleButtons(); CustomEvents.current.OnProductDeleted += PopulateOrderLists; }
protected void BindProductList() { ProductController sysmgr = new ProductController(); List <Product> info = sysmgr.ListAllProducts(); ProductGrid.DataSource = info; ProductGrid.DataBind(); }
public CustomerOrderPage(CRUDManagerUser crudUser) { CrudUser = crudUser; CrudCustomer.Selected = CrudCustomer.SetSelected <Customer>(CrudCustomer.GetCustomerByUserId(CrudUser.Selected.UserId)); InitializeComponent(); pGrid = new ProductGrid(textBlock_product_id_value, textBlock_product_name_value, textBlock_product_price_value, textBlock_product_rating_value, image_product); PopulateOrderList(); CustomEvents.current.OnNewOrderPlaced += PopulateOrderList; }
private void SaleItemPopup_Load(object sender, EventArgs e) { Left = MainForm.Location.X + (MainForm.Width / 2 - Width / 2); Top = MainForm.Location.Y + (MainForm.Height / 2 - Height / 2); FilterButton_Click(sender, e); ProductGrid.ClearSelection(); }
public ProductPage(CRUDManagerUser crudUser) { CrudUser = crudUser; CrudCustomer.Selected = CrudCustomer.SetSelected <Customer>(CrudCustomer.GetCustomerByUserId(CrudUser.Selected.UserId)); CrudSeller.Selected = CrudSeller.SetSelected <Seller>(CrudSeller.GetSellerByUserId(CrudUser.Selected.UserId)); InitializeComponent(); pGrid = new ProductGrid(textBlock_product_id_value, textBlock_product_name_value, textBlock_product_price_value, textBlock_product_rating_value, image_product); InitialiseValues(); PopulateProductList(); }
private void FilterButton_Click(object sender, EventArgs e) { var filter = new ProductFilter { ID = FilterIDTextBox.Text.AsInt(), Name = FilterNameTextBox.Text, Scale = FilterScaleTextBox.Text.AsShort() }; ProductGrid.DataSource = ProductRepository.GetProducts(filter); ProductGrid.ClearSelection(); }
private void CommitButton_Click(object sender, RoutedEventArgs e) { if (editMode) { if (selectedProduct != null) { bool success = ProductFunctions.AmendProduct(selectedProduct.ID, ProductName.Text, Description.Text, Version.Text); if (success) { MessageFunctions.SuccessAlert("Your changes have been saved successfully.", "Product Amended"); refreshProductGrid(); amendmentSetup(); } } else { int newID = ProductFunctions.NewProduct(ProductName.Text, Description.Text, Version.Text); if (newID > 0) { additionMade = true; refreshProductGrid(); if (pageMode == PageFunctions.Amend) { MessageFunctions.SuccessAlert("New product '" + ProductName.Text + "' saved successfully.", "Product Created"); amendmentSetup(); ProductGrid.SelectedValue = gridList.First(s => s.ID == newID); ProductGrid.ScrollIntoView(ProductGrid.SelectedItem); } else { MessageFunctions.SuccessAlert("New product '" + ProductName.Text + "' saved successfully. You can create further products using the 'Add Another' button.", "Product Created"); ProductName.IsEnabled = Description.IsEnabled = Version.IsEnabled = false; editMode = false; CommitButton.IsEnabled = false; AddButton.Visibility = Visibility.Visible; AddButton.IsEnabled = true; AddImage.Visibility = Visibility.Visible; ReturnImage2.Visibility = Visibility.Collapsed; } AddButtonText.Text = "Add Another"; } } } else { MessageFunctions.Error("Saving should not be possible.", null); } }
private void CancelButton_Click(object sender, EventArgs e) { ProductErrorProvider.Clear(); if (productID > 0) { ViewProductDetailTab(productID); } else { ViewProductListingTab(); productID = -1; ProductGrid.ClearSelection(); } }
protected void Page_Load(object sender, EventArgs e) { EClient user = (EClient)Session["user"]; if (user != null) { welc.Text = "Hoşgeldin " + user.name + " ! İşte Yemeklerimiz"; welc.Visible = true; if (!IsPostBack) { ProductGrid.DataSource = BLLProduct.SelectProduct_Category(1); using (System.IO.StreamWriter file = new System.IO.StreamWriter(submittedFilePath, true)) { file.WriteLine("[" + DateTime.Now + "] DB PRODUCTS SELECTED BY CATEGORY"); } ProductGrid.DataBind(); aperatifGrid.DataSource = BLLProduct.SelectProduct_Category(2); using (System.IO.StreamWriter file = new System.IO.StreamWriter(submittedFilePath, true)) { file.WriteLine("[" + DateTime.Now + "] DB PRODUCTS SELECTED BY CATEGORY"); } aperatifGrid.DataBind(); IcecekGrid.DataSource = BLLProduct.SelectProduct_Category(3); using (System.IO.StreamWriter file = new System.IO.StreamWriter(submittedFilePath, true)) { file.WriteLine("[" + DateTime.Now + "] DB PRODUCTS SELECTED BY CATEGORY"); } IcecekGrid.DataBind(); tatlıGrid.DataSource = BLLProduct.SelectProduct_Category(4); using (System.IO.StreamWriter file = new System.IO.StreamWriter(submittedFilePath, true)) { file.WriteLine("[" + DateTime.Now + "] DB PRODUCTS SELECTED BY CATEGORY"); } tatlıGrid.DataBind(); } } else { welc.Visible = false; Response.Redirect("~/Default.aspx"); } }
public void bindGrid() //function to bind gridView(Read Operation) { using (LatihanEntities context = new LatihanEntities()) { ProductGrid.DataSource = (from product in context.Products select new { Id = product.Id, Name = product.Name, Brand = product.Brand, Category = product.Category, Price = product.Price }).ToList(); ProductGrid.DataBind(); } }
public MainWindow() { try { _SellInfo.MainWindow = this; InitializeComponent(); Display.initDisplay(tbloNmrDisplay, tbloLineOne, tbloLineTwo); D.W("Checking cash!"); checkCashLogging(); total = new Price(0); setStatus("Bereit!"); NumberKeyManager.RegisterAll(btnZero, btnOne, btnTwo, btnThree, btnFour, btnFive, btnSix, btnSeven, btnEight, btnNine); _productGrid = new ProductGrid(ProductGrid.DefaultGridMeta, ProductButtonsGrid); initFirstPage(); clearProducts(); } catch (Exception ex) { D.W("Exception when initializing MainWindow..." + ex.ToString()); Application.Current.Shutdown(); } }
private void ViewComponentDetailTab(int id) { using (var repository = new ComponentTypeRepository()) { var dropDown = repository.GetComponentTypeForDropDown(); dropDown.Insert(0, new KeyValuePair <byte, string>(0, "<Vytvořit nový typ...>")); ComponentTypeDropDown.DataSource = dropDown; } if (id > 0) { IsWork = false; RibbonMode = RibbonMode.Detail; ChangeControlsEnabled(DetailTab.Controls, false, false); var component = ComponentRepository.GetComponent(componentID); ComponentTypeDropDown.SelectedValue = component.ComponentTypeID; NameTextBox.Text = component.Name.ToString(); ProductGrid.DataSource = ComponentRepository.GetProducts(componentID); ComponentTabControl.SelectedTab = DetailTab; ProductGrid.ClearSelection(); } else { IsWork = true; RibbonMode = RibbonMode.Edit; ChangeControlsEnabled(DetailTab.Controls, true, true); ComponentTabControl.SelectedTab = DetailTab; } }
private void RemoveManyFromCart(object sender, RoutedEventArgs e) { if (!purchasesList.Any()) { MessageBox.Show("The shopping cart is empty"); } else { // update the stock of the products foreach (Purchase p in purchasesList) { if (currentList.Any()) { foreach (Buyable b in currentList) { if (p.PrdID == b.Prod.ProductID) { b.LeftInStock = b.LeftInStock + p.Amount; } } } } ProductGrid.CancelEdit(); ProductGrid.Items.Refresh(); purchasesList.Clear(); // zero the total price and total amount of products in the shopping cart totalPrice1.Text = Convert.ToString(0); totalPrice2.Text = Convert.ToString(0); totalAmount.Text = Convert.ToString(0); currentCart.Clear(); } }
public void Search(string name, decimal?min_price, decimal?max_price, int page, int take, int?supplierId) { using (var ctx = new ProductMNEntities()) { var domain = new ProductDomain(ctx); var model = domain.QueryFilter(name, min_price, max_price, page, take, supplierId); ProductGrid.DataSource = model.list; ProductGrid.DataBind(); total_count = model.total_count; this.page = page; //LiteralControl pagination_elements = new LiteralControl(); //var pagination = Request.Form["pagination"]; //Console.WriteLine(pagination); //if (pagination != null) //{ // pagination_elements.Text += @"<li><a href='#'>1</a></li>"; // pagination.Controls.Add(pagination_elements); //} } }
protected void Page_Load(object sender, EventArgs e) { SQLDataClass.getAllProducts(); ProductGrid.DataSource = SQLDataClass.tblProduct; ProductGrid.DataBind(); }
private void BindData() { _products = _repo.GetAll(); ProductGrid.DataSource = _products; ProductGrid.DataBind(); }
private void AddSingleToCart(Buyable b) { Purchase toBuy = new Purchase(b.Prod.ProductID, b.Prod.Name, b.Prod.Price, b.Amount); if (b.Amount < 0) { MessageBox.Show("Invalid product amount"); } else if (b.Amount == 0) { MessageBox.Show("please choose an amount to buy"); } else if (b.Amount > b.LeftInStock) { MessageBox.Show("We don't have so many " + b.Prod.Name + "s at E-MART!"); } else { // check if the same product is already in the shopping cart Purchase identical = null; if (purchasesList.Any()) { foreach (Purchase p in purchasesList) { if (p.PrdID == toBuy.PrdID) { identical = p; } } } if (identical == null) { purchasesList.Add(toBuy); } else { identical.Amount += toBuy.Amount; } // refresh the shopping cart datagrid purchaseGrid.CancelEdit(); purchaseGrid.Items.Refresh(); // update the stock of the product b.LeftInStock = b.LeftInStock - b.Amount; // update the total price and total amount of products in the shopping cart String total = Convert.ToString(int.Parse(totalPrice1.Text) + (b.Prod.Price) * (b.Amount)); totalPrice1.Text = total; totalPrice2.Text = total; totalAmount.Text = Convert.ToString(int.Parse(totalAmount.Text) + b.Amount); emptyCart.Visibility = Visibility.Collapsed; removals.Visibility = Visibility.Visible; // update product and amount selected in a dictionary bool flag = false; if (currentCart.Any()) { foreach (int inCart in currentCart.Keys) { if (b.Prod.ProductID == inCart && !flag) { flag = true; } } } if (flag) { currentCart[b.Prod.ProductID] = b.LeftInStock; } else { currentCart.Add(b.Prod.ProductID, b.LeftInStock); } // zero the amount in main table b.ZeroAmount(); // refresh the products datagrid ProductGrid.CancelEdit(); ProductGrid.Items.Refresh(); } }
protected void ProductGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { ProductGrid.PageIndex = e.NewPageIndex; ProductGrid.DataBind(); }
private void SelectAllContextMenuItem_Click(object sender, EventArgs e) { ProductGrid.SelectAll(); }