Esempio n. 1
0
        //写入微波记录
        public virtual bool CreateWaveAnnal(string waveCardId)
        {
            int timeSpan1 = int.Parse(System.Configuration.ConfigurationManager.AppSettings["Timespan"]);


            var annal = new CardAnnalSvr().GetFirst();
            var ts    = DateTime.Now - annal.CreateTime;

            if (ts.TotalSeconds <= timeSpan1)
            {
                annal.IsBreak = 0;
                new CardAnnalSvr().Update(annal);
            }


            var waveAnnal = WaveAnnanSvr.Instance.GetForID(waveCardId);

            if ((DateTime.Now - waveAnnal.CreateTime).TotalSeconds <= timeSpan1)
            {
                return(false);
            }

            var result = new WaveAnnanSvr().Save(waveCardId);

            return(true);
        }
Esempio n. 2
0
        //写入车辆出入记录
        public virtual bool CreateAnnal(string license, string imagePath, Equipment equipemnt, AreaAndEqu areaAndEqu)
        {
            var cardAnnalSvr = new CardAnnalSvr();
            var waveAnnalSvr = new WaveAnnanSvr();

            var      waveAnnal = waveAnnalSvr.GetFirst();
            TimeSpan ts        = DateTime.Now - waveAnnal.CreateTime;

            var car   = new CarSvr().GetItem(license);
            var annal = cardAnnalSvr.GetItem(license);

            if ((DateTime.Now - annal.CreateTime).TotalSeconds < 10)
            {
                return(false);
            }
            var cardAnnal = new CardAnnal
            {
                CreateTime  = DateTime.Now,
                AreaId      = areaAndEqu.AreaId,
                EquipmentId = equipemnt.EquipmentId,
                License     = license,
                ImagePath   = imagePath,
                State       = areaAndEqu.State
            };

            if (car != null || ts.TotalSeconds <= 10)
            {
                cardAnnal.IsBreak = 0;
            }
            else
            {
                cardAnnal.IsBreak = 1;
            }


            return(cardAnnalSvr.Save(cardAnnal) > 0);
        }