Esempio n. 1
0
        public override HSQL BuildRecordSetSql()
        {
            HSQL hsql = base.BuildRecordSetSql();

            hsql.Clear();
            hsql.Add("SELECT 1.0 AS NO1,WFRUNLOG_LOGNO AS NO2");
            hsql.Add(",WFRUNLOG_WFPID AS WFPID,WFRUNLOG_WFPACTION AS WFPACTION");
            hsql.Add(",WFRUNLOG_RBEGIN AS RBEGIN,WFRUNLOG_REND AS REND,WFRUNLOG_AEND AS AEND");
            hsql.Add(",WFRUNLOG_AUSERID AS AUSER,WFRUNLOG_OPINION AS OPINION,WFRUNLOG_TODO AS TODO,WFRUNLOG_AGENT AS AGENT");
            hsql.Add(",WFRUNLOG_WFID AS WFID,WFRUNLOG_RUNID AS WFRUNID");
            hsql.Add("FROM WFRUNLOG");
            hsql.Add("WHERE WFRUNLOG_WFID = :WFID");
            hsql.Add("AND WFRUNLOG_RUNID = :WFRUNID");
            hsql.Add("UNION");
            hsql.Add("SELECT 2.0 AS NO1,0 AS NO2");
            hsql.Add(",WFRUN_WFPID AS WFPID");
            hsql.Add(",case WFRUN_STATE when 'F' then '流程结束' when 'I' then '流程终止' else '[待处理]' end as WFPACTION");
            hsql.Add(",WFRUN_RBEGIN AS RBEGIN,WFRUN_REND AS REND,null AS AEND");
            hsql.Add(",'' AS AUSER,'' AS OPINION,WFRUN_TODO AS TODO,WFRUN_AGENT AS AGENT");
            hsql.Add(",WFRUN_WFID AS WFID,WFRUN_RUNID AS WFRUNID");
            hsql.Add("FROM WFRUN");
            hsql.Add("WHERE WFRUN_WFID = :WFID");
            hsql.Add("AND WFRUN_RUNID = :WFRUNID");
            hsql.Add("ORDER BY NO1,NO2 ASC");
            hsql.AddParam("WFID", TimDbType.Char, 10, this.QueryWfId);
            hsql.AddParam("WFRUNID", TimDbType.Float, 0, this.QueryWfRunId);
            return(hsql);
        }
Esempio n. 2
0
        public static double ShareFile(double fileId)
        {
            double   shareGroupId = (double)TimIdUtils.GenUtoId("DFS_FGID");
            Database db           = LogicContext.GetDatabase();
            HSQL     hsql         = new HSQL(db);

            hsql.Add("INSERT INTO DFSGROUP(DFSGROUP_GROUPID,DFSGROUP_FILEID");
            hsql.Add("VALUES(:DFSGROUP_GROUPID,:DFSGROUP_FILEID)");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, shareGroupId);
            hsql.AddParam("DFSGROUP_FILEID", TimDbType.Float, 0, fileId);
            db.ExecSQL(hsql);
            return(shareGroupId);
        }
Esempio n. 3
0
        internal static bool DeleteDfsGroupFile(double fileGroupId, double fileId)
        {
            Database db   = LogicContext.GetDatabase();
            HSQL     hsql = new HSQL(db);

            hsql.Add("DELETE FROM DFSGROUP");
            hsql.Add("WHERE DFSGROUP_GROUPID = :DFSGROUP_GROUPID");
            hsql.Add("AND DFSGROUP_FILEID = :DFSGROUP_FILEID");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, fileGroupId);
            hsql.AddParam("DFSGROUP_FILEID", TimDbType.Float, 0, fileId);
            int  affectedRows = db.ExecSQL(hsql);
            bool flag         = affectedRows < 1;

            return(!flag);
        }
Esempio n. 4
0
        private int UpdateBusinessFiles()
        {
            int      files = 0;
            Database db    = LogicContext.GetDatabase();
            HSQL     hsql  = new HSQL(db);

            hsql.Add("SELECT COUNT(DFSGROUP_FILEID) FROM DFSGROUP WHERE DFSGROUP_GROUPID = :DFSGROUP_GROUPID");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, this.hidFileGroup.Value.ToDouble());
            object objFiles = db.ExecScalar(hsql);
            bool   flag     = objFiles != null;

            if (flag)
            {
                files = objFiles.ToString().ToInt();
                hsql.Clear();
                hsql.Add(string.Format("UPDATE {0} SET {1} = {2} WHERE {3}", new object[]
                {
                    this.filelist.BusinessTable,
                    this.filelist.FilesField,
                    files.ToString(),
                    this.filelist.ExecOn
                }));
                db.ExecSQL(hsql);
            }
            return(files);
        }
Esempio n. 5
0
        internal static void InsertDfsGroup(double fileGroupId, double fileId)
        {
            Database db   = LogicContext.GetDatabase();
            HSQL     hsql = new HSQL(db);

            hsql.Add("INSERT INTO DFSGROUP(DFSGROUP_GROUPID,DFSGROUP_FILEID)");
            hsql.Add("VALUES(:DFSGROUP_GROUPID,:DFSGROUP_FILEID)");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, fileGroupId);
            hsql.AddParam("DFSGROUP_FILEID", TimDbType.Float, 0, fileId);
            int  affectedRows = db.ExecSQL(hsql);
            bool flag         = affectedRows < 1;

            if (flag)
            {
                throw new Exception("文件服务器异常!");
            }
        }
Esempio n. 6
0
        public override HSQL BuildRecordSetSql()
        {
            HSQL hsql = base.BuildRecordSetSql();

            hsql.Clear();
            hsql.Add("SELECT DFSGROUP_GROUPID,DFSGROUP_FILEID");
            hsql.Add(",DFSFILE_FSID,DFSFILE_FILEID,DFSFILE_FILENAME,DFSFILE_EXTNAME,DFSFILE_FILESIZE");
            hsql.Add("FROM DFSGROUP LEFT JOIN DFSFILE ON DFSFILE_FILEID = DFSGROUP_FILEID");
            hsql.Add("WHERE DFSGROUP_GROUPID = :DFSGROUP_GROUPID");
            hsql.Add("ORDER BY DFSGROUP_FILEID");
            hsql.AddParam("DFSGROUP_GROUPID", TimDbType.Float, 0, this.QueryFileGroupId.ToInt());
            return(hsql);
        }
