Exemplo n.º 1
0
 public virtual void CopyFrom(SystemProcess other)
 {
     if (other != null)
     {
         this.SystemProcessId = other.SystemProcessId;
         this.Name            = other.Name;
         this.Description     = other.Description;
         this.Enabled         = other.Enabled;
         this.DisplayOrder    = other.DisplayOrder;
         this.Ip   = other.Ip;
         this.Port = other.Port;
     }
 }
Exemplo n.º 2
0
 public SystemProcess GetSystemProcessByName(string processName)
 {
     //ISystemProcessService systemProcessService = IoC.Resolve<ISystemProcessService>("SystemProcessService");
     SystemProcessService systemProcessService = new SystemProcessService();
     DataTransfer<ControlPanel.Core.DataTransfer.SystemProcess.GetOutput> dt = systemProcessService.GetSystemProcessByName(processName);
     if (dt != null && dt.IsSuccess)
     {
         SystemProcess process=new SystemProcess();
         process.CopyFrom(dt.Data);
         return process;
     }
     return null;
 }
 public virtual SystemProcess DeleteSystemProcess(SystemProcess entity)
 {
     this.DeleteSystemProcess(entity.SystemProcessId);
     return entity;
 }
 public virtual SystemProcess UpdateSystemProcess(SystemProcess entity)
 {
     if (entity.IsTransient()) return entity;
     SystemProcess other = GetSystemProcess(entity.SystemProcessId);
     if (entity.Equals(other)) return entity;
     string sql=@"Update SystemProcess set  [Name]=@Name
                     , [Description]=@Description
                     , [Enabled]=@Enabled
                     , [DisplayOrder]=@DisplayOrder
                     , [Ip]=@Ip
                     , [Port]=@Port
                      where SystemProcessID=@SystemProcessID";
     SqlParameter[] parameterArray=new SqlParameter[]{
              new SqlParameter("@Name",entity.Name)
             , new SqlParameter("@Description",entity.Description ?? (object)DBNull.Value)
             , new SqlParameter("@Enabled",entity.Enabled)
             , new SqlParameter("@DisplayOrder",entity.DisplayOrder)
             , new SqlParameter("@Ip",entity.Ip ?? (object)DBNull.Value)
             , new SqlParameter("@Port",entity.Port ?? (object)DBNull.Value)
             , new SqlParameter("@SystemProcessID",entity.SystemProcessId)};
     SqlHelper.ExecuteNonQuery(this.ConnectionString,CommandType.Text,sql,parameterArray);
     return GetSystemProcess(entity.SystemProcessId);
 }
 public virtual SystemProcess SystemProcessFromDataRow(DataRow dr)
 {
     if(dr==null) return null;
     SystemProcess entity=new SystemProcess();
     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("Description"))
     {
     entity.Description = dr["Description"].ToString();
     }
     if (dr.Table.Columns.Contains("Enabled"))
     {
     entity.Enabled = (System.Boolean)dr["Enabled"];
     }
     if (dr.Table.Columns.Contains("DisplayOrder"))
     {
     entity.DisplayOrder = (System.Int32)dr["DisplayOrder"];
     }
     if (dr.Table.Columns.Contains("Ip"))
     {
     entity.Ip = dr["Ip"].ToString();
     }
     if (dr.Table.Columns.Contains("Port"))
     {
     entity.Port = dr["Port"]==DBNull.Value?(System.Int32?)null:(System.Int32?)dr["Port"];
     }
     return entity;
 }
 public virtual SystemProcess InsertSystemProcess(SystemProcess entity)
 {
     SystemProcess other=new SystemProcess();
     other = entity;
     if(entity.IsTransient())
     {
         string sql=@"Insert into SystemProcess ( [Name]
         ,[Description]
         ,[Enabled]
         ,[DisplayOrder]
         ,[Ip]
         ,[Port] )
         Values
         ( @Name
         , @Description
         , @Enabled
         , @DisplayOrder
         , @Ip
         , @Port );
         Select scope_identity()";
         SqlParameter[] parameterArray=new SqlParameter[]{
              new SqlParameter("@Name",entity.Name)
             , new SqlParameter("@Description",entity.Description ?? (object)DBNull.Value)
             , new SqlParameter("@Enabled",entity.Enabled)
             , new SqlParameter("@DisplayOrder",entity.DisplayOrder)
             , new SqlParameter("@Ip",entity.Ip ?? (object)DBNull.Value)
             , new SqlParameter("@Port",entity.Port ?? (object)DBNull.Value)};
         var identity=SqlHelper.ExecuteScalar(this.ConnectionString,CommandType.Text,sql,parameterArray);
         if(identity==DBNull.Value) throw new DataException("Identity column was null as a result of the insert operation.");
         return GetSystemProcess(Convert.ToInt32(identity));
     }
     return entity;
 }
Exemplo n.º 7
0
 public TaskProcessorCore(SystemProcess systemProcess, int _userAccountId)
 {
     _systemProcess = systemProcess;
     processThreads = webClient.GetSystemProcessThreadsByProcessName(_systemProcess.Name);
     userAccountId = _userAccountId;
 }
Exemplo n.º 8
0
 public TaskProcessorCore(SystemProcess systemProcess)
 {
     _systemProcess = systemProcess;
     processThreads = webClient.GetSystemProcessThreadsByProcessName(_systemProcess.Name);
 }
 public SystemProcess UpdateSystemProcess(SystemProcess entity)
 {
     return _iSystemProcessRepository.UpdateSystemProcess(entity);
 }
Exemplo n.º 10
0
 public DataTransfer<PutOutput> Update(PutInput Input)
 {
     DataTransfer<PutOutput> transer = new DataTransfer<PutOutput>();
     SystemProcess systemprocessinput = new SystemProcess();
     SystemProcess systemprocessoutput = new SystemProcess();
     PutOutput output = new PutOutput();
     systemprocessinput.CopyFrom(Input);
     SystemProcess systemprocess = _iSystemProcessRepository.GetSystemProcess(systemprocessinput.SystemProcessId);
     if (systemprocess != null)
     {
         systemprocessoutput = _iSystemProcessRepository.UpdateSystemProcess(systemprocessinput);
         if (systemprocessoutput != null)
         {
             output.CopyFrom(systemprocessoutput);
             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;
 }
Exemplo n.º 11
0
 public SystemProcess InsertSystemProcess(SystemProcess entity)
 {
     return _iSystemProcessRepository.InsertSystemProcess(entity);
 }