Example #1
0
 public CreateClient(MachineInfoDTO machine)
 {
     this._machineDTO  = machine;
     this._ipAddress   = machine.IpAddress;
     this._portNo      = machine.PortNo;
     this._machineId   = machine.MachineId;
     this._interfaceId = machine.InterfaceId;
     this._protocol    = string.IsNullOrEmpty(machine.DataCollectionProtocol) ? "RAW" : machine.DataCollectionProtocol;
     this.MName        = machine.MachineId;
 }
Example #2
0
        internal static List <MachineInfoDTO> GetTPMTrakMachine()
        {
            List <MachineInfoDTO> machines = new List <MachineInfoDTO>();
            string query = @"select machineid,IP,IPPortno,Interfaceid,DAPEnabled from MachineInformation where TPMTrakEnabled = 1";

            SqlConnection conn   = ConnectionManager.GetConnection();
            SqlCommand    cmd    = new SqlCommand(query, conn);
            SqlDataReader reader = default(SqlDataReader);

            try
            {
                reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (reader.Read())
                {
                    MachineInfoDTO machine = new MachineInfoDTO();
                    machine.MachineId              = reader["machineid"].ToString().Trim();
                    machine.IpAddress              = reader["IP"].ToString().Trim();
                    machine.PortNo                 = Int32.Parse(reader["IPPortno"].ToString().Trim());
                    machine.InterfaceId            = reader["Interfaceid"].ToString().Trim();
                    machine.DataCollectionProtocol = GetProtocol(reader["DAPEnabled"].ToString());

                    machines.Add(machine);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteErrorLog(ex.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (conn != null)
                {
                    conn.Close();
                }
            }

            return(machines);
        }