public void AddProductToConfrimOrderListItem() { if (GetProductListItemModel == null) { DI.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Message", Message = "Please choose one or more some product to the order list!" }); return; } try { if (GetProductListItemModel != null) { ConfirmOrderListItemsCollection.Add(new ConfirmOrderListItemModel { ProductId = GetProductListItemModel.ProductId, ProductName = GetProductListItemModel.ProductName, ProductCategory = GetProductListItemModel.ProductCategory, Brand = GetProductListItemModel.Brand, Price = GetProductListItemModel.Price, ImgUrl = GetProductListItemModel.ImgUrl, }); } } catch (Exception Ex) { CoreDI.Logger.Log(Ex.Message); System.Windows.MessageBox.Show(Ex.Message); } }
public void SearchDirectProductAddToConfirmOrder() { if (SearchText == null || SearchText == "") { DI.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Message", Message = "Data kosong!, masukan ID produk untuk proses pencarian" }); return; } try { var query = (from product in Context.Products join category in Context.ProductCategories on product.ProductCategoryId equals category.ProductCategoryId join supplier in Context.ProductSuppliers on product.ProductSupplierId equals supplier.ProductSupplierId where product.ProductId == SearchText select new { product.ProductId, product.ProductName, category.Category, supplier.Brand, product.CurrentStock, product.Price, product.Description, product.ImgUrl, }).ToList(); if (query != null) { foreach (var pro in query) { if ((pro.ProductId == SearchText) || (pro.ProductName == SearchText)) { ConfirmOrderListItemsCollection.Add(new ConfirmOrderListItemModel { ProductId = GetProductListItemModel.ProductId, ProductName = GetProductListItemModel.ProductName, ProductCategory = GetProductListItemModel.ProductCategory, Brand = GetProductListItemModel.Brand, Price = GetProductListItemModel.Price, ImgUrl = GetProductListItemModel.ImgUrl, }); IsConfirmOrderControlMenuVisible = true; } else { throw new Exception(); } } if (query.Count < 1) { throw new Exception(); } ClearSearchTextHistory(); } } catch (Exception Ex) { DI.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Message", Message = $"Sistem tidak menemukan data '{SearchText}' di dalam server!" }); CoreDI.Logger.Log(Ex.Message); } }