Esempio n. 1
0
        /// <summary>
        /// 获取任务状态的文字说明。
        /// </summary>
        /// <param name="taskState"></param>
        /// <returns></returns>
        public static string GetDescription(this TaskStateOptions taskState)
        {
            switch (taskState)
            {
            case TaskStateOptions.Start:
                return("启动");

            case TaskStateOptions.Running:
                return("运行中");

            case TaskStateOptions.Done:
                return("运行完成");

            case TaskStateOptions.Stopping:
                return("正在终止");

            case TaskStateOptions.Stop:
                return("强行终止");

            case TaskStateOptions.Exception:
                return("异常终止");

            default:
                throw new NotImplementedException("尚未实现该枚举。");
            }
        }
Esempio n. 2
0
File: Task.cs Progetto: jujianfei/AC
        internal void SetDataReader(System.Data.IDataReader dr)
        {
            this.RetryTimes = Function.ToInt(dr[Tables.TaskRunLog.RetryTimes]);
            this.taskName   = dr[Tables.TaskRunLog.DeviceName] + "";
            this.StartTime  = new DateTime(Function.ToLong(dr[Tables.TaskRunLog.StartTime]));
            this.StopTime   = new DateTime(Function.ToLong(dr[Tables.TaskRunLog.StopTime]));
            this.m_State    = (TaskStateOptions)Function.ToInt(dr[Tables.TaskRunLog.TaskState]);
            this.Progress   = Function.ToDecimal(dr[Tables.TaskRunLog.TaskProgress]);
            this.DeviceName = Function.ToString(dr[Tables.TaskRunLog.DeviceName]);
            this.TimeStr    = Function.ToString(dr[Tables.TaskRunLog.TimeStr]);
            object objConfig = dr[Tables.TaskConfig.XMLConfig];

            if (objConfig != null && !(objConfig is System.DBNull))
            {
                System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                try
                {
                    xmlDoc.LoadXml(objConfig.ToString());

                    if (xmlDoc.ChildNodes.Count > 0)
                    {
                        this.SetTaskRunConfig(xmlDoc.ChildNodes[0]);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }