Esempio n. 1
0
        public JobCollection UPDLOCKLoadJobs(int batchCount, IConnectiveSqlClause whereClause)
        {
            JobCollection result = new JobCollection();

            if (whereClause.IsEmpty == false)
            {
                using (DbContext context = DbContext.GetContext(this.GetConnectionName()))
                {
                    string top = batchCount >= 0 ? "TOP " + batchCount : string.Empty;

                    Database db = DatabaseFactory.Create(context);

                    using (IDataReader dr = db.ExecuteReader(CommandType.Text,
                                                             string.Format(UPDLOCK_LOAD_JOBS, top,
                                                                           whereClause.AppendTenantCodeSqlClause(typeof(JobBase)).ToSqlString(TSqlBuilder.Instance))))
                    {
                        ORMapping.DataReaderToCollection(result, dr);
                    }
                }

                AfterLoad(result);
            }

            return(result);
        }
        public StartWorkflowJob LoadSingleData(IConnectiveSqlClause whereClause)
        {
            StartWorkflowJob result = null;

            if (whereClause.IsEmpty == false)
            {
                using (DbContext context = DbHelper.GetDBContext(GetConnectionName()))
                {
                    using (IDataReader dr = DbHelper.RunSqlReturnDR(string.Format(SingleData_StartWorkflowJob,
                                                                                  whereClause.AppendTenantCodeSqlClause(typeof(StartWorkflowJob)).ToSqlString(TSqlBuilder.Instance)), GetConnectionName()))
                    {
                        while (dr.Read())
                        {
                            result = new StartWorkflowJob();

                            ORMapping.DataReaderToObject(dr, result);
                            break;
                        }
                    }

                    if (result != null)
                    {
                        result.InitJobBaseData(JobBaseAdapter.Instance.LoadSingleDataByJobID(whereClause));
                    }
                }
            }

            return(result);
        }
Esempio n. 3
0
        public InvalidAssigneeCollection Load(IConnectiveSqlClause builder)
        {
            InvalidAssigneeCollection result = new InvalidAssigneeCollection();

            string sql = SelectSQL;

            if (builder.IsEmpty == false)
            {
                sql = string.Format("{0} WHERE {1}",
                                    SelectSQL,
                                    builder.AppendTenantCodeSqlClause(typeof(InvalidAssignee)).ToSqlString(TSqlBuilder.Instance));
            }

            DataTable dt = DbHelper.RunSqlReturnDS(sql, this.GetConnectionName()).Tables[0];

            ORMapping.DataViewToCollection(result, dt.DefaultView);

            return(result);
        }
Esempio n. 4
0
        public JobBase LoadSingleDataByJobID(IConnectiveSqlClause whereClause)
        {
            JobBase result = null;

            if (whereClause.IsEmpty == false)
            {
                using (DbContext context = DbHelper.GetDBContext(GetConnectionName()))
                {
                    using (IDataReader dr = DbHelper.RunSqlReturnDR(string.Format(SINGLEATA_JOB,
                                                                                  whereClause.AppendTenantCodeSqlClause(typeof(JobBase)).ToSqlString(TSqlBuilder.Instance)), GetConnectionName()))
                    {
                        while (dr.Read())
                        {
                            result = new JobBase();
                            ORMapping.DataReaderToObject(dr, result);
                            break;
                        }
                    }
                }
            }

            return(result);
        }