コード例 #1
0
        /// <summary>
        /// Creates a device settings based on the entity.
        /// </summary>
        public static Settings.KP CreateKP(Entities.KP kpEntity, BaseTable <Entities.KPType> kpTypeTable)
        {
            if (kpEntity == null)
            {
                throw new ArgumentNullException("kpEntity");
            }

            Settings.KP kpSettings = new Settings.KP()
            {
                Number = kpEntity.KPNum
            };
            Copy(kpEntity, kpSettings, kpTypeTable);
            return(kpSettings);
        }
コード例 #2
0
        /// <summary>
        /// Copies properties from the device entity to the device settings.
        /// </summary>
        public static void Copy(Entities.KP srcKP, Settings.KP destKP, BaseTable <Entities.KPType> kpTypeTable)
        {
            if (srcKP == null)
            {
                throw new ArgumentNullException("srcKP");
            }
            if (destKP == null)
            {
                throw new ArgumentNullException("destKP");
            }

            destKP.Name = srcKP.Name;
            destKP.Dll  = kpTypeTable != null &&
                          kpTypeTable.Items.TryGetValue(srcKP.KPTypeID, out Entities.KPType kpType) ?
                          kpType.DllFileName : "";
            destKP.Address = srcKP.Address ?? 0;
            destKP.CallNum = srcKP.CallNum;
        }