Exemple #1
0
 public bool SaveToRedis()
 {
     try
     {
         IDatabase    db      = RedisHelper.GetDatabase(0);
         CarTypeModel cartype = m_serializer.Deserialize <CarTypeModel>(db.HashGet("CarTypeList", model.CarTypeGuid));
         //暂不做固定车延期模板的验证(规则的匹配)
         //PermanentTemplateModel template= m_serializer.Deserialize<PermanentTemplateModel>(db.HashGet("PermanentTemplateList", model.CarTypeGuid));
         if (cartype.CarType == CarTypeEnum.MonthCar || cartype.CarType == CarTypeEnum.VIPCar)
         {
             //月卡车
             string        hashkey       = model.ParkCode + Convert.ToBase64String(Encoding.UTF8.GetBytes(model.CarNo));
             MonthCarModel monthcarmodel = new MonthCarModel()
             {
                 ProjectGuid  = model.ProjectGuid,
                 ParkCode     = model.ParkCode,
                 CarOwnerName = model.CarOwnerName,
                 Mobile       = model.Mobile,
                 CarNo        = model.CarNo,
                 CarTypeGuid  = model.CarTypeGuid,
                 //Cost= template.Amount,
                 //Units= template.Months,
                 Enable           = model.Enable,
                 Locked           = model.Locked,
                 StartDate        = model.StartDate,
                 EndDate          = model.EndDate,
                 DrivewayGuidList = model.DrivewayGuidList
             };
             return(db.HashSet("PermanentCarList", hashkey, m_serializer.Serialize(monthcarmodel)));
         }
         else if (cartype.CarType == CarTypeEnum.ValueCar)
         {
             //储值车
             string        hashkey       = model.ParkCode + Convert.ToBase64String(Encoding.UTF8.GetBytes(model.CarNo));
             ValueCarModel monthcarmodel = new ValueCarModel()
             {
                 ProjectGuid      = model.ProjectGuid,
                 ParkCode         = model.ParkCode,
                 CarOwnerName     = model.CarOwnerName,
                 Mobile           = model.Mobile,
                 CarNo            = model.CarNo,
                 CarTypeGuid      = model.CarTypeGuid,
                 Enable           = model.Enable,
                 StartDate        = model.StartDate,
                 Locked           = model.Locked,
                 Balance          = model.Balance,
                 DrivewayGuidList = model.DrivewayGuidList
             };
             return(db.HashSet("PermanentCarList", hashkey, m_serializer.Serialize(monthcarmodel)));
         }
         return(false);
     }
     catch (Exception ex)
     {
         m_logger.LogFatal(LoggerLogicEnum.DataService, "", "", "", "Fujica.com.cn.DataService.RedisCache.CardServiceRedisCache.SaveToRedis", "保存固定车数据异常", ex.ToString());
         return(false);
     }
 }
Exemple #2
0
 /// <summary>
 /// 保存月卡、贵宾卡数据到redis
 /// </summary>
 /// <param name="model"></param>
 /// <param name="m_ilogger"></param>
 /// <param name="m_serializer"></param>
 /// <returns></returns>
 public static bool SaveMonthCarToRedis(CardServiceModel model, ILogger m_ilogger, ISerializer m_serializer)
 {
     try
     {
         IDatabase    db      = RedisHelper.GetDatabase(0);
         CarTypeModel cartype = m_serializer.Deserialize <CarTypeModel>(db.HashGet("CarTypeList", model.CarTypeGuid));
         if (cartype.CarType == CarTypeEnum.MonthCar || cartype.CarType == CarTypeEnum.VIPCar)
         {
             //月卡车
             string        hashkey       = model.ParkCode + Convert.ToBase64String(Encoding.UTF8.GetBytes(model.CarNo));
             MonthCarModel monthcarmodel = new MonthCarModel()
             {
                 ProjectGuid  = model.ProjectGuid,
                 ParkCode     = model.ParkCode,
                 CarOwnerName = model.CarOwnerName,
                 Mobile       = model.Mobile,
                 CarNo        = model.CarNo,
                 CarTypeGuid  = model.CarTypeGuid,
                 //Cost= template.Amount,
                 //Units= template.Months,
                 Enable           = model.Enable,
                 Locked           = model.Locked,
                 StartDate        = model.StartDate,
                 EndDate          = model.EndDate,
                 DrivewayGuidList = model.DrivewayGuidList
             };
             db.HashSet("PermanentCarList", hashkey, m_serializer.Serialize(monthcarmodel));
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         m_ilogger.LogFatal(LoggerLogicEnum.Tools, "", model.ParkCode, model.CarNo, "Fujica.com.cn.MonitorServiceClient.PayDataManager.SaveMonthCarToRedis", "保存月卡车数据异常", ex.ToString());
         return(false);
     }
 }