Пример #1
0
        private static List <ActivityEquipment> LoadActivityEquipments(DataTable[] tables, string activityguid, string placeguid, string orgguid)
        {
            StringBuilder            errormsg   = new StringBuilder();
            List <ActivityEquipment> equipments = new List <ActivityEquipment>();

            //0:单位信息
            //1:业务类型
            for (int i = 0; i < tables.Length; i++)
            {
                DataTable table     = tables[i];
                string    tablename = table.TableName;
                if (tablename == "单位信息" || tablename == "业务类型")
                {
                    continue;
                }

                string tabname = ExcelImportHelper.TableNameConvert(table.TableName);
                string classId = ExcelImportHelper.GetEquipmentClassId(tabname);
                if (!string.IsNullOrEmpty(classId))
                {
                    List <ActivityEquipment> equs = LoadActivityEquFromTable(table, activityguid, placeguid, orgguid, classId);
                    equipments.AddRange(equs);
                }
            }
            return(equipments);
        }
        /// <summary>
        /// 创建ActivityEquipment对象
        /// </summary>
        /// <param name="dr"></param>
        /// <param name="activityguid"></param>
        /// <param name="placeguid"></param>
        /// <param name="orgguid"></param>
        /// <param name="classId"></param>
        /// <returns></returns>
        private ActivityEquipment CreateActivityEquipment(DataRow dr, string activityguid, string placeguid, string orgguid)
        {
            ActivityEquipment equ = new ActivityEquipment();

            equ.Key              = System.Guid.NewGuid().ToString();
            equ.OrgInfo.Guid     = orgguid;
            equ.ActivityGuid     = activityguid;
            equ.PlaceGuid        = placeguid;
            equ.Name             = dr["设备名称"].ToString();
            equ.EquipmentClassID = ExcelImportHelper.GetEquipmentClassId(dr["业务类型"].ToString());
            equ.EQUCount         = Int32.Parse(dr["数量"].ToString());            //设备数量
            equ.EquModel         = dr["设备型号"].ToString();                       //设备型号
            equ.SeriesNumber     = dr["设备编号"].ToString();                       //设备编号
            equ.IsMobile         = dr["移动设备"].ToString() == "是" ? true : false; //移动设备
            if (!equ.IsMobile)
            {
                equ.Longitude = double.Parse(dr["经度"].ToString());
                equ.Latitude  = double.Parse(dr["纬度"].ToString());
                equ.Address   = dr["地点"].ToString();
            }
            equ.IsStation = dr["已建站"].ToString() == "是" ? true : false;
            if (equ.IsStation)
            {
                equ.StationName = dr["已建站名称"].ToString();
                equ.StationTDI  = dr["台站编号"].ToString();
            }
            else
            {
                equ.StationName = string.Empty;
                equ.StationTDI  = string.Empty;
            }

            equ.SendFreq = double.Parse(dr["发射频率(MHz)"].ToString()); //发射频率
            if (string.IsNullOrWhiteSpace(dr["接收频率(MHz)"].ToString()))
            {
                equ.ReceiveFreq = null;//接收频率
            }
            else
            {
                equ.ReceiveFreq = double.Parse(dr["接收频率(MHz)"].ToString());//接收频率
            }

            if (string.IsNullOrEmpty(dr["备用频率(MHz)"].ToString()))
            {
                equ.SpareFreq = null;//备用频率
            }
            else
            {
                equ.SpareFreq = double.Parse(dr["备用频率(MHz)"].ToString());//接收频率
            }

            equ.IsTunable = dr["频率可调"].ToString() == "是" ? true : false;//频率可调
            if (equ.IsTunable)
            {
                if (string.IsNullOrEmpty(dr["频率范围起始(MHz)"].ToString()))
                {
                    equ.FreqRange.Little = null;//发射频率范围起始
                }
                else
                {
                    equ.FreqRange.Little = double.Parse(dr["频率范围起始(MHz)"].ToString());//发射频率范围起始
                }
                if (string.IsNullOrEmpty(dr["频率范围终止(MHz)"].ToString()))
                {
                    equ.FreqRange.Great = null;//发射频率范围终止
                }
                else
                {
                    equ.FreqRange.Great = double.Parse(dr["频率范围终止(MHz)"].ToString());//发射频率范围终止
                }
            }
            else
            {
                equ.FreqRange = new Range <double?>();
            }

            equ.Band_kHz = double.Parse(dr["波道带宽(kHz)"].ToString()); //必要带宽
            equ.Power_W  = double.Parse(dr["发射功率(W)"].ToString());   //发射功率
            EMCS.Types.EMCModulationEnum modulat;
            if (Enum.TryParse(dr["调制方式"].ToString(), out modulat))
            {
                equ.Modulation = modulat;
            }
            equ.Remark = dr["备注"].ToString();
            return(equ);
        }