public void Bind_DataList(string strWhere)
        {
            if (this.ClassID > 0)
            {
                strWhere += " And TaskClassID=" + this.ClassID + " ";
            }
            strWhere += " Order by Id Desc ";
            DALTask   dal = new DALTask();
            DataTable dt  = dal.GetList(strWhere).Tables[0];

            this.dataGridView_TaskList.DataSource = dt.DefaultView;
        }
Esempio n. 2
0
        /// <summary>
        /// 载入所有作业
        /// </summary>
        public static void LoadAllJobs()
        {
            DataTable dt = dal.GetList(" And IsPlan=1 ").Tables[0];

            //DataTable dt = dal.GetList("Order By Id Asc").Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    #region Job
                    var job = dal.GetModel(int.Parse(dr["Id"].ToString()));
                    if (string.IsNullOrEmpty(job.PlanFormat))
                    {
                        continue;
                    }
                    var jobNum = string.Format("job_{0}", dr["Id"].ToString());
                    if (scheduler.CheckExists(new JobKey(jobNum)))
                    {
                        continue;
                    }
                    var dic3 = new Dictionary <string, ModelTask>();
                    dic3.Add(jobNum, job);

                    IJobDetail job3 = JobBuilder.Create <JobDetailHelper>()
                                      .WithIdentity(jobNum)
                                      .SetJobData(new JobDataMap(dic3))
                                      .Build();
                    #endregion

                    #region 调度器
                    Quartz.Collection.ISet <ITrigger> ll = new Quartz.Collection.HashSet <ITrigger>();

                    var triggerNum = string.Format("trigger_{0}", dr["Id"].ToString());
                    var t3         = TriggerBuilder.Create();
                    t3.WithIdentity(triggerNum);
                    t3.WithCronSchedule(job.PlanFormat);//"0/5 * * * * ?"
                    var trigger3 = t3.Build();
                    //scheduler.ScheduleJob(job3, trigger3);
                    ll.Add(trigger3);
                    #endregion
                    scheduler.ScheduleJob(job3, ll, true);
                }
            }
        }
Esempio n. 3
0
        public void Bind_DataList(string strWhere)
        {
            if (this.ClassID > 0)
            {
                strWhere += " And TaskClassID=" + this.ClassID + " ";
            }
            strWhere += " Order by Id Desc ";
            DALTask   dal = new DALTask();
            DataTable dt  = dal.GetList(strWhere).Tables[0];

            this.dataGridView_TaskList.DataSource = dt.DefaultView;

            for (int i = 0; i < this.dataGridView_TaskList.Rows.Count; i++)
            {
                var row = this.dataGridView_TaskList.Rows[i];
                row.Selected = false;
                if (i == m_RowIndex)
                {
                    row.Selected = true;
                }
            }
        }