Ejemplo n.º 1
0
        public Job GetJob(string jobId)
        {
            Job    job            = null;
            string queryStatement = string.Format("SELECT TOP 1 [jobId],[jobName],[userName], [jobStatus], [jobType], [jobDescriptionPath], [jobDescription], [jobTime], [endpoints], [jobParams],[errorMsg] FROM [{0}] where cast([jobId] as nvarchar(max)) = N'{1}' ", _jobTableName, jobId);

            using (SqlCommand cmd = new SqlCommand(queryStatement, conn))
            {
                using (SqlDataReader dataReader = cmd.ExecuteReader())
                {
                    if (dataReader.Read() == true)
                    {
                        job                    = new Job();
                        job.jobId              = dataReader["jobId"].ToString();
                        job.jobName            = dataReader["jobName"].ToString();
                        job.userName           = dataReader["userName"].ToString();
                        job.jobStatus          = dataReader["jobStatus"].ToString();
                        job.jobType            = dataReader["jobType"].ToString();
                        job.jobDescriptionPath = dataReader["jobDescriptionPath"].ToString();
                        job.jobDescription     = dataReader["jobDescription"].ToString();
                        job.jobTime            = dataReader["jobTime"].ToString();
                        job.endpoints          = dataReader["endpoints"].ToString();
                        job.jobParams          = JobParams.Deserialize(System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(dataReader["jobParams"].ToString())));
                        job.errorMsg           = dataReader["errorMsg"].ToString();
                    }
                }
            }

            return(job);
        }
Ejemplo n.º 2
0
        public List <Job> GetJobList()
        {
            List <Job> jobs = new List <Job>();

            string queryStatement = string.Format("SELECT [jobId],[jobName],[userName], [jobStatus], [jobType], [jobDescriptionPath], [jobDescription], [jobTime], [endpoints], [jobParams],[errorMsg] FROM [{0}]", _jobTableName);

            using (SqlCommand cmd = new SqlCommand(queryStatement, conn))
            {
                using (SqlDataReader dataReader = cmd.ExecuteReader())
                {
                    while (dataReader.Read() == true)
                    {
                        Job job = new Job();
                        job.jobId              = dataReader["jobId"].ToString();
                        job.jobName            = dataReader["jobName"].ToString();
                        job.userName           = dataReader["userName"].ToString();
                        job.jobStatus          = dataReader["jobStatus"].ToString();
                        job.jobType            = dataReader["jobType"].ToString();
                        job.jobDescriptionPath = dataReader["jobDescriptionPath"].ToString();
                        job.jobDescription     = dataReader["jobDescription"].ToString();
                        job.jobTime            = dataReader["jobTime"].ToString();
                        job.endpoints          = dataReader["endpoints"].ToString();
                        job.jobParams          = JobParams.Deserialize(System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(dataReader["jobParams"].ToString())));
                        job.errorMsg           = dataReader["errorMsg"].ToString();
                        jobs.Add(job);
                    }
                }
            }

            return(jobs);
        }