public CustomerOrderHistoryList() { try { CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel(); InitializeComponent(); CenterWindowOnScreen(); dpFromDate.SelectedDate = System.DateTime.Now; dpToDate.SelectedDate = System.DateTime.Now; customerOrderHistoryModel = customerOrderViewModel.GetCustomerOrderHistoryList(dpFromDate.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDate.SelectedDate.Value.ToString(CommonMethods.DateFormat)); if (customerOrderHistoryModel.Count > 0) { lblInvoiceCount.Content = customerOrderHistoryModel[0].InvoiceCount; lblInvoiceTotal.Content = customerOrderHistoryModel[0].InvoiceTotal; } else { lblInvoiceCount.Content = "0"; lblInvoiceTotal.Content = "0.00"; } this.dgOrderList.ItemsSource = customerOrderHistoryModel; } catch (Exception ex) { SystemError.Register(ex); } }
private void btnSearchOrderList_Click(object sender, RoutedEventArgs e) { try { List <CustomerOrderHistoryModel> customerOrderHistoryModel = new List <CustomerOrderHistoryModel>(); CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel(); customerOrderHistoryModel = customerOrderViewModel.GetCustomerOrderHistoryList(dpFromDate.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDate.SelectedDate.Value.ToString(CommonMethods.DateFormat)); this.dgOrderList.ItemsSource = customerOrderHistoryModel; if (customerOrderHistoryModel.Count > 0) { lblInvoiceCount.Content = customerOrderHistoryModel[0].InvoiceCount; lblInvoiceTotal.Content = customerOrderHistoryModel[0].InvoiceTotal; } else { lblInvoiceCount.Content = "0"; lblInvoiceTotal.Content = "0.00"; } } catch (Exception ex) { SystemError.Register(ex); } }
private void btnChangePaymentMethod_Click(object sender, RoutedEventArgs e) { try { var order = (CustomerOrderHistoryModel)dgOrderList.SelectedItem; if (string.IsNullOrEmpty(order.Payment) || order.Payment.Contains(",")) { var messageBoxResult = WpfMessageBox.Show(StatusMessages.CustomerOrderHistory, StatusMessages.PaymentMethodModifyNotAllow, MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); cmbSelectPaymentMethod.Focus(); return; } ppChangePaymentMethod.IsOpen = true; CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel(); List <PaymentMethodModel> paymentMethodModels = new List <PaymentMethodModel>(); paymentMethodModels = customerOrderViewModel.GetPaymentMethod(); cmbSelectPaymentMethod.ItemsSource = paymentMethodModels; cmbSelectPaymentMethod.Text = "Select Payment"; cmbSelectPaymentMethod.IsEditable = true; cmbSelectPaymentMethod.IsReadOnly = true; cmbSelectPaymentMethod.SelectedValuePath = "Id"; cmbSelectPaymentMethod.DisplayMemberPath = "PaymentMethodName"; } catch (Exception ex) { SystemError.Register(ex); } }
private void ChangeKOTAllItemStatus(object sender, RoutedEventArgs e) { try { KitchenViewModel kitchenViewModel = new KitchenViewModel(); var btnChangeStatus = sender as Button; string kotId = btnChangeStatus.Name.Substring(4); if (btnChangeStatus.Content.ToString() == "C") { kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Cooking); } else if (btnChangeStatus.Content.ToString() == "P") { kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Pending); } else if (btnChangeStatus.Content.ToString() == "D") { kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Completed); } GetKitchenPending(KitchenOrder); } catch (Exception ex) { SystemError.Register(ex); } }
private void FillDropdown() { try { ReportViewModel reportViewModel = new ReportViewModel(); List <ReportDropDownModel> reportDropDownModels = new List <ReportDropDownModel>(); reportDropDownModels = reportViewModel.GetDropdown("FoodmenuCategory"); cmbCategory.ItemsSource = reportDropDownModels; // cmbCategory.Text = " All"; cmbCategory.IsEditable = true; //cmbCategory.IsReadOnly = true; cmbCategory.SelectedValuePath = "Id"; cmbCategory.DisplayMemberPath = "Name"; reportDropDownModels = reportViewModel.GetDropdown("Foodmenu"); cmbProduct.ItemsSource = reportDropDownModels; // cmbProduct.Text = " All"; cmbProduct.IsEditable = true; //cmbProduct.IsReadOnly = true; cmbProduct.SelectedValuePath = "Id"; cmbProduct.DisplayMemberPath = "Name"; cmbCategory.SelectedValue = ReportDetail.CategoryId; cmbProduct.SelectedValue = ReportDetail.ProductId; } catch (Exception ex) { SystemError.Register(ex); } }
void TimerForKOTStatus_Tick(object sender, EventArgs e) { try { GetKitchenPending(KitchenOrder); } catch (Exception ex) { SystemError.Register(ex); } }
private void PerformTableOperation(object sender, MouseButtonEventArgs e) { try { TableViewModel tableViewModel = new TableViewModel(); var tableListPanel = sender as StackPanel; var txtbTableId = tableListPanel.Children[0] as TextBlock; var txtbTableName = tableListPanel.Children[1] as TextBlock; var txtbTableStatusId = tableListPanel.Children[3] as TextBlock; var txtbTableOrderId = tableListPanel.Children[6] as TextBlock; if ((txtbTableStatusId.Text) == EnumUtility.TableStatus.Clean.ToString()) { var messageBoxResult = WpfMessageBox.Show(StatusMessages.DineInTitle, StatusMessages.DineInTableIsClean, MessageBoxButton.YesNo, EnumUtility.MessageBoxImage.Question); if (messageBoxResult.ToString() == "Yes") { tableViewModel.UpdateTableStatus(txtbTableId.Text, (int)EnumUtility.TableStatus.Open); GetDineInTableList(); } } if ((txtbTableStatusId.Text) == EnumUtility.TableStatus.Open.ToString()) { DineTable.TableId = Convert.ToInt32(txtbTableId.Text); ((MainWindow)this.Owner).OrderCall(Convert.ToInt32(txtbTableId.Text), (int)EnumUtility.TableStatus.Open, Convert.ToInt32(txtbTableId.Text)); this.Close(); } if ((txtbTableStatusId.Text) == EnumUtility.TableStatus.Occupied.ToString()) { if (!string.IsNullOrEmpty(txtbTableOrderId.Text)) { DineTable.OrderId = Convert.ToInt32(txtbTableOrderId.Text); DineTable.TableId = Convert.ToInt32(txtbTableId.Text); if (DineTable.OrderId == 0) { //Froce Update Table Status tableViewModel.UpdateTableStatus(txtbTableId.Text, (int)EnumUtility.TableStatus.Clean); } else { ((MainWindow)this.Owner).OrderCall(Convert.ToInt32(txtbTableOrderId.Text), (int)EnumUtility.TableStatus.Occupied, Convert.ToInt32(txtbTableId.Text)); } this.Close(); } } } catch (Exception ex) { SystemError.Register(ex); } }
private void btnModeofPaymentReportExport_Click(object sender, RoutedEventArgs e) { try { if (!DateValidated(dpFromDatePayment, dpToDatePayment)) { var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "Please select FROM DATE grater than or equal to TO DATE", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); return; } CommonMethods commonMethods = new CommonMethods(); string path = string.Empty, firstLine = string.Empty; CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel(); List <ModeofPaymentReportModel> modeofPaymentReportModel = new List <ModeofPaymentReportModel>(); modeofPaymentReportModel = customerOrderViewModel.GetModOfPaymentReport(dpFromDatePayment.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDatePayment.SelectedDate.Value.ToString(CommonMethods.DateFormat)); string fileName = "ModeOfPaymentReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss"); var saveFileDialog = new SaveFileDialog { FileName = fileName != "" ? fileName : "gpmfca-exportedDocument", DefaultExt = ".xlsx", Filter = "Common Seprated Documents (.xlsx)|*.xlsx" }; if (saveFileDialog.ShowDialog() == true) { path = saveFileDialog.FileName; firstLine = LoginDetail.ClientName; DataTable dtData = new DataTable(); DataTable dtDataResult = new DataTable(); dtData = commonMethods.ConvertToDataTable(modeofPaymentReportModel); //X axis column: PaymentMethodName //Y axis column: BillDate //Z axis column: BillAmount //Null value: "-"; //Sum of values: true dtDataResult = commonMethods.GetInversedDataTable(dtData, "PaymentMethodName", "BillDate", "BillAmount", " ", true); commonMethods.WriteExcelModeOfPaymentFile(dtDataResult, path, firstLine); } } catch (Exception ex) { SystemError.Register(ex); } }
public DineInTables() { try { InitializeComponent(); CenterWindowOnScreen(); GetDineInTableList(); } catch (Exception ex) { SystemError.Register(ex); } }
private void TimerForKOTStatus(int kotTimerLimit) { try { timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(kotTimerLimit); timer.Tick += TimerForKOTStatus_Tick; timer.Start(); } catch (Exception ex) { SystemError.Register(ex); } }
private void btnStartSync_Click(object sender, RoutedEventArgs e) { try { txtOutput.Text = ""; UpdateStatus(DateTime.Now.ToString() + " Process Started " + "\n"); var thread = new Thread(LoadDevices); thread.Start(); return; } catch (Exception ex) { SystemError.Register(ex); } }
private void CenterWindowOnScreen() { try { double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; double windowWidth = this.Width; double windowHeight = this.Height; this.Left = (screenWidth / 2) - (windowWidth / 2); this.Top = ((screenHeight / 2) - (windowHeight / 2)); } catch (Exception ex) { SystemError.Register(ex); } }
public OutletRegisterReport() { InitializeComponent(); CommonMethods commonMethods = new CommonMethods(); OutletRegisterViewModel outletRegisterViewModel = new OutletRegisterViewModel(); AppSettings appSettings = new AppSettings(); try { string path = string.Empty, firstLine = string.Empty; string strUri = appSettings.GetWebAppUri(); strUri += "Report/OutletRegister?outletRegisterId=" + LoginDetail.OutletRegisterId; Uri uri = new Uri(strUri, UriKind.RelativeOrAbsolute); this.webBrowser.Navigate(uri); PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == true) { printDialog.PrintVisual(print, "OutletRegisterReport"); } //Download To Export User Register Report List <OutletUserRegister> outletUserRegister = new List <OutletUserRegister>(); outletUserRegister = outletRegisterViewModel.GetUserRegisterReport(); string fileName = "UserRegisterReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss"); var saveFileDialog = new SaveFileDialog { FileName = fileName != "" ? fileName : "gpmfca-exportedDocument", DefaultExt = ".xlsx", Filter = "Common Seprated Documents (.xlsx)|*.xlsx" }; if (saveFileDialog.ShowDialog() == true) { path = saveFileDialog.FileName; } firstLine = "Close Register for " + LoginDetail.Username + " at " + System.DateTime.Now; commonMethods.WriteExcelFile(commonMethods.ConvertToDataTable(outletUserRegister), path, firstLine); } catch (Exception ex) { SystemError.Register(ex); } }
private void btnRefreshAll_Click(object sender, RoutedEventArgs e) { try { _KotTimerLimit = Convert.ToInt32(txtTimer.Text); timer.Stop(); timer.Interval = TimeSpan.FromMinutes(_KotTimerLimit); timer.Start(); GetKitchenPending(KitchenOrder); } catch (Exception ex) { SystemError.Register(ex); } }
private void btnReceiptPrint_Click(object sender, RoutedEventArgs e) { try { var order = (CustomerOrderHistoryModel)dgOrderList.SelectedItem; if (string.IsNullOrEmpty(order.SalesInvoiceNumber)) { var messageBoxResult = WpfMessageBox.Show(StatusMessages.CustomerOrderHistory, StatusMessages.ReceiptNotReady, MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); return; } ReceiptPrintView printReceipt = new ReceiptPrintView(); AppSettings appSettings = new AppSettings(); printReceipt.Print(appSettings.GetPrinterName(), order.Id); } catch (Exception ex) { SystemError.Register(ex); } }
private void btnDetailedDailyExcel_Click(object sender, RoutedEventArgs e) { try { DateTime dtFrom = new DateTime(); DateTime dtTo = new DateTime(); dtFrom = (DateTime)dpDetailedDailyFromDate.Value; dtTo = (DateTime)dpDetailedDailyToDate.Value; List <DetailedDailyReportModel> detailedDailyReportModels = new List <DetailedDailyReportModel>(); ReportViewModel reportViewModel = new ReportViewModel(); detailedDailyReportModels = reportViewModel.GetDetailedDailyByDate(dtFrom.ToString("yyyy-MM-dd HH:mi:ss"), dtTo.ToString("yyyy-MM-dd HH:mi:ss")); CommonMethods commonMethods = new CommonMethods(); string path = string.Empty, firstLine = string.Empty; string fileName = "DetailedDailyReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss"); var saveFileDialog = new SaveFileDialog { FileName = fileName != "" ? fileName : "gpmfca-exportedDocument", DefaultExt = ".xlsx", Filter = "Common Seprated Documents (.xlsx)|*.xlsx" }; if (saveFileDialog.ShowDialog() == true) { path = saveFileDialog.FileName; DataTable table = new DataTable(); table = commonMethods.ConvertToDataTable(detailedDailyReportModels); firstLine = "Detailed Daily List for " + dtFrom.ToString("yyyy-MM-dd HH:mi:ss") + " to " + dtTo.ToString("yyyy-MM-dd HH:mi:ss"); commonMethods.WriteExcelDetailDailySalesFile(table, path, firstLine); } } catch (Exception ex) { SystemError.Register(ex); } }
private void btnReceiptA4Print_Click(object sender, RoutedEventArgs e) { try { var order = (CustomerOrderHistoryModel)dgOrderList.SelectedItem; ReportDetail.BillId = order.Id; this.Height = 2; ReceiptA4Print form = new ReceiptA4Print(); // form.Owner = this; // form.ShowDialog(); this.Height = 800; return; // var order = (CustomerOrderHistoryModel)dgOrderList.SelectedItem; //if (string.IsNullOrEmpty(order.SalesInvoiceNumber)) //{ // var messageBoxResult = WpfMessageBox.Show(StatusMessages.CustomerOrderHistory, StatusMessages.ReceiptNotReady, MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); // return; //} FlowDocument flowDocument; // flowDocument = PrintA4(order.Id); this.Height = 200; PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == true) { flowDocument.PageHeight = 1200; // printDialog.PrintableAreaHeight; flowDocument.PageWidth = 800; // printDialog.PrintableAreaWidth; IDocumentPaginatorSource idocument = flowDocument as IDocumentPaginatorSource; printDialog.PrintDocument(idocument.DocumentPaginator, "Printing ..."); } this.Height = 800; } catch (Exception ex) { SystemError.Register(ex); } }
public Login() { try { InitializeComponent(); if (!Appcheck()) { var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "Opps, Somthing went wrong.", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); App.Current.Shutdown(); } else { CenterWindowOnScreen(); } } catch (Exception ex) { SystemError.Register(ex); } }
private void btnPPPaymentMethodApply_Click(object sender, RoutedEventArgs e) { try { CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel(); var order = (CustomerOrderHistoryModel)dgOrderList.SelectedItem; if (cmbSelectPaymentMethod.SelectedIndex == -1) { var messageBoxResult = WpfMessageBox.Show(StatusMessages.CustomerOrderHistory, StatusMessages.PaymentMethodSelect, MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); cmbSelectPaymentMethod.Focus(); return; } customerOrderViewModel.UpdateBillDetailPaymentMethod(order.Id.ToString(), Convert.ToInt32(cmbSelectPaymentMethod.SelectedValue)); ppChangePaymentMethod.IsOpen = false; btnSearchOrderList_Click(null, null); } catch (Exception ex) { SystemError.Register(ex); } }
private void btnProductWiseReport_Click(object sender, RoutedEventArgs e) { try { ProductWiseSalesReportModel detailedDailyReportModel = new ProductWiseSalesReportModel(); AppSettings appSettings = new AppSettings(); ReportProductWiseSalesView reportProductWiseSalesView = new ReportProductWiseSalesView(); DateTime dtFrom = new DateTime(); DateTime dtTo = new DateTime(); dtFrom = (DateTime)dpProductwiseFromDate.Value; dtTo = (DateTime)dpProductWiseToDate.Value; reportProductWiseSalesView.Print(appSettings.GetPrinterName(), dtFrom.ToString("yyyy-MM-dd HH:mi:ss"), dtTo.ToString("yyyy-MM-dd HH:mi:ss")); } catch (Exception ex) { SystemError.Register(ex); } }
private void DeSelectAllKotItem(object sender, RoutedEventArgs e) { try { var btnDeSelectAll = sender as ToggleButton; var kotButtonPanel = (WrapPanel)btnDeSelectAll.Parent; var btnCooking = kotButtonPanel.Children[1] as Button; var btnPending = kotButtonPanel.Children[2] as Button; var btnCompleted = kotButtonPanel.Children[3] as Button; btnDeSelectAll.Content = "Select All"; btnDeSelectAll.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF5733")); btnCooking.Visibility = Visibility.Hidden; btnPending.Visibility = Visibility.Hidden; btnCompleted.Visibility = Visibility.Hidden; } catch (Exception ex) { SystemError.Register(ex); } }
private void btnSalesExcelExport_Click(object sender, RoutedEventArgs e) { try { CommonMethods commonMethods = new CommonMethods(); string path = string.Empty, firstLine = string.Empty; List <CustomerOrderHistoryModel> customerOrderHistoryModel = new List <CustomerOrderHistoryModel>(); customerOrderHistoryModel = (List <CustomerOrderHistoryModel>)dgOrderList.ItemsSource; string fileName = "SalesReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss"); var saveFileDialog = new SaveFileDialog { FileName = fileName != "" ? fileName : "gpmfca-exportedDocument", DefaultExt = ".xlsx", Filter = "Common Seprated Documents (.xlsx)|*.xlsx" }; if (saveFileDialog.ShowDialog() == true) { path = saveFileDialog.FileName; DataTable table = new DataTable(); table = commonMethods.ConvertToDataTable(customerOrderHistoryModel); table.Columns.Remove("Id"); table.Columns.Remove("InvoiceTotal"); table.Columns.Remove("InvoiceCount"); firstLine = "Sale List for " + dpFromDate.SelectedDate.Value.ToString(CommonMethods.DateFormat) + " to " + dpToDate.SelectedDate.Value.ToString(CommonMethods.DateFormat); commonMethods.WriteExcelFile(table, path, firstLine); } } catch (Exception ex) { SystemError.Register(ex); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { try { loginModel = loginViewModel.GetUserLogin(txtUsername.Text, txtPassword.Password); if (loginModel.Count > 0) { LoginMerge(loginModel); loginViewModel.UpdateLoginLogout("login"); loginViewModel.LoginHistory(1); if (loginModel[0].RoleTypeId == 5) { KitchenView kitchenView = new KitchenView(); kitchenView.Show(); } else { MainWindow mainWin = new MainWindow(); mainWin.Show(); } this.Hide(); //if (loginModel[0].OutletRegisterStatus == 1) //{ // DateTime dt = new DateTime(); // string v = DateTime.Now.ToShortDateString(); // dt = DateTime.Parse(v); // int result = DateTime.Compare(loginModel[0].SystemDate, dt); // if (result < 0) // { // var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "You are running with past date,please close your register and start new register with current date", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Error); // } // //loginViewModel.UpdateLoginLogout("login"); // //loginViewModel.LoginHistory(1); // //MainWindow mainWin = new MainWindow(); // //mainWin.Show(); // //this.Hide(); //} //else //{ // var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "Please contact admin to open your register.", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); //} } else { var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "Wrong UserName/PassWord", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); ResetControl(); } } catch (Exception ex) { SystemError.Register(ex); } }
private void btnCessReportExport_Click(object sender, RoutedEventArgs e) { int categoryId = -1, foodMenuId = -1; try { if (!DateValidated(dpFromDate, dpToDate)) { var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "Please select FROM DATE grater than or equal to TO DATE", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning); return; } CommonMethods commonMethods = new CommonMethods(); string path = string.Empty, firstLine = string.Empty; CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel(); CessReportModel cessReportModel = new CessReportModel(); CessCategoryReportModel cessCategoryReportModel = new CessCategoryReportModel(); if (chkCess.IsChecked == false) { cessReportModel = customerOrderViewModel.GetCessReport(dpFromDate.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDate.SelectedDate.Value.ToString(CommonMethods.DateFormat)); string fileName = "CessReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss"); var saveFileDialog = new SaveFileDialog { FileName = fileName != "" ? fileName : "gpmfca-exportedDocument", DefaultExt = ".xlsx", Filter = "Common Seprated Documents (.xlsx)|*.xlsx" }; if (saveFileDialog.ShowDialog() == true) { path = saveFileDialog.FileName; firstLine = LoginDetail.ClientName; commonMethods.WriteCessExcelFile(commonMethods.ConvertToDataTable(cessReportModel.CessSummaryList), commonMethods.ConvertToDataTable(cessReportModel.CessDetailList), path, firstLine); } } else { cessCategoryReportModel = customerOrderViewModel.GetCessCategoryReport(dpFromDate.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDate.SelectedDate.Value.ToString(CommonMethods.DateFormat), categoryId, foodMenuId); string fileName = "CategoryWiseCessReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss"); var saveFileDialog = new SaveFileDialog { FileName = fileName != "" ? fileName : "gpmfca-exportedDocument", DefaultExt = ".xlsx", Filter = "Common Seprated Documents (.xlsx)|*.xlsx" }; if (saveFileDialog.ShowDialog() == true) { path = saveFileDialog.FileName; firstLine = LoginDetail.ClientName; commonMethods.WriteCessCategoryExcelFile(commonMethods.ConvertToDataTable(cessCategoryReportModel.CessSummaryList), commonMethods.ConvertToDataTable(cessCategoryReportModel.CessDetailList), path, firstLine); } } } catch (Exception ex) { SystemError.Register(ex); } }
private void GetDineInTableList() { try { wpTableView.Children.Clear(); AppSettings appSettings = new AppSettings(); string rootPath = string.Empty; rootPath = appSettings.GetAppPath(); TableViewModel tableViewModel = new TableViewModel(); tablesList = tableViewModel.GetTables(LoginDetail.OutletId); if (tablesList.Count > 0) { foreach (var table in tablesList) { Image imgTableStatus = new Image(); SolidColorBrush solidColorBrush = new SolidColorBrush(); if (Convert.ToInt32(table.Status) == (int)EnumUtility.TableStatus.Clean) { imgTableStatus.Source = new BitmapImage(new System.Uri(rootPath + @"\Images\Clean.jpg")); solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#cf2e0e")); } else if (Convert.ToInt32(table.Status) == (int)EnumUtility.TableStatus.Occupied) { imgTableStatus.Source = new BitmapImage(new System.Uri(rootPath + @"\Images\Occupied.jpg")); solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#dce309")); } else { imgTableStatus.Source = new BitmapImage(new System.Uri(rootPath + @"\Images\Pending.jpg")); solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#32a836")); } StackPanel tableListPanel = new StackPanel(); tableListPanel.Orientation = Orientation.Vertical; tableListPanel.VerticalAlignment = VerticalAlignment.Top; tableListPanel.Width = 140; tableListPanel.Height = 165; tableListPanel.Background = solidColorBrush; tableListPanel.Margin = new Thickness(1); //Table Id TextBlock txtbTableId = new TextBlock(); txtbTableId.Text = table.Id.ToString(); txtbTableId.Name = "txtbTableId_" + table.Id; txtbTableId.FontSize = 5; txtbTableId.Visibility = Visibility.Hidden; tableListPanel.Children.Add(txtbTableId); //Table Name TextBlock txtbTableName = new TextBlock(); txtbTableName.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000")); txtbTableName.Text = "#" + table.TableName; txtbTableName.FontSize = 16; txtbTableName.FontWeight = FontWeights.Bold; txtbTableName.Name = "txtbTableName" + table.Id; txtbTableName.Margin = new Thickness(2); tableListPanel.Children.Add(txtbTableName); //Table Image imgTableStatus.Width = 75; imgTableStatus.Height = 75; imgTableStatus.Margin = new Thickness(2); imgTableStatus.Stretch = Stretch.UniformToFill; imgTableStatus.Name = "imgTableStatus" + table.Status; tableListPanel.Children.Add(imgTableStatus); //Table Status TextBlock txtbTableStatus = new TextBlock(); txtbTableStatus.Text = table.StatusDescription; txtbTableStatus.Name = "txtbTableStatus" + table.Status; txtbTableStatus.FontSize = 18; txtbTableStatus.FontWeight = FontWeights.Bold; txtbTableStatus.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000")); txtbTableStatus.Margin = new Thickness(2); tableListPanel.Children.Add(txtbTableStatus); //Table Capacity TextBlock txtbTableCapacity = new TextBlock(); txtbTableCapacity.Text = "Capacity : " + table.AllocatedPerson.ToString() + "/" + table.PersonCapacity.ToString(); txtbTableCapacity.Name = "txtbTableCapacity" + table.Id; txtbTableCapacity.FontSize = 16; txtbTableCapacity.FontWeight = FontWeights.Bold; txtbTableCapacity.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000")); txtbTableCapacity.Margin = new Thickness(2); tableListPanel.Children.Add(txtbTableCapacity); //Table Status Id TextBlock txtbTableStatusId = new TextBlock(); txtbTableStatusId.Text = table.Status; txtbTableStatusId.Visibility = Visibility.Hidden; tableListPanel.Children.Add(txtbTableStatusId); //Table Order Id TextBlock txtbTableOrderId = new TextBlock(); txtbTableOrderId.Text = table.OrderId.ToString(); txtbTableOrderId.Visibility = Visibility.Hidden; tableListPanel.Children.Add(txtbTableOrderId); tableListPanel.Name = "tableListPanel" + table.Id.ToString(); tableListPanel.MouseDown += PerformTableOperation; //Add to panel wpTableView.Children.Add(tableListPanel); } } } catch (Exception ex) { SystemError.Register(ex); } }
private void ChangeKOTStatus(object sender, MouseButtonEventArgs e) { try { SolidColorBrush solidColorBrush = new SolidColorBrush(); KitchenViewModel kitchenViewModel = new KitchenViewModel(); var kotDetailPanel = sender as WrapPanel; var txtfoodmenuName = kotDetailPanel.Children[0] as TextBlock; var txtQty = kotDetailPanel.Children[1] as TextBlock; var txtbKOTItemId = kotDetailPanel.Children[2] as TextBlock; var txtbKOTId = kotDetailPanel.Children[3] as TextBlock; var txtbKOTStatus = kotDetailPanel.Children[4] as TextBlock; var txtOrderTable = kotDetailPanel.Children[5] as TextBlock; int status = 0; ppStatus.StaysOpen = true; ppStatus.IsOpen = true; txtppTableNumber.Text = txtOrderTable.Text; txtppFoodmenuName.Text = txtfoodmenuName.Text; txtppQty.Text = txtQty.Text; txtbKOTItemIdHidden.Text = txtbKOTItemId.Text; txtbKOTIdHidden.Text = txtbKOTId.Text; if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Completed.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ffffff")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Pending.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ff726f")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Cooking.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#fbff99")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Ready.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#5cff7e")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Served.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ccd9ff")); } grItem.Background = solidColorBrush; e.Handled = true; return; if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Pending.ToString()) { status = (int)EnumUtility.KOTStatus.Cooking; } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Cooking.ToString()) { status = (int)EnumUtility.KOTStatus.Ready; } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Ready.ToString()) { status = (int)EnumUtility.KOTStatus.Served; } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Served.ToString()) { status = (int)EnumUtility.KOTStatus.Completed; } if (status != 0) { kitchenViewModel.ChangeKOTStatus(txtbKOTItemId.Text, txtbKOTId.Text, status); GetKitchenPending(KitchenOrder); } } catch (Exception ex) { SystemError.Register(ex); } }
private void GetKitchenPending(List <int> KitchenOrder) { KitchenViewModel kitchenViewModel = new KitchenViewModel(); List <KitchenModel> kitchenModel = new List <KitchenModel>(); kitchenModel = kitchenViewModel.GetKitchenStaus(KitchenOrder); try { wpKitchenView.Children.Clear(); if (kitchenModel.Count > 0) { foreach (var item in kitchenModel) { WrapPanel wpKOT = new WrapPanel(); wpKOT.Orientation = Orientation.Vertical; wpKOT.VerticalAlignment = VerticalAlignment.Top; wpKOT.Width = 212; wpKOT.Height = 325; wpKOT.Margin = new Thickness(1); SolidColorBrush solidColorBrush = new SolidColorBrush(); solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#E8E8E8")); WrapPanel kotHeaderPanel = new WrapPanel(); kotHeaderPanel.Orientation = Orientation.Horizontal; kotHeaderPanel.VerticalAlignment = VerticalAlignment.Top; kotHeaderPanel.Width = 211; kotHeaderPanel.Height = 325; kotHeaderPanel.Background = solidColorBrush; kotHeaderPanel.Margin = new Thickness(1); ////Order Id TextBlock txtbOrderId = new TextBlock(); txtbOrderId.Text = "Order# " + item.CustomerOrderId.ToString(); txtbOrderId.Name = "txtbOrderId_" + item.CustomerOrderId.ToString(); txtbOrderId.FontSize = 1; txtbOrderId.Width = 0; txtbOrderId.Visibility = Visibility.Hidden; txtbOrderId.TextAlignment = TextAlignment.Left; kotHeaderPanel.Children.Add(txtbOrderId); //Table Name TextBlock txtbTableName = new TextBlock(); string strPerson = ""; if (item.AllocatedPerson > 0) { strPerson = " [" + item.AllocatedPerson + "] " + item.WaiterName; } txtbTableName.Text = "TABLE #" + item.TableName + strPerson; txtbTableName.Name = "txtbTableName_" + item.TableId; txtbTableName.FontSize = 18; txtbTableName.FontWeight = FontWeights.Bold; //txtbTableName.Width = 146; //if (item.CustomerOrderId == 0) //{ txtbTableName.Width = 211; //} txtbTableName.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000")); txtbTableName.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFFFF")); txtbTableName.TextAlignment = TextAlignment.Left; kotHeaderPanel.Children.Add(txtbTableName); if (item.CustomerOrderId != 0) { ToggleButton btnAllKOT = new ToggleButton(); btnAllKOT.Content = "..."; btnAllKOT.Name = "btnAllKOT_" + item.TableId; btnAllKOT.FontSize = 16; btnAllKOT.FontWeight = FontWeights.Bold; btnAllKOT.Width = 45; btnAllKOT.Height = 27; btnAllKOT.BorderThickness = new Thickness(0); btnAllKOT.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000")); btnAllKOT.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnAllKOT.Margin = new Thickness(0, 0, 0, 0); btnAllKOT.Checked += DisplayAllKotItem; btnAllKOT.Unchecked += DisplayCurrentKotItem; for (var i = 0; i < KitchenOrder.Count; i++) { if (KitchenOrder[i] == item.TableId) { btnAllKOT.IsChecked = true; } } // kotHeaderPanel.Children.Add(btnAllKOT); } //Waiter Name //TextBlock txtWaiterName = new TextBlock(); //txtWaiterName.Text = "Richard ";// + item.TableName + strPerson; //txtWaiterName.Name = "txtbTableName_" + item.AllocatedPerson; //txtWaiterName.FontSize = 18; //txtWaiterName.FontWeight = FontWeights.Bold; //txtbTableName.Width = 211; //txtWaiterName.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000")); //txtWaiterName.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFFFF")); //txtWaiterName.TextAlignment = TextAlignment.Left; //kotHeaderPanel.Children.Add(txtWaiterName); if (item.kotStatusList.Count > 0) { foreach (var kotItem in item.kotStatusList) { if (kotItem.KOTStatus == EnumUtility.KOTStatus.Completed.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ffffff")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Pending.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ff726f")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Cooking.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#fbff99")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Ready.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#5cff7e")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Served.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ccd9ff")); } WrapPanel kotDetailPanel = new WrapPanel(); kotDetailPanel.Orientation = Orientation.Horizontal; kotDetailPanel.VerticalAlignment = VerticalAlignment.Top; kotDetailPanel.Width = 226; kotDetailPanel.Background = solidColorBrush; kotDetailPanel.Margin = new Thickness(1); kotDetailPanel.MouseDown += ChangeKOTStatus; //Food Menu Name TextBlock txtbFoodMenuName = new TextBlock(); txtbFoodMenuName.Text = kotItem.FoodMenuName; txtbFoodMenuName.Name = "txtbFoodMenuName_" + kotItem.KOTItemId; txtbFoodMenuName.FontSize = 16; txtbFoodMenuName.Width = 225; txtbFoodMenuName.HorizontalAlignment = HorizontalAlignment.Left; kotDetailPanel.Children.Add(txtbFoodMenuName); //Food Menu Qty TextBlock txtbFoodMenuQty = new TextBlock(); txtbFoodMenuQty.Text = "Qty: " + kotItem.FoodMenuQty.ToString(); txtbFoodMenuQty.Name = "txtbFoodMenuQty_" + kotItem.KOTItemId; txtbFoodMenuQty.FontSize = 16; txtbFoodMenuQty.Width = 70; txtbFoodMenuQty.TextAlignment = TextAlignment.Left; kotDetailPanel.Children.Add(txtbFoodMenuQty); //KOT Item Id TextBlock txtbKOTItemId = new TextBlock(); txtbKOTItemId.Text = kotItem.KOTItemId.ToString(); txtbKOTItemId.Name = "txtbKOTItemId_" + kotItem.KOTItemId; txtbKOTItemId.Visibility = Visibility.Hidden; txtbKOTItemId.Width = 5; kotDetailPanel.Children.Add(txtbKOTItemId); //KOT Id TextBlock txtbKOTId = new TextBlock(); txtbKOTId.Text = kotItem.KOTId.ToString(); txtbKOTId.Name = "txtbKOTId_" + kotItem.KOTId; txtbKOTId.Visibility = Visibility.Hidden; txtbKOTId.Width = 5; kotDetailPanel.Children.Add(txtbKOTId); //KOT Status TextBlock txtbKOTStatus = new TextBlock(); txtbKOTStatus.Text = kotItem.KOTStatus.ToString(); txtbKOTStatus.Name = "txtbKOTStatus_" + kotItem.KOTItemId.ToString(); txtbKOTStatus.FontSize = 1; txtbKOTStatus.Width = 2; txtbKOTStatus.TextAlignment = TextAlignment.Right; kotDetailPanel.Children.Add(txtbKOTStatus); //Table Name as hidden attribute TextBlock txtbTableNameHidden = new TextBlock(); strPerson = ""; if (item.AllocatedPerson > 0) { strPerson = " [ " + item.AllocatedPerson + " ]"; } txtbTableNameHidden.Text = "TABLE #" + item.TableName + strPerson; txtbTableNameHidden.Name = "txtbTableName_" + item.TableId; txtbTableNameHidden.FontSize = 1; txtbTableNameHidden.Width = 1; kotDetailPanel.Children.Add(txtbTableNameHidden); kotHeaderPanel.Children.Add(kotDetailPanel); } //scrollbar if (item.kotStatusList.Count <= 6) { kotHeaderPanel.Height = 325; wpKOT.Children.Clear(); wpKOT.Children.Add(kotHeaderPanel); } else { kotHeaderPanel.Height = 50 * item.kotStatusList.Count; ScrollViewer sv = new ScrollViewer(); sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; sv.Height = 325; sv.Content = kotHeaderPanel; wpKOT.Children.Clear(); wpKOT.Children.Add(sv); } } else { wpKOT.Children.Clear(); wpKOT.Children.Add(kotHeaderPanel); } if (item.kotStatusList.Count > 0) { WrapPanel kotButtonPanel = new WrapPanel(); kotButtonPanel.Orientation = Orientation.Horizontal; kotButtonPanel.VerticalAlignment = VerticalAlignment.Top; kotButtonPanel.Width = 220; kotButtonPanel.Margin = new Thickness(1); ToggleButton btnSelectAll = new ToggleButton(); btnSelectAll.Content = "Select All"; btnSelectAll.Name = "btnSelectAll"; btnSelectAll.FontSize = 16; btnSelectAll.FontWeight = FontWeights.Bold; btnSelectAll.Width = 90; btnSelectAll.Height = 40; btnSelectAll.BorderThickness = new Thickness(1); btnSelectAll.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnSelectAll.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnSelectAll.Margin = new Thickness(0, 0, 0, 0); btnSelectAll.Checked += SelectAllKotItem; btnSelectAll.Unchecked += DeSelectAllKotItem; kotButtonPanel.Children.Add(btnSelectAll); //Cooking Button Button btnCooking = new Button(); btnCooking.Content = "C"; btnCooking.Name = "btnC" + item.CustomerOrderId.ToString(); btnCooking.FontSize = 16; btnCooking.FontWeight = FontWeights.Bold; btnCooking.Width = 40; btnCooking.Height = 40; btnCooking.BorderThickness = new Thickness(1); btnCooking.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnCooking.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnCooking.Margin = new Thickness(0, 0, 0, 0); btnCooking.Visibility = Visibility.Hidden; btnCooking.Click += ChangeKOTAllItemStatus; kotButtonPanel.Children.Add(btnCooking); //Pending Button Button btnPending = new Button(); btnPending.Content = "P"; btnPending.Name = "btnP" + item.CustomerOrderId.ToString(); btnPending.FontSize = 16; btnPending.FontWeight = FontWeights.Bold; btnPending.Width = 40; btnPending.Height = 40; btnPending.BorderThickness = new Thickness(1); btnPending.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnPending.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnPending.Margin = new Thickness(0, 0, 0, 0); btnPending.Visibility = Visibility.Hidden; btnPending.Click += ChangeKOTAllItemStatus; kotButtonPanel.Children.Add(btnPending); //Completed Button Button btnCompleted = new Button(); btnCompleted.Content = "D"; btnCompleted.Name = "btnD" + item.CustomerOrderId.ToString(); btnCompleted.FontSize = 16; btnCompleted.FontWeight = FontWeights.Bold; btnCompleted.Width = 40; btnCompleted.Height = 40; btnCompleted.BorderThickness = new Thickness(1); btnCompleted.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnCompleted.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnCompleted.Margin = new Thickness(0, 0, 0, 0); btnCompleted.Visibility = Visibility.Hidden; btnCompleted.Click += ChangeKOTAllItemStatus; kotButtonPanel.Children.Add(btnCompleted); wpKOT.Children.Add(kotButtonPanel); } wpKitchenView.Children.Add(wpKOT); } } } catch (Exception ex) { SystemError.Register(ex); } }