private async Task OnSaveAsync(object sender, EventArgs e) { var path = _fileDialogs.SaveFileDialog("Srednia_kwota_zamowienia"); if (path == "" || path == string.Empty) { return; } var records = new[] { new { Orders_Amount = _ordersAverage } }.ToList(); try { Application.UseWaitCursor = true; await OrdersWriter.SaveToCsvAsync(records, path); Application.UseWaitCursor = false; } catch (Exception) { Application.UseWaitCursor = false; MessageBox.Show("Błąd w trakcie zapisu. Spróbuj ponownie."); } }
private async Task OnSaveAsync(object sender, EventArgs e) { var path = _fileDialogs.SaveFileDialog("Ilosc_zamowien_dla_'" + _view.SelectedClientId + "'"); if (path == "" || path == string.Empty) { return; } var records = new[] { new { Client_Id = _view.SelectedClientId, Orders_Quantity = _ordersQuantity } }.ToList(); try { Application.UseWaitCursor = true; await OrdersWriter.SaveToCsvAsync(records, path); Application.UseWaitCursor = false; } catch (Exception) { Application.UseWaitCursor = false; MessageBox.Show("Błąd w trakcie zapisu. Spróbuj ponownie."); } }
private async Task OnSaveAsync(object sender, EventArgs e) { var path = _fileDialogs.SaveFileDialog("Ilosc_zamowien_wedlug_nazwy"); if (path == "" || path == string.Empty) { return; } try { Application.UseWaitCursor = true; await OrdersWriter.SaveToCsvAsync(_groupings.ToList(), path); Application.UseWaitCursor = false; } catch (Exception) { Application.UseWaitCursor = false; MessageBox.Show("Błąd w trakcie zapisu. Spróbuj ponownie."); } }
private async Task OnSaveAsync(object sender, EventArgs e) { var path = _fileDialogs.SaveFileDialog("Lista_zamowien_w_przedziale_cenowym"); if (path == "" || path == string.Empty) // Canceled dialog { return; } try { var flatOrders = OrderConverters.FlattenOrder(_orders).ToList(); Application.UseWaitCursor = true; await OrdersWriter.SaveToCsvAsync(flatOrders, path); Application.UseWaitCursor = false; } catch (Exception) { Application.UseWaitCursor = false; MessageBox.Show("Błąd w trakcie zapisu. Spróbuj ponownie."); } }