Esempio n. 7
0
        public static void WriteServiceLog(TaskBase task)
        {
            Database database = LogicContext.GetDatabase();

            try
            {
                database.BeginTrans();
                HSQL sql = new HSQL(database);
                sql.Add("insert into JOBLOG(JOBLOG_JOBID, JOBLOG_LOGNO, JOBLOG_LOGTIME, JOBLOG_OPERTYPE, JOBLOG_EXECRESULT, JOBLOG_DESC, JOBLOG_DETAIL)");
                sql.Add("values(:JOBLOG_JOBID, :JOBLOG_LOGNO, :JOBLOG_LOGTIME, :JOBLOG_OPERTYPE, :JOBLOG_EXECRESULT, :JOBLOG_DESC, :JOBLOG_DETAIL)");
                sql.ParamByName("JOBLOG_JOBID").Value    = task.JobId;
                sql.ParamByName("JOBLOG_LOGNO").Value    = TimIdUtils.GenUtoId("JOBLOGNO");
                sql.ParamByName("JOBLOG_LOGTIME").Value  = AppRuntime.ServerDateTime;
                sql.ParamByName("JOBLOG_OPERTYPE").Value = "E";
                sql.ParamByName("JOBLOG_DETAIL").Value   = string.Empty;
                StringBuilder stringBuilder = new StringBuilder();
                foreach (string str in task.LogInfoDetail)
                {
                    stringBuilder.AppendLine(str);
                }
                string str2 = stringBuilder.ToString();
                string str3 = string.Empty;
                bool   flag = task.TaskResult == TaskExecResult.Success;
                if (flag)
                {
                    str3 = string.Format("{0} 作业计划执行成功。", task.RequiredExecuteTime.ToString());
                    bool flag2 = string.IsNullOrEmpty(str2);
                    if (flag2)
                    {
                        str2 = str3;
                    }
                    sql.ParamByName("JOBLOG_EXECRESULT").Value = "A";
                    sql.ParamByName("JOBLOG_DESC").Value       = str3;
                    sql.AddParam("JOBLOG_DETAIL", TimDbType.Blob, 0, str2);
                }
                else
                {
                    bool flag3 = task.TaskResult == TaskExecResult.Failure;
                    if (flag3)
                    {
                        str3 = string.Format("{0} 作业计划执行失败。", task.RequiredExecuteTime.ToString());
                        bool flag4 = string.IsNullOrEmpty(str2);
                        if (flag4)
                        {
                            str2 = str3;
                        }
                        sql.ParamByName("JOBLOG_EXECRESULT").Value = "B";
                        sql.ParamByName("JOBLOG_DESC").Value       = str3;
                        sql.AddParam("JOBLOG_DETAIL", TimDbType.Blob, 0, str2);
                        JobLogUtils.SendErrorMsgToMail(task);
                    }
                    else
                    {
                        bool flag5 = task.TaskResult == TaskExecResult.Skip;
                        if (flag5)
                        {
                            str3 = "部分作业计划已过期,跳过运行。";
                            bool flag6 = string.IsNullOrEmpty(str2);
                            if (flag6)
                            {
                                str2 = str3;
                            }
                            sql.ParamByName("JOBLOG_EXECRESULT").Value = "C";
                            sql.ParamByName("JOBLOG_DESC").Value       = str3;
                            sql.AddParam("JOBLOG_DETAIL", TimDbType.Blob, 0, str2);
                        }
                        else
                        {
                            bool flag7 = task.TaskResult == TaskExecResult.Exception;
                            if (flag7)
                            {
                                str3 = string.Format("{0} 作业计划执行错误。", task.RequiredExecuteTime.ToString());
                                bool flag8 = string.IsNullOrEmpty(str2);
                                if (flag8)
                                {
                                    str2 = str3;
                                }
                                sql.ParamByName("JOBLOG_EXECRESULT").Value = "D";
                                sql.ParamByName("JOBLOG_DESC").Value       = str3;
                                sql.AddParam("JOBLOG_DETAIL", TimDbType.Blob, 0, str2);
                                JobLogUtils.SendErrorMsgToMail(task);
                            }
                            else
                            {
                                bool flag9 = task.TaskResult == TaskExecResult.StartExecute;
                                if (flag9)
                                {
                                    str3 = string.Format("{0} 作业计划开始执行。", task.RequiredExecuteTime.ToString());
                                    bool flag10 = string.IsNullOrEmpty(str2);
                                    if (flag10)
                                    {
                                        str2 = str3;
                                    }
                                    sql.ParamByName("JOBLOG_EXECRESULT").Value = "A";
                                    sql.ParamByName("JOBLOG_DESC").Value       = str3;
                                    sql.AddParam("JOBLOG_DETAIL", TimDbType.Blob, 0, str2);
                                }
                            }
                        }
                    }
                }
                database.ExecSQL(sql);
                task.LogInfoDetail.Clear();
                sql.Clear();
                sql.Add("update JOB set JOB_PREEXECTIME = :JOB_PREEXECTIME,JOB_PREEXECSTATUS = :JOB_PREEXECSTATUS,JOB_PREEXECDESC = :JOB_PREEXECDESC ");
                sql.Add(" where JOB_JOBID = :JOB_JOBID");
                sql.ParamByName("JOB_PREEXECSTATUS").Value = ((task.TaskResult != TaskExecResult.Success) ? ((task.TaskResult != TaskExecResult.Failure) ? ((task.TaskResult != TaskExecResult.Exception) ? "C" : "D") : "B") : "A");
                sql.ParamByName("JOB_PREEXECTIME").Value   = task.ExecuteTime;
                sql.ParamByName("JOB_PREEXECDESC").Value   = str3;
                sql.ParamByName("JOB_JOBID").Value         = task.JobId;
                database.ExecSQL(sql);
                database.CommitTrans();
            }
            catch (Exception ex)
            {
                database.RollbackTrans();
                AppEventLog.Error("记录作业计划日志失败,原因:" + ex.Message);
            }
        }