private void BackButton_Click(object sender, EventArgs e) { string searchAll = textBox1.Text; string searchAny = textBox2.Text; string searchExclude = textBox3.Text; string start = dateTimePicker1.Value.ToString("yyyy-MM-dd"); string end = dateTimePicker2.Value.ToString("yyyy-MM-dd"); string lang = comboBox1.Text; decimal maxResult = numericUpDown1.Value; long maxid = -1; long minid = -1; if (re != null && re.Results != null && re.Results.Count > 0) { maxid = re.Results.Max(x => x.NewsId); re = ResultViewMethods.Post(searchAll, searchAny, searchExclude, start, end, maxResult, minid, maxid, lang); if (re.Results.Count == 1) { MessageBox.Show("there isn't new news"); } else { dataGridView1.DataSource = re.Results; } } }
private void SearchButton_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(textBox1.Text)) { MessageBox.Show(this, "Enter topic please."); return; } else if (numericUpDown1.Value == 0) { MessageBox.Show(this, "Enter MaxResult please."); return; } else if (dateTimePicker1.Value.Date == dateTimePicker2.Value.Date) { MessageBox.Show(this, "Change start time or end time, please."); return; } string searchAll = textBox1.Text; string searchAny = textBox2.Text; string searchExclude = textBox3.Text; string start = dateTimePicker1.Value.ToString("yyyy-MM-dd"); string end = dateTimePicker2.Value.ToString("yyyy-MM-dd"); string lang = comboBox1.Text; decimal maxResult = numericUpDown1.Value; long maxid = -1; long minid = -1; re = ResultViewMethods.Post(searchAll, searchAny, searchExclude, start, end, maxResult, maxid, minid, lang); dataGridView1.DataSource = re.Results; }