private async void SOProdGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { Microsoft.Toolkit.Uwp.UI.Controls.DataGrid pGrid = (Microsoft.Toolkit.Uwp.UI.Controls.DataGrid)sender; MBSOMaint mbsom = (MBSOMaint)pGrid.SelectedItem; if (!(mbsom is null)) { SOMaintProdSource.Clear(); var data = await MySQLDataService.GetSOMaintProdGridDataAsync(mbsom.SOId); foreach (var item in data) { SOMaintProdSource.Add(item); } //ContentDialog confirmStatusChange = new ContentDialog //{ // Title = "Selection Changed", // Content = mbsom.ToString(), // CloseButtonText = "Ok" //}; //ContentDialogResult result = await confirmStatusChange.ShowAsync(); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { try { base.OnNavigatedTo(e); SalesSource.Clear(); // TODO WTS: Replace this with your actual data var data = await MySQLDataService.GetGridDataAsync(); foreach (var item in data) { SalesSource.Add(item); } dg_SortSales(SalesGrid, new DataGridColumnEventArgs(SalesGrid.Columns[1])); } catch (Exception eSales) { ContentDialog SalesDBException = new ContentDialog { Title = "Sales - Database Exception", Content = "Exception Message: " + eSales.Message + Environment.NewLine + "InnerException Message: " + eSales.InnerException.Message, CloseButtonText = "Ok" }; ContentDialogResult result = await SalesDBException.ShowAsync(); } }
protected async void LoadSOMaintSource(string status) { SOMaintSource.Clear(); var data = await MySQLDataService.GetSOMaintGridDataAsync(status); foreach (var item in data) { SOMaintSource.Add(item); } }
private async void Popup2_Opened(object sender, object e) { ProdSource.Clear(); // TODO WTS: Replace this with your actual data var data = await MySQLDataService.GetProdGridDataAsync(); foreach (var item in data) { ProdSource.Add(item); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); SalesSource.Clear(); // TODO WTS: Replace this with your actual data var data = await MySQLDataService.GetGridDataAsync(); foreach (var item in data) { SalesSource.Add(item); } }
private async void radioButton_Clicked(object sender, object e) { var clicked = (RadioButton)sender; string selected = ""; string status = ""; if (clicked.Name.Contains("Open")) { selected = "Open"; } else if (clicked.Name.Contains("Closed")) { selected = "Closed"; } else { selected = "Cancelled"; } ContentDialog confirmStatusChange = new ContentDialog { Title = "Change Special Order Status", Content = "Are you sure you want to change the status to " + selected + "?", PrimaryButtonText = "Yes", CloseButtonText = "No" }; ContentDialogResult result = await confirmStatusChange.ShowAsync(); if (result == ContentDialogResult.Primary) { MySQLDataService.updateSOStatus(selected, selectedSOId); } puUpdateStatus.IsOpen = false; selectedSOId = -1; SOMaintProdSource.Clear(); status = ((SOStatus)cbStatus.SelectedItem).Name; LoadSOMaintSource(status); }
private async void MenuFlyoutItem_Delete(object sender, RoutedEventArgs e) { var row = (sender as FrameworkElement).DataContext as MBSales; //ContentDialog mbSalesDialog = new ContentDialog //{ // Title = "MBSales_Delete", // Content = row.ToString(), // CloseButtonText = "Ok" //}; //ContentDialogResult result = await mbSalesDialog.ShowAsync(); ContentDialog deleteSalesRowDialog = new ContentDialog { Title = "Delete row permanently?", Content = "Are you sure you want to delete this row from the database?" + Environment.NewLine + row.ToString(), PrimaryButtonText = "Delete", CloseButtonText = "Cancel" }; ContentDialogResult result = await deleteSalesRowDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { MySQLDataService.deleteSales(row.SalesId); SalesSource.Clear(); tbSalesAmount.Text = "0.00"; tbNotes.Text = ""; var data = await MySQLDataService.GetGridDataAsync(); foreach (var item in data) { SalesSource.Add(item); } } }
private async void Popup1_Opened(object sender, object e) { CustSource.Clear(); // TODO WTS: Replace this with your actual data var data = await MySQLDataService.GetCustGridDataAsync(); foreach (var item in data) { CustSource.Add(item); } //ContentDialog mbPopupOpenDialog = new ContentDialog //{ // Title = "Popup Opened Event", // Content = sender.ToString(), // CloseButtonText = "Ok" //}; //ContentDialogResult result = await mbPopupOpenDialog.ShowAsync(); }
private async void btnSubmit_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { //ContentDialog noWifiDialog = new ContentDialog //{ // Title = "No wifi connection", // Content = "Check your connection and try again.", // CloseButtonText = "Ok" //}; //ContentDialogResult result = await noWifiDialog.ShowAsync(); try { MBSales mbs = new MBSales(); if (dpSalesDate.SelectedDate.HasValue) { DateTimeOffset dto = dpSalesDate.SelectedDate.Value; mbs.SalesDate = dto.DateTime; } mbs.SalesAmt = Double.Parse(tbSalesAmount.Text); mbs.SalesNotes = tbNotes.Text; mbs.User = "******"; //ContentDialog mbSalesDialog = new ContentDialog //{ // Title = "MBSales", // Content = mbs.ToString(), // CloseButtonText = "Ok" //}; //ContentDialogResult result3 = await mbSalesDialog.ShowAsync(); MySQLDataService.insertSales(mbs); SalesSource.Clear(); tbSalesAmount.Text = "0.00"; tbNotes.Text = ""; btnSubmit.IsEnabled = false; var data = await MySQLDataService.GetGridDataAsync(); foreach (var item in data) { SalesSource.Add(item); } SalesGrid.Columns[1].SortDirection = DataGridSortDirection.Ascending; dg_SortSales(SalesGrid, new DataGridColumnEventArgs(SalesGrid.Columns[1])); } catch (Exception ex) { ContentDialog insertExceptionDialog = new ContentDialog { Title = "Error inserting row in Sales table", Content = ex.Message, CloseButtonText = "Ok" }; ContentDialogResult result2 = await insertExceptionDialog.ShowAsync(); } }
private async void bSubmit_Click(object sender, RoutedEventArgs e) { MBCustomer newCust = new MBCustomer(); int insertCustId = -1; List <int> insertProdIds = new List <int>(); //List<MBProduct> prodInsertList = new List<MBProduct>(); int insertSOId = -1; string fName = tbFName.Text; string lName = tbLName.Text; int itemCount = SOProdSource.Count; try { using (TransactionScope scope = new TransactionScope()) { if ((string.IsNullOrEmpty(tbFName.Text) && string.IsNullOrEmpty(tbLName.Text))) { throw new TransactionAbortedException("Customer must include a first or last name."); } if (SOProdSource.Count < 1) { throw new TransactionAbortedException("Special Order must have selected items."); } if (!isLookupCustomer) { newCust.CustFName = tbFName.Text; newCust.CustMI = tbMI.Text; newCust.CustLName = tbLName.Text; newCust.CustSuffix = ((Suffix)cbSuffix.SelectedItem).Name; newCust.CustAddress1 = tbAddr1.Text; newCust.CustAddress2 = tbAddr2.Text; newCust.CustCity = tbCity.Text; newCust.CustState = ((States)cbStates.SelectedItem).ID; newCust.CustZip = tbZip.Text; newCust.CustEmail1 = tbEmail1.Text; newCust.CustEmail2 = tbEmail2.Text; newCust.CustPhone1 = tbPhone1.Text; newCust.CustPhone2 = tbPhone2.Text; newCust.CustTextNum = ""; insertCustId = MySQLDataService.insertCustomer(newCust); } else { insertCustId = lookedupCustId; } MBSpecialOrder mbso = new MBSpecialOrder(); mbso.SODate = DateTime.Now; mbso.SOStatus = "Open"; mbso.SOCloseDate = new DateTime(); mbso.Customer_CustId = insertCustId; insertSOId = MySQLDataService.insertSpecialOrder(mbso); foreach (MBProduct prod in SOProdSource) { if (prod.ProdId == -1) { int pid = MySQLDataService.insertProduct(prod); insertProdIds.Add(pid); } else { insertProdIds.Add(prod.ProdId); } } foreach (int prodid in insertProdIds) { MBSpecialOrderLookup mbsol = new MBSpecialOrderLookup(); mbsol.Product_ProdId = prodid; mbsol.SpecialOrder_SOId = insertSOId; MySQLDataService.insertSOL(mbsol); } resetCustomer(); resetProduct(); SOProdSource.Clear(); scope.Complete(); ContentDialog mbTransSuccessDialog = new ContentDialog { Title = "Special Order Created!", Content = "Special Order for customer " + fName + " " + lName + " of " + itemCount + " items created successfully!", CloseButtonText = "Ok" }; ContentDialogResult result = await mbTransSuccessDialog.ShowAsync(); } } catch (TransactionAbortedException tbe) { ContentDialog mbTransAbortedDialog = new ContentDialog { Title = "Create Special Order Unsuccessful", Content = "TransactionAbortedException thrown on insert of Special Order. " + Environment.NewLine + tbe.Message, CloseButtonText = "Ok" }; ContentDialogResult result = await mbTransAbortedDialog.ShowAsync(); } catch (Exception exc) { ContentDialog mbExceptionDialog = new ContentDialog { Title = "Create Special Order Failed", Content = "Exception thrown on insert of Special Order. " + Environment.NewLine + exc.Message, CloseButtonText = "Ok" }; ContentDialogResult result = await mbExceptionDialog.ShowAsync(); } }