private void BtnCreateDocument_Click(object sender, RoutedEventArgs e) { var documentWindow = new DocumentWindow(); documentWindow.ShowDialog(); _allProducts = ProductTable.SelectAllProducts(); FillRadGridView(null, null); }
private void BtnNewProduct_Click(object sender, RoutedEventArgs e) { var addWindow = new AddNewProducts(); addWindow.ShowDialog(); _allProducts = ProductTable.SelectAllProducts(); FillRadGridView(null, null); }
private void AutoCompleText_OnLostFocus(object sender, RoutedEventArgs e) { var fe = sender as FrameworkElement; var allProducts = ProductTable.SelectAllProducts(); foreach (var panelItem in PanelProductRecord.Children) { var searchBoxItem = panelItem as SearchBoxUC; var match = allProducts.Find(ViewMain => ViewMain.ProductName == searchBoxItem.SearchBox.SearchText); if (match != null) { searchBoxItem.SearchBox.SelectedItem = match; } } foreach (var child in PanelProductRecord.Children) { var srchBoxItem = child as SearchBoxUC; if (srchBoxItem.SearchBox.Uid != fe.Uid) { continue; } if (srchBoxItem.SearchBox.SelectedItem != null) { var produc = srchBoxItem.SearchBox.SelectedItem as Product; if (produc.Catalog == null) { produc.Catalog = new Catalog { CatalogValue = String.Empty } } ; srchBoxItem.LblQtyWithUnit.Content = produc.ProductCount + " " + produc.Catalog.CatalogValue; srchBoxItem.LblQty = produc.ProductCount.ToString(); srchBoxItem.LblTotalPrice.Content = produc.ProductUnitPrice; srchBoxItem.LblPrice.Content = $"{produc.ProductUnitPrice:#,0}" + " ريال"; srchBoxItem.LblPpl.Content = produc.ProductPopularSupport ? "مردمی" : "خریداری شده"; srchBoxItem.LblId = produc.ProductId; srchBoxItem.LblStatus.Content = string.Empty; srchBoxItem.LblCatalogValue.Content = produc.Catalog.CatalogValue; srchBoxItem.ComboBoxUnitQty.Visibility = Visibility.Hidden; srchBoxItem.BtnAddCatalogItem.Visibility = Visibility.Hidden; srchBoxItem.TxtUserQty.Clear(); } else { srchBoxItem.TxtUserQty.Clear(); srchBoxItem.LblQtyWithUnit.Content = string.Empty; srchBoxItem.LblPrice.Content = string.Empty; srchBoxItem.LblPpl.Content = string.Empty; srchBoxItem.LblStatus.Content = string.Empty; } return; } }
private void ButtonEdit_OnClick(object sender, RoutedEventArgs e) { var fe = sender as FrameworkElement; if (fe != null) { var editWindow = new AddOrEditWindow { Pid = int.Parse(fe.Uid) }; editWindow.ShowDialog(); } _allProducts = ProductTable.SelectAllProducts(); FillRadGridView(null, null); }
private void ButtonDelete_OnClick(object sender, RoutedEventArgs e) { var fe = sender as FrameworkElement; var windowRemove = new RemoveWindow { WindowTitle = "حذف", Caption = "از حذف این مورد اطمینان دارید؟", OneBtn = false, Btn1 = "بله", Btn2 = "خیر" }; windowRemove.ShowDialog(); if (!windowRemove.Accept) { return; } if (fe != null) { ProductTable.DeleteFromProductTable(int.Parse(fe.Uid)); } _allProducts = ProductTable.SelectAllProducts(); FillRadGridView(null, null); }
// hotkey tab bara qty dar halate entekhab shode private void AutoCompleText_OnLostFocus(object sender, RoutedEventArgs e) { var fe = sender as FrameworkElement; foreach (var panelItem in PanelProductRecord.Children) { var addBoxItem = panelItem as AddBoxUC; if (addBoxItem.TxtTitle.Uid == fe.Uid) { if (addBoxItem.TxtTitle.SelectedItem != null) { var produc = addBoxItem.TxtTitle.SelectedItem as Product; addBoxItem.ComboBoxUnitQty.Visibility = Visibility.Hidden; addBoxItem.BtnAddCatalogItem.Visibility = Visibility.Hidden; addBoxItem.TxtPrice.Visibility = Visibility.Hidden; addBoxItem.RadioButtonBought.Visibility = Visibility.Hidden; addBoxItem.RadioButtonByPpl.Visibility = Visibility.Hidden; addBoxItem.TxtDescription.Visibility = Visibility.Hidden; addBoxItem.LblId = produc.ProductId; if (produc.Catalog == null) { produc.Catalog = new Catalog { CatalogValue = string.Empty } } ; addBoxItem.LblQtyWithUnit.Content = produc.ProductCount + " " + produc.Catalog.CatalogValue; addBoxItem.LblQty.Content = produc.ProductCount.ToString(); addBoxItem.LblPrice.Content = $"{produc.ProductUnitPrice:#,0}" + " ريال"; addBoxItem.LblByPpl.Content = produc.ProductRoot; addBoxItem.LblDescription.Content = produc.ProductDescription; addBoxItem.LblQtyWithUnit.Visibility = Visibility.Visible; addBoxItem.LblQty.Visibility = Visibility.Visible; addBoxItem.LblPrice.Visibility = Visibility.Visible; addBoxItem.LblByPpl.Visibility = Visibility.Visible; addBoxItem.LblDescription.Visibility = Visibility.Visible; continue; } var match = ProductTable.SelectAllProducts().Find(p => p.ProductName == addBoxItem.TxtTitle.SearchText); if (match != null) { addBoxItem.TxtTitle.SelectedItem = match; addBoxItem.ComboBoxUnitQty.Visibility = Visibility.Hidden; addBoxItem.BtnAddCatalogItem.Visibility = Visibility.Hidden; addBoxItem.TxtPrice.Visibility = Visibility.Hidden; addBoxItem.RadioButtonBought.Visibility = Visibility.Hidden; addBoxItem.RadioButtonByPpl.Visibility = Visibility.Hidden; addBoxItem.TxtDescription.Visibility = Visibility.Hidden; addBoxItem.LblId = match.ProductId; addBoxItem.LblQtyWithUnit.Content = match.ProductCount + " " + match.Catalog.CatalogValue; addBoxItem.LblQty.Content = match.ProductCount.ToString(); addBoxItem.LblPrice.Content = $"{match.ProductUnitPrice:#,0}" + " ريال"; addBoxItem.LblByPpl.Content = match.ProductRoot; addBoxItem.LblDescription.Content = match.ProductDescription; addBoxItem.LblQtyWithUnit.Visibility = Visibility.Visible; addBoxItem.LblQty.Visibility = Visibility.Visible; addBoxItem.LblPrice.Visibility = Visibility.Visible; addBoxItem.LblByPpl.Visibility = Visibility.Visible; addBoxItem.LblDescription.Visibility = Visibility.Visible; } else if (!string.IsNullOrWhiteSpace(addBoxItem.TxtTitle.SearchText)) { addBoxItem.LblQtyWithUnit.Visibility = Visibility.Hidden; addBoxItem.LblQty.Visibility = Visibility.Hidden; addBoxItem.LblPrice.Visibility = Visibility.Hidden; addBoxItem.LblByPpl.Visibility = Visibility.Hidden; addBoxItem.LblDescription.Visibility = Visibility.Hidden; addBoxItem.ComboBoxUnitQty.Visibility = Visibility.Visible; addBoxItem.BtnAddCatalogItem.Visibility = Visibility.Visible; addBoxItem.TxtPrice.Visibility = Visibility.Visible; addBoxItem.RadioButtonBought.Visibility = Visibility.Visible; addBoxItem.RadioButtonByPpl.Visibility = Visibility.Visible; addBoxItem.TxtDescription.Visibility = Visibility.Visible; } } } }