Beispiel #1
0
        //将报警信息存入数据库
        public decimal SaveAlarmList(qw_alarmmemorylocationdatas alarmlist, string OutMapID)
        {
            Entities db       = new Entities();
            decimal  outmapid = 0;

            decimal.TryParse(OutMapID, out outmapid);
            bool isnullstr = false;
            qw_alarmmemorylocationdatas ta = db.qw_alarmmemorylocationdatas.Where(a => a.id == outmapid).FirstOrDefault();

            if (ta == null)
            {
                ta        = new qw_alarmmemorylocationdatas();
                isnullstr = true;
            }

            ta.longitude      = alarmlist.longitude == null ? 0 : (double)alarmlist.longitude;
            ta.latitude       = alarmlist.latitude == null ? 0 : (double)alarmlist.latitude;
            ta.speed          = alarmlist.speed == null ? 0 : (double)alarmlist.speed;
            ta.gpstime        = alarmlist.gpstime;
            ta.createtime     = DateTime.Now;
            ta.alarmendtime   = alarmlist.alarmendtime;
            ta.alarmstrattime = alarmlist.alarmstrattime;
            ta.alarmtype      = alarmlist.alarmtype;
            ta.userid         = alarmlist.userid;
            ta.state          = 0;

            if (isnullstr)
            {
                db.qw_alarmmemorylocationdatas.Add(ta);
            }

            db.SaveChanges();
            return(ta.id);
        }
Beispiel #2
0
        //将报警信息存入数据库
        public void SaveAlarmList(AlarmList alarmlist)
        {
            List <qw_alarmmemorylocationdatas> list = GetAllLiat().Where(a => a.userid == alarmlist.USERID && a.alarmstrattime == alarmlist.ALARMSTRATTIME && a.alarmtype == 3).ToList();

            if (list.Count == 0)
            {
                qw_alarmmemorylocationdatas ta = new qw_alarmmemorylocationdatas();
                //ta.id = AlarmListBLL.GetNewAlarmListID();
                ta.longitude = alarmlist.LONGITUDE == null ? 0 : (double)alarmlist.LONGITUDE;
                ta.latitude  = alarmlist.LATITUDE == null ? 0 : (double)alarmlist.LATITUDE;
                //ta.X = alarmlist.X2000 == null ? 0 : (decimal)alarmlist.X2000;
                //ta.Y = alarmlist.Y2000 == null ? 0 : (decimal)alarmlist.Y2000;
                ta.speed          = alarmlist.SPEED == null ? 0 : (double)alarmlist.SPEED;
                ta.gpstime        = alarmlist.GPSTIME;
                ta.createtime     = DateTime.Now;
                ta.alarmendtime   = alarmlist.ALARMENDTIME;
                ta.alarmstrattime = alarmlist.ALARMSTRATTIME;
                ta.alarmtype      = alarmlist.ALARMTYPE;
                ta.userid         = alarmlist.USERID;
                ta.state          = 0;
                AddTeamMemoryLocationData(ta);
            }
            else
            {
                XGSaveAlarmList(alarmlist);
            }
        }
Beispiel #3
0
 /// <summary>
 /// 修改审核状态
 /// </summary>
 /// <param name="id"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public int EditAlarmDetailReview(int id, int type)
 {
     using (Entities db = new Entities())
     {
         qw_alarmmemorylocationdatas model = db.qw_alarmmemorylocationdatas.FirstOrDefault(a => a.id == id);
         if (model != null)
         {
             model.state = type;
         }
         return(db.SaveChanges());
     }
 }
Beispiel #4
0
        /// <summary>
        ///   修改离线报警
        /// </summary>
        /// <param name="family"></param>
        /// <returns></returns>
        public int EditTeamMemoryLocationData(qw_alarmmemorylocationdatas va)
        {
            Entities db = new Entities();
            qw_alarmmemorylocationdatas al = db.qw_alarmmemorylocationdatas.Where(t => t.id == va.id).FirstOrDefault();

            if (al != null)
            {
                al.alarmendtime = va.alarmendtime;
                al.createtime   = va.createtime;
            }
            return(db.SaveChanges());
        }
Beispiel #5
0
        /// <summary>
        /// 添加30分钟停留超时报警记录
        /// </summary>
        /// <param name="family"></param>
        /// <returns></returns>
        public int AddTeamMemoryLocationData(qw_alarmmemorylocationdatas va)
        {
            Entities db = new Entities();
            int      al = db.qw_alarmmemorylocationdatas.Where(t => t.alarmstrattime == va.alarmstrattime && t.alarmendtime == va.alarmendtime && t.userid == va.userid && t.alarmtype == va.alarmtype).Count();

            if (al == 0)
            {
                va.createtime = DateTime.Now;
                db.qw_alarmmemorylocationdatas.Add(va);
            }
            return(db.SaveChanges());
        }
Beispiel #6
0
 /// <summary>
 /// 提交申诉
 /// </summary>
 /// <param name="id"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public int SubmitAlarmDetailAppeals(AlarmDetailModel model)
 {
     using (Entities db = new Entities())
     {
         qw_alarmmemorylocationdatas qwmodel = db.qw_alarmmemorylocationdatas.FirstOrDefault(a => a.id == model.id);
         if (qwmodel != null)
         {
             qwmodel.isallege     = model.isallege;
             qwmodel.allegereason = model.allegereason;
             qwmodel.allegetime   = DateTime.Now;
         }
         return(db.SaveChanges());
     }
 }
Beispiel #7
0
 /// <summary>
 /// 修改申诉审核
 /// </summary>
 /// <param name="id"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public int EditAlarmDetailAppeals(AlarmDetailModel model)
 {
     using (Entities db = new Entities())
     {
         qw_alarmmemorylocationdatas qwmodel = db.qw_alarmmemorylocationdatas.FirstOrDefault(a => a.id == model.id);
         if (qwmodel != null)
         {
             qwmodel.appeals    = model.appeals;
             qwmodel.content    = model.content;
             qwmodel.dealtime   = DateTime.Now;
             qwmodel.dealuserid = model.dealuserid;
         }
         return(db.SaveChanges());
     }
 }