コード例 #1
0
ファイル: Form5.cs プロジェクト: Rendread/WpfApp2
        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 = "Произошла ошибка.";
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
ファイル: Form5.cs プロジェクト: Rendread/WpfApp2
        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 = "Произошла ошибка";
            }
        }
コード例 #4
0
ファイル: Form4.cs プロジェクト: Rendread/WpfApp2
        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;
            }
        }