Ejemplo n.º 1
0
        /// <summary>
        /// 根据指定的资源类型创建一个资源对象
        /// </summary>
        /// <param name="objType">资源类型编码</param>
        /// <returns></returns>
        public static ConfigObject CreateObject(int objType)
        {
            ConfigObject configObject;

            switch (objType)
            {
            case S1110Consts.RESOURCE_MACHINE:
                configObject = new MachineObject();
                break;

            case S1110Consts.RESOURCE_LICENSESERVER:
                configObject = new LicenseServiceObject();
                break;

            case S1110Consts.RESOURCE_ALARMSERVER:
                configObject = new AlarmServerObject();
                break;

            case S1110Consts.RESOURCE_VOICESERVER:
                configObject = new VoiceServiceObject();
                break;

            case S1110Consts.RESOURCE_DATATRANSFERSERVER:
            case S1110Consts.RESOURCE_CTIHUBSERVER:
            case S1110Consts.RESOURCE_DBBRIDGE:
            case S1110Consts.RESOURCE_ALARMMONITOR:
            case S1110Consts.RESOURCE_SFTP:
            case S1110Consts.RESOURCE_SCREENSERVER:
            case S1110Consts.RESOURCE_ISASERVER:
            case S1110Consts.RESOURCE_CMSERVER:
            case S1110Consts.RESOURCE_KEYGENERATOR:
            case S1110Consts.RESOURCE_FILEOPERATOR:
            case S1110Consts.RESOURCE_SPEECHANALYSISPARAM:
            case S1110Consts.RESOURCE_RECOVERSERVER:
            case S1110Consts.RESOURCE_CAPTURESERVER:
                configObject = new ServiceObject();
                break;

            case S1110Consts.RESOURCE_STORAGEDEVICE:
                configObject = new StorageDeviceObject();
                break;

            case S1110Consts.RESOURCE_PBXDEVICE:
                configObject = new PBXDeviceObject();
                break;

            case S1110Consts.RESOURCE_CHANNEL:
                configObject = new VoiceChannelObject();
                break;

            case S1110Consts.RESOURCE_SCREENCHANNEL:
                configObject = new ChannelObject();
                break;

            case S1110Consts.RESOURCE_NETWORKCARD:
                configObject = new NetworkCardObject();
                break;

            case S1110Consts.RESOURCE_VOIPPROTOCAL:
                configObject = new VoipProtocalObject();
                break;

            case S1110Consts.RESOURCE_CONCURRENT:
                configObject = new ConcurrentObject();
                break;

            case S1110Consts.RESOURCE_CTICONNECTION:
                configObject = new CTIConnectionObject();
                break;

            case S1110Consts.RESOURCE_CTICONNECTIONGROUP:
                configObject = new CTIConnectionGroupObject();
                break;

            case S1110Consts.RESOURCE_CTICONNECTIONGROUPCOLLECTION:
                configObject = new CTIConnectionGroupCollectionObject();
                break;

            case S1110Consts.RESOURCE_DOWNLOADPARAM:
                configObject = new DownloadParamObject();
                break;

            case S1110Consts.RESOURCE_ALARMMONITORPARAM:
                configObject = new AlarmMonitorParamObject();
                break;

            case S1110Consts.RESOURCE_CTIDBBRIDGE:
                configObject = new CTIDBBServerObject();
                break;

            case S1110Consts.RESOURCE_ALARMSERVICE:
                configObject = new AlarmServiceObject();
                break;

            case S1110Consts.RESOURCE_ALARMPROCESS:
                configObject = new AlarmProcessObject();
                break;

            default:
                configObject = new ConfigObject();
                break;
            }
            configObject.ObjectType = objType;
            return(configObject);
        }
Ejemplo n.º 2
0
        public override void GetBasicPropertyValues()
        {
            base.GetBasicPropertyValues();

            ResourceProperty propertyValue;
            int  intValue;
            long longValue;

            for (int i = 0; i < ListProperties.Count; i++)
            {
                propertyValue = ListProperties[i];
                switch (propertyValue.PropertyID)
                {
                case S1110Consts.PROPERTYID_HOSTADDRESS:
                    HostAddress = propertyValue.Value;
                    break;

                case S1110Consts.PROPERTYID_HOSTNAME:
                    HostName = propertyValue.Value;
                    break;

                case S1110Consts.PROPERTYID_HOSTPORT:
                    if (int.TryParse(propertyValue.Value, out intValue))
                    {
                        HostPort = intValue;
                    }
                    break;

                case S1110Consts.PROPERTYID_CONTINENT:
                    Continent = propertyValue.Value;
                    break;

                case S1110Consts.PROPERTYID_COUNTRY:
                    Country = propertyValue.Value;
                    break;

                case S1110Consts.PROPERTYID_MODULENUMBER:
                    if (int.TryParse(propertyValue.Value, out intValue))
                    {
                        ModuleNumber = intValue;
                    }
                    break;

                case S1110Consts.PROPERTYID_ENABLEDISABLE:
                    IsEnabled = propertyValue.Value == "1";
                    break;

                case S1110Consts.PROPERTYID_MACHINE:
                    if (long.TryParse(propertyValue.Value, out longValue))
                    {
                        MachineID = longValue;
                        if (ListAllObjects != null)
                        {
                            var machine = ListAllObjects.FirstOrDefault(m => m.ObjectID == MachineID);
                            Machine = machine as MachineObject;
                        }
                    }
                    break;
                }
            }
            GetNameAndDescription();
        }