public virtual void CopyFrom(SystemProcessThread other) { if (other != null) { this.SystemProcessThreadId = other.SystemProcessThreadId; this.TenantId = other.TenantId; this.SystemProcessId = other.SystemProcessId; this.Name = other.Name; this.SpringEntryName = other.SpringEntryName; this.Description = other.Description; this.Enabled = other.Enabled; this.Continuous = other.Continuous; this.SleepTime = other.SleepTime; this.AutoStart = other.AutoStart; this.Status = other.Status; this.Message = other.Message; this.ScheduledTime = other.ScheduledTime; this.StartRange = other.StartRange; this.EndRange = other.EndRange; this.LastSuccessfullyExecuted = other.LastSuccessfullyExecuted; this.ContinuousDelay = other.ContinuousDelay; this.IsDeleted = other.IsDeleted; this.DisplayOrder = other.DisplayOrder; this.Argument = other.Argument; this.LastUpdateDate = other.LastUpdateDate; this.ExecutionTime = other.ExecutionTime; this.EstimatedExecutionTime = other.EstimatedExecutionTime; this.ShowUpdateInLog = other.ShowUpdateInLog; } }
public SystemProcessThread UpdateSystemProcessThread(SystemProcessThread processThread) { // ISystemProcessThreadService systemProcessThreadService = IoC.Resolve<ISystemProcessThreadService>("SystemProcessThreadService"); SystemProcessThreadService systemProcessThreadService = new SystemProcessThreadService(); return systemProcessThreadService.UpdateSystemProcessThread(processThread); }
private void UpdateSystemProcessThread(SystemProcessThread systemProcessThread) { SystemProcessThread thread = processThreads.Where(x => x.SystemProcessThreadId == systemProcessThread.SystemProcessThreadId).FirstOrDefault(); thread.LastUpdateDate = DateTime.UtcNow; thread = systemProcessThread; }
private GenericServiceThread InitializeThread(SystemProcessThread serviceThread) { GenericServiceThread thread = new GenericServiceThread(serviceThread.Name,userAccountId); thread.OnExecute += new GenericServiceThread.GOEventHandler(Execute); thread.OnSetStatusMessage += new GenericServiceThread.SetStatusMessageEventHandler(thread_OnSetStatusMessage); thread.OnReportEngineState += new GenericServiceThread.ReportEngineStateEventHandler(thread_OnReportEngineState); thread.OnSetEngineState += new GenericServiceThread.SetEngineStateEventHandler(thread_OnSetEngineState); thread.Init(false, serviceThread.SleepTime, serviceThread.Enabled); return thread; }
//static void exceptionManager_ErrorLog_Handler(object sender, ExceptionManagementEventArgs e) //{ // string errorID = string.Empty; // try // { // errorID = WCFServiceContext<IMOService>.ServiceContext.LogException(e.ErrorToLog, true); // //Logging to file // ExceptionManagement exceptionManager = new ExceptionManagement(); // Log errorLog = exceptionManager.GetLog(e.ErrorToLog); // errorLog.ElmahId = errorID; // exceptionManager.LogToFile(errorLog); // } // catch (Exception ex) // { // throw ex; // } //} public void StopThread(SystemProcessThread systemProcessThread) { processThreads.Where(x => x.Name == systemProcessThread.Name).First().Enabled = false; if (_OnUpdateSystemProcess != null) { systemProcessThread.Enabled = false; systemProcessThread=_OnUpdateSystemProcess(systemProcessThread); } }
SystemProcessThread processor_OnUpdateSystemProcess(SystemProcessThread systemProcessThread) { systemProcessThread.LastUpdateDate = DateTime.UtcNow; return webClient.UpdateSystemProcessThread(systemProcessThread); }
public SystemProcessThread UpdateSystemProcessThread(SystemProcessThread entity, string connectionString) { return _iSystemProcessThreadRepository.UpdateSystemProcessThread(entity, connectionString); }
public SystemProcessThread UpdateSystemProcessThread(SystemProcessThread entity) { return _iSystemProcessThreadRepository.UpdateSystemProcessThread(entity); }
public DataTransfer<PutOutput> Update(PutInput Input) { DataTransfer<PutOutput> transer = new DataTransfer<PutOutput>(); SystemProcessThread systemprocessthreadinput = new SystemProcessThread(); SystemProcessThread systemprocessthreadoutput = new SystemProcessThread(); PutOutput output = new PutOutput(); systemprocessthreadinput.CopyFrom(Input); SystemProcessThread systemprocessthread = _iSystemProcessThreadRepository.GetSystemProcessThread(systemprocessthreadinput.SystemProcessThreadId); if (systemprocessthread != null) { systemprocessthreadoutput = _iSystemProcessThreadRepository.UpdateSystemProcessThread(systemprocessthreadinput); if (systemprocessthreadoutput != null) { output.CopyFrom(systemprocessthreadoutput); transer.IsSuccess = true; transer.Data = output; } else { transer.IsSuccess = false; transer.Errors = new string[1]; transer.Errors[0] = "Error: Could not update."; } } else { transer.IsSuccess = false; transer.Errors = new string[1]; transer.Errors[0] = "Error: Record not found."; } return transer; }
public SystemProcessThread InsertSystemProcessThread(SystemProcessThread entity) { return _iSystemProcessThreadRepository.InsertSystemProcessThread(entity); }
public virtual SystemProcessThread InsertSystemProcessThread(SystemProcessThread entity, string connectionString) { SystemProcessThread other = new SystemProcessThread(); other = entity; if (entity.IsTransient()) { string sql = @"Insert into SystemProcessThread ( [TenantId],[SystemProcessID] ,[Name] ,[SpringEntryName] ,[Description] ,[Enabled] ,[Continuous] ,[SleepTime] ,[AutoStart] ,[Status] ,[Message] ,[ScheduledTime] ,[StartRange] ,[EndRange] ,[LastSuccessfullyExecuted] ,[ContinuousDelay] ,[IsDeleted] ,[DisplayOrder] ,[Argument] ,[LastUpdateDate] ,[ExecutionTime] ,[EstimatedExecutionTime] ,[ShowUpdateInLog] ) Values ( @TenantId , @SystemProcessID , @Name , @SpringEntryName , @Description , @Enabled , @Continuous , @SleepTime , @AutoStart , @Status , @Message , @ScheduledTime , @StartRange , @EndRange , @LastSuccessfullyExecuted , @ContinuousDelay , @IsDeleted , @DisplayOrder , @Argument , @LastUpdateDate , @ExecutionTime , @EstimatedExecutionTime , @ShowUpdateInLog ); Select scope_identity()"; SqlParameter[] parameterArray = new SqlParameter[]{ new SqlParameter("@TenantId",entity.TenantId ?? (object)DBNull.Value) , new SqlParameter("@SystemProcessID",entity.SystemProcessId) , new SqlParameter("@Name",entity.Name) , new SqlParameter("@SpringEntryName",entity.SpringEntryName ?? (object)DBNull.Value) , new SqlParameter("@Description",entity.Description ?? (object)DBNull.Value) , new SqlParameter("@Enabled",entity.Enabled) , new SqlParameter("@Continuous",entity.Continuous) , new SqlParameter("@SleepTime",entity.SleepTime) , new SqlParameter("@AutoStart",entity.AutoStart) , new SqlParameter("@Status",entity.Status ?? (object)DBNull.Value) , new SqlParameter("@Message",entity.Message ?? (object)DBNull.Value) , new SqlParameter("@ScheduledTime",entity.ScheduledTime ?? (object)DBNull.Value) , new SqlParameter("@StartRange",entity.StartRange ?? (object)DBNull.Value) , new SqlParameter("@EndRange",entity.EndRange ?? (object)DBNull.Value) , new SqlParameter("@LastSuccessfullyExecuted",entity.LastSuccessfullyExecuted ?? (object)DBNull.Value) , new SqlParameter("@ContinuousDelay",entity.ContinuousDelay) , new SqlParameter("@IsDeleted",entity.IsDeleted) , new SqlParameter("@DisplayOrder",entity.DisplayOrder) , new SqlParameter("@Argument",entity.Argument ?? (object)DBNull.Value) , new SqlParameter("@LastUpdateDate",entity.LastUpdateDate ?? (object)DBNull.Value) , new SqlParameter("@ExecutionTime",entity.ExecutionTime ?? (object)DBNull.Value) , new SqlParameter("@EstimatedExecutionTime",entity.EstimatedExecutionTime ?? (object)DBNull.Value) , new SqlParameter("@ShowUpdateInLog",entity.ShowUpdateInLog ?? (object)DBNull.Value)}; var identity = SqlHelper.ExecuteScalar(string.IsNullOrEmpty(connectionString) ? this.ConnectionString : connectionString, CommandType.Text, sql, parameterArray); if (identity == DBNull.Value) throw new DataException("Identity column was null as a result of the insert operation."); return GetSystemProcessThread(Convert.ToInt32(identity),connectionString); } return entity; }
public override SystemProcessThread InsertSystemProcessThread(SystemProcessThread entity) { entity.LastUpdateDate = DateTime.UtcNow; return base.InsertSystemProcessThread(entity); }
public virtual SystemProcessThread UpdateSystemProcessThread(SystemProcessThread entity, string connectionString) { entity.LastUpdateDate = DateTime.UtcNow; string sql = @"Update SystemProcessThread set [SystemProcessID]=@SystemProcessID , [Name]=@Name , [SpringEntryName]=@SpringEntryName , [Description]=@Description , [Enabled]=@Enabled , [Continuous]=@Continuous , [SleepTime]=@SleepTime , [AutoStart]=@AutoStart , [Status]=@Status , [Message]=@Message , [ScheduledTime]=@ScheduledTime , [StartRange]=@StartRange , [EndRange]=@EndRange , [LastSuccessfullyExecuted]=@LastSuccessfullyExecuted , [ContinuousDelay]=@ContinuousDelay , [IsDeleted]=@IsDeleted , [DisplayOrder]=@DisplayOrder , [Argument]=@Argument , [LastUpdateDate]=@LastUpdateDate , [ExecutionTime]=@ExecutionTime , [EstimatedExecutionTime]=@EstimatedExecutionTime , [ShowUpdateInLog]=@ShowUpdateInLog where SystemProcessThreadID=@SystemProcessThreadID"; SqlParameter[] parameterArray = new SqlParameter[]{ new SqlParameter("@SystemProcessID",entity.SystemProcessId) , new SqlParameter("@Name",entity.Name) , new SqlParameter("@SpringEntryName",entity.SpringEntryName ?? (object)DBNull.Value) , new SqlParameter("@Description",entity.Description ?? (object)DBNull.Value) , new SqlParameter("@Enabled",entity.Enabled) , new SqlParameter("@Continuous",entity.Continuous) , new SqlParameter("@SleepTime",entity.SleepTime) , new SqlParameter("@AutoStart",entity.AutoStart) , new SqlParameter("@Status",entity.Status ?? (object)DBNull.Value) , new SqlParameter("@Message",entity.Message ?? (object)DBNull.Value) , new SqlParameter("@ScheduledTime",entity.ScheduledTime ?? (object)DBNull.Value) , new SqlParameter("@StartRange",entity.StartRange ?? (object)DBNull.Value) , new SqlParameter("@EndRange",entity.EndRange ?? (object)DBNull.Value) , new SqlParameter("@LastSuccessfullyExecuted",entity.LastSuccessfullyExecuted ?? (object)DBNull.Value) , new SqlParameter("@ContinuousDelay",entity.ContinuousDelay) , new SqlParameter("@IsDeleted",entity.IsDeleted) , new SqlParameter("@DisplayOrder",entity.DisplayOrder) , new SqlParameter("@Argument",entity.Argument ?? (object)DBNull.Value) , new SqlParameter("@LastUpdateDate",entity.LastUpdateDate ?? (object)DBNull.Value) , new SqlParameter("@ExecutionTime",entity.ExecutionTime ?? (object)DBNull.Value) , new SqlParameter("@EstimatedExecutionTime",entity.EstimatedExecutionTime ?? (object)DBNull.Value) , new SqlParameter("@ShowUpdateInLog",entity.ShowUpdateInLog ?? (object)DBNull.Value) , new SqlParameter("@SystemProcessThreadID",entity.SystemProcessThreadId)}; SqlHelper.ExecuteNonQuery(string.IsNullOrEmpty(connectionString) ? this.ConnectionString : connectionString, CommandType.Text, sql, parameterArray); return GetSystemProcessThread(entity.SystemProcessThreadId, connectionString); }
public virtual SystemProcessThread DeleteSystemProcessThread(SystemProcessThread entity) { this.DeleteSystemProcessThread(entity.SystemProcessThreadId); return entity; }
public virtual SystemProcessThread SystemProcessThreadFromDataRow(DataRow dr) { if(dr==null) return null; SystemProcessThread entity=new SystemProcessThread(); if (dr.Table.Columns.Contains("SystemProcessThreadID")) { entity.SystemProcessThreadId = (System.Int32)dr["SystemProcessThreadID"]; } if (dr.Table.Columns.Contains("SystemProcessID")) { entity.SystemProcessId = (System.Int32)dr["SystemProcessID"]; } if (dr.Table.Columns.Contains("Name")) { entity.Name = dr["Name"].ToString(); } if (dr.Table.Columns.Contains("SpringEntryName")) { entity.SpringEntryName = dr["SpringEntryName"].ToString(); } if (dr.Table.Columns.Contains("Description")) { entity.Description = dr["Description"].ToString(); } if (dr.Table.Columns.Contains("Enabled")) { entity.Enabled = (System.Boolean)dr["Enabled"]; } if (dr.Table.Columns.Contains("Continuous")) { entity.Continuous = (System.Boolean)dr["Continuous"]; } if (dr.Table.Columns.Contains("SleepTime")) { entity.SleepTime = (System.Int32)dr["SleepTime"]; } if (dr.Table.Columns.Contains("AutoStart")) { entity.AutoStart = (System.Boolean)dr["AutoStart"]; } if (dr.Table.Columns.Contains("Status")) { entity.Status = dr["Status"].ToString(); } if (dr.Table.Columns.Contains("Message")) { entity.Message = dr["Message"].ToString(); } if (dr.Table.Columns.Contains("ScheduledTime")) { entity.ScheduledTime = dr["ScheduledTime"]==DBNull.Value?(TimeSpan?)null:(TimeSpan?)dr["ScheduledTime"]; } if (dr.Table.Columns.Contains("StartRange")) { entity.StartRange = dr["StartRange"]==DBNull.Value?(System.Int32?)null:(System.Int32?)dr["StartRange"]; } if (dr.Table.Columns.Contains("EndRange")) { entity.EndRange = dr["EndRange"]==DBNull.Value?(System.Int32?)null:(System.Int32?)dr["EndRange"]; } if (dr.Table.Columns.Contains("LastSuccessfullyExecuted")) { entity.LastSuccessfullyExecuted = dr["LastSuccessfullyExecuted"]==DBNull.Value?(System.DateTime?)null:(System.DateTime?)dr["LastSuccessfullyExecuted"]; } if (dr.Table.Columns.Contains("ContinuousDelay")) { entity.ContinuousDelay = (System.Int32)dr["ContinuousDelay"]; } if (dr.Table.Columns.Contains("IsDeleted")) { entity.IsDeleted = (System.Boolean)dr["IsDeleted"]; } if (dr.Table.Columns.Contains("DisplayOrder")) { entity.DisplayOrder = dr["DisplayOrder"].ToString(); } if (dr.Table.Columns.Contains("Argument")) { entity.Argument = dr["Argument"].ToString(); } if (dr.Table.Columns.Contains("LastUpdateDate")) { entity.LastUpdateDate = dr["LastUpdateDate"]==DBNull.Value?(System.DateTime?)null:(System.DateTime?)dr["LastUpdateDate"]; } if (dr.Table.Columns.Contains("ExecutionTime")) { entity.ExecutionTime = dr["ExecutionTime"]==DBNull.Value?(System.Double?)null:(System.Double?)dr["ExecutionTime"]; } if (dr.Table.Columns.Contains("EstimatedExecutionTime")) { entity.EstimatedExecutionTime = dr["EstimatedExecutionTime"]==DBNull.Value?(System.Double?)null:(System.Double?)dr["EstimatedExecutionTime"]; } if (dr.Table.Columns.Contains("ShowUpdateInLog")) { entity.ShowUpdateInLog = dr["ShowUpdateInLog"]==DBNull.Value?(System.Boolean?)null:(System.Boolean?)dr["ShowUpdateInLog"]; } if (dr.Table.Columns.Contains("TenantId")) { entity.TenantId = dr["TenantId"]==DBNull.Value?(System.Int32?)null:(System.Int32?)dr["TenantId"]; } return entity; }