private void button1_Click_1(object sender, EventArgs e) { AuthStuff auth = new AuthStuff(); var client = auth.CreateClient(f5token); try { using (client) { if (dateTimePicker1.Value.Equals(DateTime.Now)) { var response = client.GetAsync("http://localhost:65458/" + "api/DBManage/GetStudents/" + $"?tableName=\"{tblname}\"").Result; dataGridView1.DataSource = JsonConvert.DeserializeObject <List <Table> >(response.Content.ReadAsStringAsync().Result); } else { var response = client.GetAsync("http://localhost:65458/" + "api/DBManage/GetStudents/" + $"?tableName=\"{tblname}\"&visitatdate={dateTimePicker1.Value.ToString("yyyyMMdd")}").Result; dataGridView1.DataSource = JsonConvert.DeserializeObject <List <Table> >(response.Content.ReadAsStringAsync().Result); } } } catch { label1.Text = "Произошла ошибка."; } }
private void button2_Click(object sender, EventArgs e) { AuthStuff auth = new AuthStuff(); using (var client = auth.CreateClient(f2token)) { //"http://*****:*****@gmail.com" var response = client.GetAsync("http://localhost:65458/" + "api/DBManage/GetTables/" + $"?prepodname={f2email}").Result; //textBox1.Text = response.Content.ReadAsStringAsync().Result; professors = JsonConvert.DeserializeObject <List <ProfessorTable> >(response.Content.ReadAsStringAsync().Result); //comboBox1.Items.Add(myNewObject.TableName); dataGridView1.DataSource = professors; } }
private void Form5_Load(object sender, EventArgs e) { AuthStuff auth = new AuthStuff(); var client = auth.CreateClient(f5token); try { using (client) { var response = client.GetAsync("http://localhost:65458/" + "api/DBManage/GetStudents/" + $"?tableName=\"{tblname}\"").Result; dataGridView1.DataSource = JsonConvert.DeserializeObject <List <Table> >(response.Content.ReadAsStringAsync().Result); } } catch { label1.Text = "Произошла ошибка"; } }
private void button1_Click(object sender, EventArgs e) { usertable.Groups = checkedListBox1.CheckedItems.OfType <string>().ToList(); AuthStuff auth = new AuthStuff(); try { using (var client = auth.CreateClient(f4token)) { var response = client.PostAsJsonAsync("http://localhost:65458/" + "api/DBManage/CreateTable/", usertable).Result; label1.Text = response.Content.ReadAsStringAsync().Result; } } catch (Exception ex) { label1.Text = ex.Message; } }