Esempio n. 1
0
 private void CheckAndDeleteRunningState(string userCode)
 {
     IList<EWebSMSAndUser_New> ltUser = SearchUnRead(userCode);
     if (ltUser != null && ltUser.Count > 0)
     {
         IList<EWebSMSInfo> ltInfo = GetInfoList(ltUser.Select(s => s.SMSInfoID).ToList());
         Dictionary<Guid, int> dicVehicleCodeAndType = new Dictionary<Guid, int>();
         foreach (var info in ltInfo)
         {
             if (info.VehicleCode.HasValue)
             {
                 if (!dicVehicleCodeAndType.ContainsKey(info.VehicleCode.Value))
                 {
                     dicVehicleCodeAndType.Add(info.VehicleCode.Value, info.Type);
                 }
             }
         }
         if (dicVehicleCodeAndType.Count > 0)
         {
             IVehicleRunningStateManager stateManger = new VehicleRunningStateManager();
             stateManger.CheckAndDelete(dicVehicleCodeAndType);
         }
     }
 }
Esempio n. 2
0
        public void ChangeToRead(Guid infoID)
        {
            EWebSMSInfo info = GetInfo(infoID);
            if (info == null)
                return;
            //using (IRepository repository = SessionManager.CreateRepository(typeof(EWebSMSAndUser)))
            //{
            //    repository.Register(typeof(EWebSMSAndUser));
            //    HQuery query = new HQuery("Update EWebSMSAndUser Set IsRead = :IsRead , ReadTime = :ReadTime Where SMSInfoID = :SMSInfoID and IsRead=" + (int)EnumIsRead.UnRead);
            //    query.Parameters.Add("IsRead", Convert.ToBoolean(EnumIsRead.Readed));
            //    query.Parameters.Add("ReadTime", DateTime.Now);
            //    query.Parameters.Add("SMSInfoID", infoID);
            //    repository.Execute(query);
            //}

            string sql = string.Format("Update gps_websmsanduser Set IsRead = {0} , ReadTime = '{1}' Where SMSInfoID = '{2}' and IsRead={3}",
              (int)EnumIsRead.Readed, DateTime.Now, infoID, (int)EnumIsRead.UnRead);
            MySqlHelper.ExecuteNonQuery(DefaultConnectionString, sql,120);

            if (info.VehicleCode.HasValue)
            {
                IVehicleRunningStateManager stateManger = new VehicleRunningStateManager();
                stateManger.CheckAndDelete(info.VehicleCode.Value, info.Type);
            }
            using (IRepository repository = SessionManager.CreateRepository(typeof(EWebSMSAndUser_New)))
            {
                repository.Register(typeof(EWebSMSAndUser_New));
                HQuery query = new HQuery("Delete From EWebSMSAndUser_New Where SMSInfoID = :SMSInfoID ");
                query.Parameters.Add("SMSInfoID", infoID);
                repository.Execute(query);
            }
        }
Esempio n. 3
0
 public void ChangeReadState(Guid id)
 {
     using (IRepository repository = SessionManager.CreateRepository(typeof(EWebSMSAndUser)))
     {
         EWebSMSAndUser entity = repository.Get<EWebSMSAndUser>(id);
         if (entity.IsRead)
             return;
         EWebSMSInfo info = GetInfo(entity.SMSInfoID);
         if (info.VehicleCode.HasValue)
         {
             IVehicleRunningStateManager stateManger = new VehicleRunningStateManager();
             stateManger.CheckAndDelete(info.VehicleCode.Value, info.Type);
         }
         
         entity.IsRead = Convert.ToBoolean((int)EnumIsRead.Readed);
         entity.ReadTime = DateTime.Now;
         repository.Update(entity);
     }
     using (IRepository repository = SessionManager.CreateRepository(typeof(EWebSMSAndUser_New)))
     {
         EWebSMSAndUser_New entity = repository.Get<EWebSMSAndUser_New>(id);
         repository.Delete(entity);
     }
 }