//saving odering into oder table private void SavedOnly_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(ItemName.Text) || string.IsNullOrEmpty(Quantity.Value.ToString())) { errM.Message = "All Feilds mark with asterisk(*) Are Required"; errM.Show(); } else { //looping to get all items in the listview foreach (OrderItem.Order item in OrderList.Items) { for (int i = 0; i < OrderList.Items.Count; i++) { itemName = item.ItemName; quantity = item.Quantity; totalCost = item.Total; } MakeSaleLogic.Ordering(Customer.Text, itemName, CurrentUserLoggedInData.id.ToString(), quantity, Discount.Text, totalCost); } //sm.Message = "New item(s) order is processed successfully."; //sm.Show(); PrintDocument printDocument = new PrintDocument(); PrintPreviewDialog prview = new PrintPreviewDialog(); prview.Document = printDocument; printDocument.PrintPage += PrintDocument_PrintPage; printDocument.Print(); } }
//inserting values into varies textboxes as item is selected private void ItemName_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = ItemName.SelectedItem.ToString(); if (!MakeSaleLogic.IsQuantityZero(item)) { errM.Message = "OOPS!!! Item may have zero quantity, check available quantity and try again."; errM.Show(); } else { UnitPrice.Text = new ItemLogic().GeItemInfo(item).UnitePrice.ToString(); AvailQty.Text = new ItemLogic().GeItemInfo(item).Quantity.ToString(); Quantity.Value = 0; TotalCost.Text = 0.ToString(); } }