private void UploadAllReport(object sender, EventArgs e) { if (isDataSet) { var waitForm = new WaitForm(this); } }
private void UploadReport(object sender, EventArgs e) { var waitForm = new WaitForm(this); try { waitForm.ShowDialog(); } catch (Exception ex) { MessageBox.Show("Ошибка при загрузке", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async void upload(WaitForm f) { var r = await HttpController.UploadReport(data[index], Program.periods[form.periodList.SelectedIndex]); f.Close(); if (!r.ContainsKey("create") || !r.ContainsKey("edit")) { MessageBox.Show("Произшла ошибка!"); } else if ((r.ContainsKey("create") && r["create"].code == System.Net.HttpStatusCode.OK) && (r.ContainsKey("edit") && r["edit"].code == System.Net.HttpStatusCode.OK)) { MessageBox.Show("Отчет загружен успешно"); } else { MessageBox.Show("Произшла ошибка!"); } }
public async void upload(WaitForm f) { var errors = new List <String>(); Cursor = Cursors.WaitCursor; foreach (var h in data) { try { var r = await HttpController.UploadReport(h, Program.periods[periodList.SelectedIndex]); if (!r.ContainsKey("create") || !r.ContainsKey("edit")) { errors.Add(h.House); } else if ((r.ContainsKey("create") && r["create"].code != System.Net.HttpStatusCode.OK) || (r.ContainsKey("edit") && r["edit"].code != System.Net.HttpStatusCode.OK)) { errors.Add(h.House); } }catch (Exception e) { errors.Add(h.House); } } Cursor = Cursors.Arrow; f.Close(); if (errors.Count == 0) { MessageBox.Show("Отчеты загружены успешно"); } else { var form = new ErrorForm(errors); form.ShowDialog(); } }