예제 #1
0
        /// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
        /// <param name="isNew"></param>
        public override void Valid(Boolean isNew)
        {
            // 如果没有脏数据,则不需要进行任何处理
            if (!HasDirty)
            {
                return;
            }

            if (Name.IsNullOrEmpty())
            {
                throw new ArgumentNullException(__.Name, _.Name.DisplayName + "不能为空!");
            }

            var len = _.MACs.Length;

            if (MACs != null && len > 0 && MACs.Length > len)
            {
                MACs = MACs.Substring(0, len);
            }
            //len = _.COMs.Length;
            //if (COMs != null && len > 0 && COMs.Length > len) COMs = COMs.Substring(0, len);
            len = _.DiskID.Length;
            if (DiskID != null && len > 0 && DiskID.Length > len)
            {
                DiskID = DiskID.Substring(0, len);
            }
        }
예제 #2
0
        /// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
        /// <param name="isNew"></param>
        public override void Valid(Boolean isNew)
        {
            // 如果没有脏数据,则不需要进行任何处理
            if (!HasDirty)
            {
                return;
            }

            if (SessionID.IsNullOrEmpty())
            {
                throw new ArgumentNullException(__.SessionID, _.SessionID.DisplayName + "不能为空!");
            }

            var len = _.MACs.Length;

            if (MACs != null && len > 0 && MACs.Length > len)
            {
                MACs = MACs.Substring(0, len);
            }
            len = _.COMs.Length;
            if (COMs != null && len > 0 && COMs.Length > len)
            {
                COMs = COMs.Substring(0, len);
            }

            len = _.Processes.Length;
            if (Processes != null && len > 0 && Processes.Length > len)
            {
                Processes = Processes.Substring(0, len);
            }
        }
예제 #3
0
        /// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
        /// <param name="isNew"></param>
        public override void Valid(Boolean isNew)
        {
            // 如果没有脏数据,则不需要进行任何处理
            if (!HasDirty)
            {
                return;
            }

            if (Name.IsNullOrEmpty())
            {
                throw new ArgumentNullException(__.Name, _.Name.DisplayName + "不能为空!");
            }

            var len = _.CpuID.Length;

            if (CpuID != null && len > 0 && CpuID.Length > len)
            {
                CpuID = CpuID.Substring(0, len);
            }
            len = _.Uuid.Length;
            if (Uuid != null && len > 0 && Uuid.Length > len)
            {
                Uuid = Uuid.Substring(0, len);
            }
            len = _.MachineGuid.Length;
            if (MachineGuid != null && len > 0 && MachineGuid.Length > len)
            {
                MachineGuid = MachineGuid.Substring(0, len);
            }

            len = _.MACs.Length;
            if (MACs != null && len > 0 && MACs.Length > len)
            {
                MACs = MACs.Substring(0, len);
            }
            len = _.DiskID.Length;
            if (DiskID != null && len > 0 && DiskID.Length > len)
            {
                DiskID = DiskID.Substring(0, len);
            }

            len = _.OS.Length;
            if (OS != null && len > 0 && OS.Length > len)
            {
                OS = OS.Substring(0, len);
            }

            if (Period == 0)
            {
                Period = 60;
            }
        }
예제 #4
0
        /// <summary>校验数据</summary>
        /// <param name="isNew"></param>
        public override void Valid(Boolean isNew)
        {
            // 截取部分进程字段,避免过长无法保存
            if (Processes != null && Processes.Length > 2000)
            {
                Processes = Processes.Substring(0, 1999);
            }
            if (MACs != null && MACs.Length > 200)
            {
                MACs = MACs.Substring(0, 1999);
            }
            //if (COMs != null && COMs.Length > 200) COMs = COMs.Substring(0, 199);

            base.Valid(isNew);
        }
예제 #5
0
        /// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
        /// <param name="isNew"></param>
        public override void Valid(Boolean isNew)
        {
            // 如果没有脏数据,则不需要进行任何处理
            if (!HasDirty)
            {
                return;
            }

            if (Name.IsNullOrEmpty())
            {
                throw new ArgumentNullException(__.Name, _.Name.DisplayName + "不能为空!");
            }

            var len = _.MACs.Length;

            if (MACs != null && len > 0 && MACs.Length > len)
            {
                MACs = MACs.Substring(0, len);
            }
            len = _.COMs.Length;
            if (COMs != null && len > 0 && COMs.Length > len)
            {
                COMs = COMs.Substring(0, len);
            }

            len = _.Uuid.Length;
            if (Uuid != null && len > 0 && Uuid.Length > len)
            {
                Uuid = Uuid.Substring(0, len);
            }

            len = _.MachineGuid.Length;
            if (MachineGuid != null && len > 0 && MachineGuid.Length > len)
            {
                MachineGuid = MachineGuid.Substring(0, len);
            }
        }
예제 #6
0
        void Read()
        {
            CET cet  = Db.FromId <CET>((ulong)CEToNo);
            var macs = Db.SQL <MAC>("SELECT r FROM MAC r WHERE r.CEB = ? order by r.SoD DESC, r.Idx", cet);

            string[] ad1, ad2;

            MACs.Clear();
            string SoD = "S";

            foreach (var mac in macs)
            {
                MACsElementJson abc = new MACsElementJson
                {
                    MACoNo = (long)mac.MACoNo,
                    Drm    = mac.Drm,
                    Idx    = mac.Idx,
                    SoD    = mac.SoD,

                    HPPAd = mac.HPP1Ad,
                    GPPAd = mac.GPP1Ad,

                    HSW = mac.HSW,
                    GSW = mac.GSW,
                    HWL = mac.HWL,
                    GWL = mac.GWL,

                    H1W = mac.H1W.ToString("#"),
                    G1W = mac.G1W.ToString("#"),
                    H2W = mac.H2W.ToString("#"),
                    G2W = mac.G2W.ToString("#"),
                    H3W = mac.H3W.ToString("#"),
                    G3W = mac.G3W.ToString("#"),
                    H4W = mac.H4W.ToString("#"),
                    G4W = mac.G4W.ToString("#"),
                    H5W = mac.H5W.ToString("#"),
                    G5W = mac.G5W.ToString("#"),
                    H6W = mac.H6W.ToString("#"),
                    G6W = mac.G6W.ToString("#"),
                    H7W = mac.H7W.ToString("#"),
                    G7W = mac.G7W.ToString("#"),
                };
                if (mac.SoD == "D")
                {
                    ad1 = mac.HPP1Ad.Split(' ');
                    ad2 = mac.HPP2Ad.Split(' ');

                    abc.HPPAd = $"{ad1[0]}{(ad1.Length == 1 ? "" : ad1[1].Substring(0, 1))} + {ad2[0]}{(ad2.Length == 1 ? "" : ad2[1].Substring(0, 1))}";
                    ad1       = mac.GPP1Ad.Split(' ');
                    ad2       = mac.GPP2Ad.Split(' ');
                    abc.GPPAd = $"{ad1[0]}{(ad1.Length == 1 ? "" : ad1[1].Substring(0, 1))} + {ad2[0]}{(ad2.Length == 1 ? "" : ad2[1].Substring(0, 1))}";
                    //abc.GPPAd = $"{ad1[0]}{ad1[1].Substring(0, 1)} + {ad2[0]}{ad2[1].Substring(0, 1)}";
                }
                if (abc.SoD != SoD)
                {
                    abc.Break = true;
                    SoD       = abc.SoD;
                }

                MACs.Add(abc);
            }
        }