Example #1
0
        /// <summary>
        /// NewEquipment - creates EquipmentDto based on the values passed in
        /// </summary>
        /// <param name="category"></param>
        /// <param name="manufacturer"></param>
        /// <returns></returns>
        public static EquipmentDto NewEquipment(EquipmentCategoryDto category, string manufacturer = null)
        {
            var equipTypes = EquipmentTypes().Where(e => e.Category == category).ToArray();
            var statuses = Enum.GetValues(typeof (SIMPLDbEnums.EquipStatusEnum));
            var rand = new Random();

            var equip = new EquipmentDto();
            var sub = NewSubscriberData();
            var loc = NewLocationData();
            equip.AssociatedSubscriberId = sub.ID;
            equip.BlockedServiceList = new ServiceCollectionDto();
            equip.CPE = true;
            equip.CustomFields = new List<CustomFieldDto>();
            equip.HeadendCode = "04";
            equip.LocationId = loc.ID;
            equip.SerialNumber = GenerateEquipmentSerial(category, manufacturer);
            equip.Status = ((SIMPLDbEnums.EquipStatusEnum) statuses.GetValue(rand.Next(statuses.Length))).GetStringValue();
            equip.Type = (EquipmentTypeDto) equipTypes.GetValue(rand.Next(equipTypes.Length));
            equip.UnitAddress = rand.Next(100000000, 999999999).ToString();
            equip.VCI = rand.Next(9999).ToString();
            equip.VPI = rand.Next(9999).ToString();

            return equip;
        }
Example #2
0
        /// <summary>
        /// GenerateEquipmentSerial - generates a serial number for equipment
        /// </summary>
        /// <param name="category"></param>
        /// <param name="manufacturer"></param>
        /// <returns></returns>
        public static string GenerateEquipmentSerial(EquipmentCategoryDto category, string manufacturer = null)
        {
            var serial = string.Empty;
            var rand = new Random();
            var ontSerial = GenerateOntBaseSerialNumber();
            var ontPortSuffix = string.Empty;

            switch (category)
            {
                case EquipmentCategoryDto.CableCard:
                case EquipmentCategoryDto.DVR:
                case EquipmentCategoryDto.DigitalAdapter:
                case EquipmentCategoryDto.SetTopBox:
                    serial = string.Format("MA{0}TEST", rand.Next(10000000, 99999999));
                    break;
                case EquipmentCategoryDto.ONTDataPort:
                    ontPortSuffix = "D" + rand.Next(0, 12).ToString("00");
                    serial = ontSerial + ontPortSuffix;
                    break;
                case EquipmentCategoryDto.ONTGigePort:
                    ontPortSuffix = "G" + rand.Next(0, 12).ToString("00");
                    serial = ontSerial + ontPortSuffix;
                    break;
                case EquipmentCategoryDto.ONTHpnaPort:
                    ontPortSuffix = "H" + rand.Next(0, 12).ToString("00");
                    serial = ontSerial + ontPortSuffix;
                    break;
                case EquipmentCategoryDto.ONTMocaPort:
                    ontPortSuffix = "M" + rand.Next(0, 12).ToString("00");
                    serial = ontSerial + ontPortSuffix;
                    break;
                case EquipmentCategoryDto.ONTVdslPort:
                    ontPortSuffix = "D" + rand.Next(0, 12).ToString("00");
                    serial = ontSerial + ontPortSuffix;
                    break;
                case EquipmentCategoryDto.ONTVideoPort:
                    ontPortSuffix = "V" + rand.Next(0, 12).ToString("00");
                    serial = ontSerial + ontPortSuffix;
                    break;
                case EquipmentCategoryDto.ONTVoicePort:
                    ontPortSuffix = "P" + rand.Next(0, 12).ToString("00");
                    serial = ontSerial + ontPortSuffix;
                    break;
            }

            return serial;
        }