void ShowAssertionDialog(string message, string detailMessage, string stackTrace, bool canDebug) { message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace; List <string> buttonTexts = new List <string> { "Show Stacktrace", "Debug", "Ignore", "Ignore All" }; if (!canDebug) { buttonTexts.RemoveAt(1); } CustomDialog inputBox = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts.ToArray()); try { while (true) // show the dialog repeatedly until an option other than 'Show Stacktrace' is selected { if (SD.MainThread.InvokeRequired) { inputBox.ShowDialog(); } else { inputBox.ShowDialog(SD.WinForms.MainWin32Window); } int result = inputBox.Result; if (!canDebug && result >= 1) { result++; } switch (result) { case 0: ExceptionBox.ShowErrorBox(null, message); break; // show the custom dialog again case 1: Debugger.Break(); return; case 2: return; case 3: lock (ignoredStacks) { ignoredStacks.Add(stackTrace); } return; } } } finally { dialogIsOpen.Reset(); inputBox.Dispose(); } }
public static async Task <MessageBoxResult> Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options) { if (caption == null) { throw new ArgumentNullException(nameof(caption)); } if (messageBoxText == null) { throw new ArgumentNullException(nameof(messageBoxText)); } // Button Strings var buttons = Buttons[button]; // Show Message Window var win = new CustomDialog(caption, messageBoxText, AcceptButtonID[button], CancelButtonID[button], buttons); var btnIndex = await win.ShowDialog <int?>(owner ?? App.Current.GetMainWindow()); if (btnIndex != null && Enum.TryParse(buttons[btnIndex.Value], out MessageBoxResult result)) { return(result); } return(defaultResult); }
private void StorageRentingDataGridView_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == 8) { _storageRentingId = Convert.ToInt32(StorageRentingDataGridView.Rows[e.RowIndex].Cells["id_renting_storage"].Value); _selectStoregeRentingStatus = StorageRentingDataGridView.Rows[e.RowIndex].Cells["renting_status"].Value.ToString(); if (_selectStoregeRentingStatus == "plaćeno") { CustomMessageBox.ShowDialog(this, $"Ova faktura za lagerovanje je vec placena!"); return; } DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da ste platili fakturu za lagerovanje?"); if (_selectStoregeRentingStatus == "plaćeno") { return; } MySqlCommand mySqlCommand = new MySqlCommand { CommandText = "UPDATE `renting_storage` SET `renting_status`='1' WHERE id_renting_storage=@id" }; mySqlCommand.Parameters.AddWithValue("@id", _storageRentingId); DbConnection.executeQuery(mySqlCommand); DbConnection.fillDGV(StorageRentingDataGridView, _fillDGVQuery); } }
private void finishInsertBtn_Click(object sender, EventArgs e) { int broj = 0; DialogResult result = CustomDialog.ShowDialog(this, "Da li ste sigurni da ste završili sa ubacivanjem artikala u komoru ?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } foreach (DataGridViewRow row in outStorageDataGridView.Rows) { int idPallete = Convert.ToInt32(row.Cells["id_pallet"].Value); broj = idPallete; int numberPallete = Convert.ToInt32(row.Cells["pallet_number"].Value); Pallete item = new Pallete(idPallete, numberPallete); palletes.Add(item); } DbConnection.palleting(palletes, _storageId, false); foreach (DataGridViewRow row in outStorageDataGridView.Rows) { string pallete_numberr = row.Cells["pallet_number"].Value.ToString(); pallete_number = pallete_numberr; string query2 = @$ "SELECT receipts.fk_client_id, clients.first_name, clients.last_name, items_receipt.fk_receipt_id, items_receipt.fk_article_id, items_receipt.id_items_receipt, items_receipt.quantity, items_receipt.status, articles.article_name, articles.sort, articles.organic, articles.category, item_pallete.fk_id_item_recepit, item_pallete.fk_id_pallete, pallete.pallet_number, pallete.id_pallete FROM receipts INNER JOIN clients ON receipts.fk_client_id = clients.id_client INNER JOIN items_receipt ON items_receipt.fk_receipt_id = receipts.id_receipt INNER JOIN articles ON articles.id_article = items_receipt.fk_article_id INNER JOIN item_pallete ON items_receipt.id_items_receipt = item_pallete.fk_id_item_recepit INNER JOIN pallete ON pallete.id_pallete = item_pallete.fk_id_pallete WHERE pallete.id_pallete = '{broj}'"; string queryForPdf = DbConnection.fillCustom(query2, "first_name", "last_name", "article_name", "sort", "organic", "category", "quantity"); queryForPdf2 = queryForPdf2 + queryForPdf; } OutStoragePDF createPDF = new OutStoragePDF(pallete_number, queryForPdf2); createPDF.exportgridview(outStorageDataGridView); Close(); }
private void createBtn_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(productNameTxtBox.Text) || string.IsNullOrWhiteSpace(productTypeTxtBox.Text)) { CustomMessageBox.ShowDialog(this, Properties.Resources.emptyInputErrorMsg); return; } Product product = new Product(0, productNameTxtBox.Text, productTypeTxtBox.Text); DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da kreirate proizvod?\nIme: {product._name}\nVrsta: {product._type}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } MySqlCommand mySqlCommand = new MySqlCommand { CommandText = "INSERT INTO `products` (`name`, `type`) VALUES (@name, @type)" }; mySqlCommand.Parameters.AddWithValue("@name", product._name); mySqlCommand.Parameters.AddWithValue("@type", product._type); DbConnection.executeQuery(mySqlCommand); Close(); }
private void editBtn_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(productNameTxtBox.Text) || string.IsNullOrWhiteSpace(productTypeTxtBox.Text)) { CustomMessageBox.ShowDialog(this, Properties.Resources.emptyInputErrorMsg); return; } DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da izmenite proizvod?\nIme: {productNameTxtBox.Text}\nVrsta: {productTypeTxtBox.Text}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } MySqlCommand mySqlCommand = new MySqlCommand { CommandText = "UPDATE `products` SET `name` = @name, `type` = @type WHERE `id_product` = @productId" }; mySqlCommand.Parameters.AddWithValue("@productId", _id); mySqlCommand.Parameters.AddWithValue("@name", productNameTxtBox.Text); mySqlCommand.Parameters.AddWithValue("@type", productTypeTxtBox.Text); DbConnection.executeQuery(mySqlCommand); Close(); }
private void createBtn_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(packageCapacityTxtBox.Text) || string.IsNullOrWhiteSpace(packagePriceTxtBox.Text) || string.IsNullOrWhiteSpace(packageQuantityTxtBox.Text)) { CustomMessageBox.ShowDialog(this, Properties.Resources.emptyInputErrorMsg); return; } Package package = new Package(0, Convert.ToInt32(packageCapacityTxtBox.Text), Convert.ToDecimal(packagePriceTxtBox.Text), Convert.ToString(packageCategoryTxtBox.Text), Convert.ToInt32(packageQuantityTxtBox.Text), Convert.ToInt32(packageWeightTxtBox.Text), Convert.ToString(packageProducerTxtBox.Text), Convert.ToString(packageStatusCmbBox.Text)); DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da kreirate ambalažu?\nNosivost: {package._capacity} g\nKategorija: {packageCategoryTxtBox.Text}\nKoličina: {package._quantity}\nCena: {package._price} RSD\nTežina: {package._weight} g\nProizvođač: {package._producer}\nStatus: {package._state}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } MySqlCommand mySqlCommand = new MySqlCommand { CommandText = @"INSERT INTO `packaging` (`capacity`, `price`, `quantity`, `category`, `weight`, `producer`, `state`) VALUES (@packageCapacity, @packagePrice, @packageQuantity, @packageCategory, @packageWeight, @packageProducer, @packageStatus)" }; mySqlCommand.Parameters.AddWithValue("@packageCapacity", package._capacity); mySqlCommand.Parameters.AddWithValue("@packagePrice", package._price); mySqlCommand.Parameters.AddWithValue("@packageQuantity", package._quantity); mySqlCommand.Parameters.AddWithValue("@packageCategory", package._category); mySqlCommand.Parameters.AddWithValue("@packageWeight", package._weight); mySqlCommand.Parameters.AddWithValue("@packageProducer", package._producer); mySqlCommand.Parameters.AddWithValue("@packageStatus", package._state); DbConnection.executeQuery(mySqlCommand); Close(); }
private void packagingDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } _selectedProductId = Convert.ToInt32(productsDataGridView.Rows[e.RowIndex].Cells["idProduct"].Value); _selectedProductName = productsDataGridView.Rows[e.RowIndex].Cells["name"].Value.ToString(); _selectedProductType = productsDataGridView.Rows[e.RowIndex].Cells["type"].Value.ToString(); if (e.ColumnIndex == 3) { Product product = new Product(_selectedProductId, _selectedProductName, _selectedProductType); using EditProductForm editproduct = new EditProductForm(product); editproduct.ShowDialog(this); } if (e.ColumnIndex == 4) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da obrišete proizvod?\nIme: {_selectedProductName}\nVrsta: {_selectedProductType}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DbConnection.deleteFromDB("products", "id_product", _selectedProductId); DbConnection.fillDGV(productsDataGridView, _fillDGVQuery); } }
result = DialogResult.OK; //initialise the result according to the function of the button, here I only use the OK button to close the dialog } public static DialogResult show (string calculationResult) // show static method called by the Main Window { MsgBox = new CustomDialog(); MsgBox.result_text.Text = calculationResult; // result_text is a textbox implemented in the form using design view MsgBox.StartPosition = FormStartPosition.CenterParent; // center dialog in the middle of the parent (WPF application main window) MsgBox.ShowDialog(); // displays the dialog return result; // returns the result so the button event is handled }
private void RenameLayer(LayerPanel layer) { var dialog = new CustomDialog("Rename", "Rename layer", CustomDialogType.TextInput, layer.LayerName); if (dialog.ShowDialog() == true) { layer.LayerName = dialog.DialogInputText; _window.LayersListView.Items.Refresh(); } }
private void AppListViewEvent(object sender, SelectionChangedEventArgs e) { ListView listView = sender as ListView; if (listView.SelectedIndex < 0 || listView.SelectedIndex > applicationList.Count) { return; } CustomDialog customDialog = new CustomDialog(this, "Launch Application", applicationList[listView.SelectedIndex].DisplayInfo.DisplayName, "Ok", "Cancel"); customDialog.ShowDialog(applicationList[listView.SelectedIndex]); }
private void transportDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da obrišete putni nalog?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DataGridViewRow _selectedRow = transportDataGridView.CurrentRow; transportDataGridView.Rows.Remove(_selectedRow); } }
private void insertedArticlesDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 9) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da obrišete ovaj artikal iz unosa?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DataGridViewRow _selectedRow = insertedArticlesDataGridView.CurrentRow; insertedArticlesDataGridView.Rows.Remove(_selectedRow); } }
public void OnDeleteClick(object sender, RoutedEventArgs e) { var dialog = new CustomDialog("Dialog", "Delete layer?", CustomDialogType.YesNo); if (dialog.ShowDialog() != true) { return; } var button = ((Button)sender); var row = (LayerPanel)button.DataContext; DeleteLayer(row); }
/// <inheritdoc/> public int ShowCustomDialog(string caption, string dialogText, int acceptButtonIndex, int cancelButtonIndex, params string[] buttontexts) { int result = 0; Invoke( delegate { using (CustomDialog messageBox = new CustomDialog(caption, dialogText, acceptButtonIndex, cancelButtonIndex, buttontexts)) { messageBox.ShowDialog(DialogOwner); result = messageBox.Result; } }); return(result); }
private void rentedPackagesDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 8) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da uklonite ove ambalaže?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DataGridViewRow _selectedRow = rentedPackagesDataGridView.CurrentRow; rentedPackagesDataGridView.Rows.Remove(_selectedRow); } }
private void AboutClicked(object sender, RoutedEventArgs e) { string about = "Winfrog Waypoint Helper by Duncan Tait, created 2016.\n" + "View project on GitHub: www.github.com/dunctait/WinfrogWaypointHelper\n" + "\n" + "To use, simply type/paste in your Eastings and Northings in the left pane (and optionally with a waypoint name," + " or the program will make this blank). Then choose the various settings above that will be assigned to " + "all of the waypoints. Hit the Copy To Clipboard button then paste this data into a Waypoint.wpt text" + "file. Keep in mind Winfrog won't automatically update the Waypoints. The best approach is to go to " + "File > Select Working Files then change the waypoint file to a blank file and back."; CustomDialog dialog = new CustomDialog(about, "About Winfrog Waypoint Helper", false); dialog.ShowDialog(); }
private void documentsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li želite da otvorite ovaj dokument?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } _file = documentsDataGridView.Rows[e.RowIndex].Cells["filePath"].Value.ToString(); Process.Start(_file); } }
int ShowAssertionDialog(string message, string detailMessage, string stackTrace) { message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace; string[] buttonTexts = { "Throw", "Debug", "Ignore", "Ignore All" }; CustomDialog inputBox = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts); inputBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; try { inputBox.ShowDialog(); return(inputBox.Result); } finally { dialogIsOpen = false; inputBox.Dispose(); } }
int ShowAssertionDialog(string message, string detailMessage, string stackTrace) { message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace; string[] buttonTexts = { "Throw", "Debug", "Ignore", "Ignore All" }; CustomDialog inputBox = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts); //inputBox.StartPosition = Avalonia.Forms.FormStartPosition.CenterScreen; inputBox.ShowInTaskbar = true; // make this window more visible, because it effectively interrupts the decompilation process. try { inputBox.ShowDialog(MainWindow.Instance); return(inputBox.Result); } finally { dialogIsOpen = false; //inputBox.Dispose(); } }
private void finishInsertBtn_Click(object sender, EventArgs e) { if (rentedPackagesDataGridView.Rows.Count < 1) { CustomMessageBox.ShowDialog(this, Properties.Resources.emptyDGVMsg); return; } DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da iznajmite ambalaže klijentu?\n{_selectedClientInfo}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } MySqlCommand mySqlCommand = new MySqlCommand { CommandText = "INSERT INTO `packaging_records` (`fk_client_id`, `type`) VALUES (@clientId, @type); SELECT LAST_INSERT_ID();" }; mySqlCommand.Parameters.AddWithValue("@clientId", _selectedClientId); mySqlCommand.Parameters.AddWithValue("@type", -1); int packagingRecordsId = Convert.ToInt32(DbConnection.getValue(mySqlCommand)); mySqlCommand.Parameters.Clear(); mySqlCommand.CommandText = "INSERT INTO `packaging_record_items` (`fk_packaging_records_id`, `fk_packaging_id`, `quantity`) VALUES (@packagingRecordsId, @packagingId, @quantity);"; foreach (DataGridViewRow row in rentedPackagesDataGridView.Rows) { int packagingId = Convert.ToInt32(row.Cells["packagingId"].Value); int packagingQuantity = Convert.ToInt32(row.Cells["quantity"].Value); mySqlCommand.Parameters.AddWithValue("@packagingRecordsId", packagingRecordsId); mySqlCommand.Parameters.AddWithValue("@packagingId", packagingId); mySqlCommand.Parameters.AddWithValue("@quantity", packagingQuantity); DbConnection.executeQuery(mySqlCommand); mySqlCommand.Parameters.Clear(); } updatePackageDetails(); rentedPackagesDataGridView.Rows.Clear(); Close(); }
private void packagingDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } _selectedPackageId = Convert.ToInt32(packagesDataGridView.Rows[e.RowIndex].Cells["idPackaging"].Value); _selectedPackageCapacity = Convert.ToInt32(packagesDataGridView.Rows[e.RowIndex].Cells["capacity"].Value); _selectedPackagePrice = Convert.ToDecimal(packagesDataGridView.Rows[e.RowIndex].Cells["price"].Value); _selectedPackageQuantity = Convert.ToInt32(packagesDataGridView.Rows[e.RowIndex].Cells["quantity"].Value); _selectedPackageCategory = packagesDataGridView.Rows[e.RowIndex].Cells["category"].Value.ToString(); _selectedPackageWeight = Convert.ToInt32(packagesDataGridView.Rows[e.RowIndex].Cells["weight"].Value); //baca gresku _selectedPackageProducer = packagesDataGridView.Rows[e.RowIndex].Cells["producer"].Value.ToString(); _selectedPackageStatus = packagesDataGridView.Rows[e.RowIndex].Cells["status"].Value.ToString(); if (e.ColumnIndex == 8) { Package package = new Package( _selectedPackageId, _selectedPackageCapacity, _selectedPackagePrice, _selectedPackageCategory, _selectedPackageQuantity, _selectedPackageWeight, _selectedPackageProducer, _selectedPackageStatus ); using EditPackageForm editPackage = new EditPackageForm(package); editPackage.ShowDialog(this); } if (e.ColumnIndex == 9) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da obrišete ambalažu?\nNosivost: {_selectedPackageCapacity} grama\nKoličina: {_selectedPackageQuantity}\nKategorija: {_selectedPackageCategory}\nCena: {_selectedPackagePrice} RSD\nTežina: {_selectedPackageWeight}grama\nProizvođač: {_selectedPackageProducer}\nStatus: {_selectedPackageStatus}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DbConnection.deleteFromDB("packaging", "id_packaging", _selectedPackageId); DbConnection.fillDGV(packagesDataGridView, _fillDGVQuery); } }
public static async Task <MessageBoxResult> Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options) { Debug.WriteLine(caption); Debug.WriteLine(messageBoxText); // TODO: message box var buttons = Buttons[button]; var win = new CustomDialog(caption, messageBoxText, AcceptButtonID[button], CancelButtonID[button], buttons); // TODO: add msgbox image var btnIndex = await win.ShowDialog <int?>(owner); if (btnIndex == null) { return(defaultResult); } return((MessageBoxResult)Enum.Parse(typeof(MessageBoxResult), buttons[btnIndex.Value])); // return Task.FromResult(defaultResult); }
private void clientsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } _selectedClientId = Convert.ToInt32(clientsDataGridView.Rows[e.RowIndex].Cells["clientId"].Value); _selectedClientFirstName = clientsDataGridView.Rows[e.RowIndex].Cells["clientFirstName"].Value.ToString(); _selectedClientLastName = clientsDataGridView.Rows[e.RowIndex].Cells["clientLastName"].Value.ToString(); _selectedClientAddress = clientsDataGridView.Rows[e.RowIndex].Cells["clientAddress"].Value.ToString(); _selectedClientType = clientsDataGridView.Rows[e.RowIndex].Cells["clientType"].Value.ToString(); _selectedClientCompanyName = clientsDataGridView.Rows[e.RowIndex].Cells["clientCompanyName"].Value.ToString(); _selectedClientJMBG = clientsDataGridView.Rows[e.RowIndex].Cells["clientJMBG"].Value.ToString(); _selectedClientPIB = clientsDataGridView.Rows[e.RowIndex].Cells["clientPIB"].Value.ToString(); _selectedClientBPG = clientsDataGridView.Rows[e.RowIndex].Cells["clientBPG"].Value.ToString(); _selectedClientSPO = clientsDataGridView.Rows[e.RowIndex].Cells["clientSPO"].Value.ToString(); _selectedClientZipCode = clientsDataGridView.Rows[e.RowIndex].Cells["clientZipCode"].Value.ToString(); _selectedClientBankAccount = clientsDataGridView.Rows[e.RowIndex].Cells["clientBankAccount"].Value.ToString(); _selectedClientPhone = clientsDataGridView.Rows[e.RowIndex].Cells["clientPhone"].Value.ToString(); if (e.ColumnIndex == 13) { Client client = new Client(_selectedClientId, _selectedClientFirstName, _selectedClientLastName, _selectedClientAddress, _selectedClientType, _selectedClientJMBG, _selectedClientBPG, _selectedClientZipCode, _selectedClientBankAccount, _selectedClientPhone, _selectedClientPIB, _selectedClientSPO, _selectedClientCompanyName ); using EditClientForm editClientForm = new EditClientForm(client); editClientForm.ShowDialog(this); } if (e.ColumnIndex == 14) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da obrišete klijenta?\nIme: {_selectedClientFirstName} {_selectedClientLastName}\nJMBG: {_selectedClientJMBG}\nTelefon: {_selectedClientPhone}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DbConnection.deleteFromDB("clients", "id_client", _selectedClientId); DbConnection.fillDGV(clientsDataGridView, _fillDGVQuery); } }
private void finishInsertBtn_Click(object sender, EventArgs e) { DialogResult result = CustomDialog.ShowDialog(this, "Da li ste sigurni da ste završili sa ubacivanjem artikala u komoru ?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } foreach (DataGridViewRow row in insertPalleteDataGridView.Rows) { int idPallete = Convert.ToInt32(row.Cells["id_pallet"].Value); int numberPallete = Convert.ToInt32(row.Cells["pallet_number"].Value); Pallete item = new Pallete(idPallete, numberPallete); palletes.Add(item); } DbConnection.palleting(palletes, storageId, true); Close(); }
private void finishInsertBtn_Click(object sender, EventArgs e) { // odavde proveravaj if (string.IsNullOrWhiteSpace(storagePositionCmbBox.Text) || string.IsNullOrWhiteSpace(pricelTxtBox.Text) || string.IsNullOrWhiteSpace(rentingDataPicker.Text) || string.IsNullOrWhiteSpace(endDataOfRentPicker.Text) ) { CustomMessageBox.ShowDialog(this, Properties.Resources.emptyInputErrorMsg); return; } DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da iznajmite\n Odeljak : {storagePositionCmbBox.Text}\nCena : {pricelTxtBox.Text} RSD\n Od : {rentingDataPicker.Text}\n Do : {endDataOfRentPicker.Text}\n"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } string dateOfRenting = rentingDataPicker.Value.Date.ToString("yyyy-MM-dd"); string dateOfRentingEnd = endDataOfRentPicker.Value.Date.ToString("yyyy-MM-dd"); storageId = (storagePositionCmbBox.SelectedItem as ComboBoxItem).Value; MySqlCommand mySqlCommand = new MySqlCommand { CommandText = "INSERT INTO `renting_storage` (`fk_storage_id`, `price`, `renting_data`, `end_of_renting_data`, `fk_client_id`) VALUES (@storageId, @price, @dateOfRenting, @end_of_renting_data, @clientId);" }; mySqlCommand.Parameters.AddWithValue("@storageId", storageId); mySqlCommand.Parameters.AddWithValue("@price", Decimal.Parse(pricelTxtBox.Text)); mySqlCommand.Parameters.AddWithValue("@dateOfRenting", dateOfRenting); mySqlCommand.Parameters.AddWithValue("@end_of_renting_data", dateOfRentingEnd); mySqlCommand.Parameters.AddWithValue("@clientId", fkClientId); StoragePDF storagePDF = new StoragePDF(_client); storagePDF.exportgridview(storagePositionCmbBox.Text, rentingDataPicker.Text, endDataOfRentPicker.Text, pricelTxtBox.Text); DbConnection.executeQuery(mySqlCommand); Close(); }
public static void Handle(string errorMessage, bool isError = true, Exception exception = null) { var dialog = new CustomDialog("Error", errorMessage, CustomDialogType.OK); dialog.ShowDialog(); string fileName = "SeamLogs.txt"; string folder = $"{Environment.GetFolderPath(_file)}{_programFolder}"; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string path = $"{folder}{fileName}"; string type = "[Info]"; if (isError) { type = "[Error]"; } string textLine = $"{DateTime.Now}: {type} {errorMessage}"; if (exception != null) { textLine += $"{exception}"; } if (!File.Exists(path)) { using (var creator = File.CreateText(path)) { } } using (var streamWriter = File.AppendText(path)) streamWriter.WriteLine(textLine); }
private void articlesDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } _selectedArticleId = Convert.ToInt32(articlesDataGridView.Rows[e.RowIndex].Cells["articleId"].Value); _selectedArticleName = articlesDataGridView.Rows[e.RowIndex].Cells["articleName"].Value.ToString(); _selectedArticleSort = articlesDataGridView.Rows[e.RowIndex].Cells["articleSort"].Value.ToString(); _selectedArticleOrganic = articlesDataGridView.Rows[e.RowIndex].Cells["articleOrganic"].Value.ToString(); _selectedArticleCategory = articlesDataGridView.Rows[e.RowIndex].Cells["articleCategory"].Value.ToString(); if (e.ColumnIndex == 6) { Article article = new Article( _selectedArticleId, _selectedArticleName, _selectedArticleSort, _selectedArticleCategory, _selectedArticleOrganic ); using EditArticleForm editArticle = new EditArticleForm(article); editArticle.ShowDialog(this); } if (e.ColumnIndex == 7) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da obrišete artikal?\nIme: {_selectedArticleName}\nSorta: {_selectedArticleSort}\nKontrolisana proizvodnja: {_selectedArticleOrganic}"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DbConnection.deleteFromDB("articles", "id_article", _selectedArticleId); DbConnection.fillDGV(articlesDataGridView, _fillDGVQuery); } }
private void ArticlesDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 3) { DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da ne ubacite ovu paletu ?"); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } DataGridViewRow _selectedRow = insertPalleteDataGridView.CurrentRow; insertPalleteDataGridView.Rows.Remove(_selectedRow); } if (e.ColumnIndex == 2) { int _id_pallete = Convert.ToInt32(insertPalleteDataGridView.Rows[e.RowIndex].Cells["id_pallet"].Value); string query2 = @$ "SELECT receipts.fk_client_id, clients.first_name, clients.last_name, items_receipt.fk_receipt_id, items_receipt.fk_article_id, items_receipt.id_items_receipt, items_receipt.quantity, items_receipt.status, articles.article_name, articles.sort, articles.organic, articles.category, item_pallete.fk_id_item_recepit, item_pallete.fk_id_pallete, pallete.pallet_number, pallete.id_pallete FROM receipts INNER JOIN clients ON receipts.fk_client_id = clients.id_client INNER JOIN items_receipt ON items_receipt.fk_receipt_id = receipts.id_receipt INNER JOIN articles ON articles.id_article = items_receipt.fk_article_id INNER JOIN item_pallete ON items_receipt.id_items_receipt = item_pallete.fk_id_item_recepit INNER JOIN pallete ON pallete.id_pallete = item_pallete.fk_id_pallete WHERE pallete.id_pallete = '{_id_pallete}'"; CustomMessageBox.ShowDialog(this, "Na ovoj paleti se nalazi : \n\t" + DbConnection.fillCustom(query2, "first_name", "last_name", "article_name", "sort", "organic", "category", "quantity")); return; } }
/// <summary> /// User opens a job by typing a job url. /// </summary> /// <param name="sender">Unused.</param> /// <param name="e">Unused.</param> private void openFromURLToolStripMenuItem_Click(object sender, EventArgs e) { var dialog = new CustomDialog("Job URL:"); DialogResult result = dialog.ShowDialog(); switch (result) { case DialogResult.Cancel: default: return; case DialogResult.OK: { string url = dialog.UserInput; if (url == "") { return; } DryadLinqJobSummary summary = null; try { summary = this.clusterStatus.DiscoverDryadLinqJobFromURL(url, this.Status); } catch (Exception ex) { this.Status("Could not find job associated to url " + url + ": exception " + ex.Message, StatusKind.Error); } if (summary == null) { this.Status("Could not locate job associated to url " + url, StatusKind.Error); } this.browseFromJobSummary(summary); break; } } }