Beispiel #1
0
        void UpdateRow(RecordJob <T> record, int status, string action = "")
        {
            record.Retry += 1;
            var xmlObject = SerializeToXml(record.JobRecord);

            JobUtilHelper.UpdateRow(record.RecordId, xmlObject, record.Retry, status, commandJobHandler.CofigurationJob, action);
        }
Beispiel #2
0
        public IEnumerable <RecordJob <T> > GetFailedRecords()
        {
            var list = new System.Collections.Generic.List <RecordJob <T> >();

            using (var connection = GetSqlConnection())
            {
                var command = new SqlCommand(@"dbo.GS_getFaildRecords", connection);
                command.Parameters.AddWithValue("@JobId", runningJob.JobId);

                command.CommandType = System.Data.CommandType.StoredProcedure;
                connection.Open();
                var drOutput = command.ExecuteReader();

                while (drOutput.Read())
                {
                    var recordJob = new RecordJob <T>();
                    var xml       = (drOutput["ModelXml"] != Convert.DBNull) ? drOutput["ModelXml"].ToString() : null;
                    recordJob.JobId     = (drOutput["JobId"] != Convert.DBNull) ? Guid.Parse(drOutput["JobId"].ToString()) : Guid.Empty;
                    recordJob.RecordId  = (drOutput["ID"] != Convert.DBNull) ? Guid.Parse(drOutput["ID"].ToString()) : Guid.Empty;
                    recordJob.Retry     = (drOutput["Retry"] != Convert.DBNull) ? int.Parse(drOutput["Retry"].ToString()) : 0;
                    recordJob.JobRecord = DeserializeFromXml(xml);
                    list.Add(recordJob);
                }
            }
            return(list);
        }
Beispiel #3
0
        public IEnumerable <RecordJob <T> > GetRecordsById(int pageNumber, int?rowspPage, out bool hasMore)
        {
            Console.WriteLine("GetRecordsById start");
            var list = new System.Collections.Generic.List <RecordJob <T> >();

            hasMore = false;
            using (var connection = GetSqlConnection())
            {
                Console.WriteLine("GetRecordsById after get connection");
                var command = new SqlCommand(@"dbo.GS_getRecordsByJobId", connection);
                command.Parameters.AddWithValue("@JobId", runningJob.JobId);
                command.Parameters.AddWithValue("@PageNumber", pageNumber);
                if (rowspPage.HasValue)
                {
                    command.Parameters.AddWithValue("@RowspPage", rowspPage.Value);
                }

                command.CommandType = System.Data.CommandType.StoredProcedure;
                connection.Open();
                Console.WriteLine("GetRecordsById after open connection");
                var drOutput = command.ExecuteReader();
                Console.WriteLine("GetRecordsById after exec reader");
                while (drOutput.Read())
                {
                    if (!hasMore)
                    {
                        hasMore = true;
                    }

                    var recordJob = new RecordJob <T>();
                    var xml       = (drOutput["ModelXml"] != Convert.DBNull) ? drOutput["ModelXml"].ToString() : null;
                    recordJob.JobId     = (drOutput["JobId"] != Convert.DBNull) ? Guid.Parse(drOutput["JobId"].ToString()) : Guid.Empty;
                    recordJob.RecordId  = (drOutput["ID"] != Convert.DBNull) ? Guid.Parse(drOutput["ID"].ToString()) : Guid.Empty;
                    recordJob.Retry     = (drOutput["Retry"] != Convert.DBNull) ? int.Parse(drOutput["Retry"].ToString()) : 0;
                    recordJob.JobRecord = DeserializeFromXml(xml);
                    list.Add(recordJob);
                }
            }
            return(list);
        }
Beispiel #4
0
 void UpdateStatus(RecordJob <T> record, int status)
 {
     JobUtilHelper.UpdateStatus(record.RecordId, status, commandJobHandler.CofigurationJob);
 }
Beispiel #5
0
        void UpdateOnProgressRow(RecordJob <T> record, string action = "")
        {
            int status = (int)StatusRecord.OnProgress;

            UpdateStatus(record, status);
        }