Esempio n. 1
0
    //更新计划任务
    public void UpdateSched(int gid, M_Content_ScheTask.TaskTypeEnum type, string datetext)
    {
        M_Content_ScheTask taskmod = taskBll.SelByGid(GeneralID, type);

        if (!string.IsNullOrEmpty(datetext))
        {
            if (taskmod == null)
            {
                taskmod = new M_Content_ScheTask();
            }
            taskmod.TaskType    = (int)type;
            taskmod.TaskContent = GeneralID.ToString();
            taskmod.ExecuteTime = datetext;
            taskmod.LastTime    = DateTime.Parse(datetext);
            taskmod.Status      = 0;
            if (taskmod.ID > 0)
            {
                taskBll.Update(taskmod);
            }
            else
            {
                taskBll.Add(taskmod);
            }
        }
        else if (taskmod != null)
        {
            taskBll.Delete(taskmod.ID);
        }
    }
Esempio n. 2
0
        public void AddSched(int gid, string datetext, M_Content_ScheTask.TaskTypeEnum type)
        {
            M_Content_ScheTask taskmod = new M_Content_ScheTask();

            taskmod.TaskType    = (int)type;
            taskmod.TaskContent = gid.ToString();
            taskmod.ExecuteTime = datetext;
            taskmod.LastTime    = DateTime.Parse(datetext).ToString();
            taskBll.Add(taskmod);
        }
Esempio n. 3
0
        public M_Content_ScheTask SelByGid(int gid, M_Content_ScheTask.TaskTypeEnum type)
        {
            string sql = "SELECT * FROM " + TbName + " WHERE TaskContent='" + gid + "' AND TaskType=" + (int)type;

            using (DbDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql))
            {
                if (dr.Read())
                {
                    return(new M_Content_ScheTask().GetModelFromReader(dr));
                }
                else
                {
                    return(null);
                }
            }
        }
Esempio n. 4
0
 //-------------------------------Tools
 /// <summary>
 /// 根据类型找出未完成的任务
 /// </summary>
 public DataTable SelByTaskType(M_Content_ScheTask.TaskTypeEnum type)
 {
     return(SqlHelper.ExecuteTable(CommandType.Text, "Select * From " + TbName + " Where TaskType=" + (int)type));
 }