예제 #1
0
        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("Произшла ошибка!");
            }
        }
예제 #2
0
        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();
            }
        }