예제 #1
0
        public override void SetBasicPropertyValues()
        {
            base.SetBasicPropertyValues();

            ResourceProperty propertyValue;

            for (int i = 0; i < ListProperties.Count; i++)
            {
                propertyValue = ListProperties[i];
                switch (propertyValue.PropertyID)
                {
                //启动方式
                case PRO_STARTTYPE:
                    propertyValue.Value = StartType.ToString();
                    break;

                //是否Voip通道
                case PRO_ISVOIPCHANNEL:
                    if (StartType == 1101 ||
                        StartType == 1102 ||
                        StartType == 1103 ||
                        StartType == 1107 ||
                        StartType == 1108 ||
                        StartType == 1113)
                    {
                        propertyValue.Value = "1";
                    }
                    else
                    {
                        propertyValue.Value = "0";
                    }
                    break;

                //提示音
                case PRO_ALERTTONE:
                    int intValue = 0;
                    var value1   = ListProperties.FirstOrDefault(p => p.PropertyID == PRO_ALERTTYPE);
                    if (value1 != null)
                    {
                        int intValue1;
                        if (int.TryParse(value1.Value, out intValue1))
                        {
                            intValue = intValue1;
                            //AlertType为4的时候,取与RecordDelay的复合值
                            if (intValue1 == 2 || intValue == 4)
                            {
                                var value2 = ListProperties.FirstOrDefault(p => p.PropertyID == PRO_RECORDDELAY);
                                if (value2 != null)
                                {
                                    int intValue2;
                                    if (int.TryParse(value2.Value, out intValue2))
                                    {
                                        intValue = intValue | ((intValue2 == 1) ? 8 : 0);
                                    }
                                }
                            }
                        }
                    }
                    propertyValue.Value = intValue.ToString();
                    break;
                }
            }
        }