示例#1
0
        /// <summary>
        /// 执行任务
        /// </summary>
        public void ToDoTask()
        {
            string textbox3 = textBox3.Text;
            string textbox4 = textBox4.Text;
            string textbox7 = textBox7.Text;

            if (string.IsNullOrEmpty(textbox3))
            {
                MessageBox.Show("更新频率不能为空!", "提示");
                return;
            }
            if (string.IsNullOrEmpty(textbox4))
            {
                MessageBox.Show("更新数据条数不能为空!", "提示");
                return;
            }
            if (string.IsNullOrEmpty(textbox7))
            {
                MessageBox.Show("过滤天数不能为空!", "提示");
                return;
            }
            if (u.IsNumeric(textbox3) && u.IsNumeric(textbox4) && u.IsNumeric(textbox7))
            {
                UpdataTask ut = new UpdataTask(int.Parse(textbox3), int.Parse(textbox4), int.Parse(textbox7), textBox1, textBox2, textBox5, textBox6);
                ut.StartTask();
            }
            else
            {
                MessageBox.Show("请输入不小于0的数字!", "提示");
                return;
            }
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            u = new UpdataTask(textBox2);
            comboBox1.SelectedIndex = 22;

            DateTime start = Convert.ToDateTime("2018-3-18");
            DateTime end   = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));//获取当前日期
            TimeSpan ts    = end.Subtract(start);

            if (ts.Days <= 3)
            {
                int qwe = ts.Days;
            }
        }