/// <summary> /// 锁定 禁止出场、入场 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool LockedCard(CardServiceModel model, CarTypeEnum carType) { model.Locked = true; bool flag = false; switch (carType) { case CarTypeEnum.TempCar: flag = _TempCardExtendatabaseoperate.ToggleValue(model); break; case CarTypeEnum.MonthCar: flag = _MonthCardExtendatabaseoperate.ToggleValue(model); break; case CarTypeEnum.ValueCar: flag = _ValueCardExtendatabaseoperate.ToggleValue(model); break; case CarTypeEnum.VIPCar: flag = _MonthCardExtendatabaseoperate.ToggleValue(model); break; } //if (flag) //{ // _redisoperate.model = model; // _redisoperate.SaveToRedis(); //} return(flag); }
/// <summary> /// 设置默认车类(临时车用) /// </summary> /// <param name="guid">车类guid</param> /// <returns></returns> public bool SetDefaultCarType(string guid) { CarTypeModel model = GetCarType(guid); //设置默认值 bool flag = extendatabaseoperate.ToggleValue(model); if (!flag) { return(false); } //更新当前车场redis中所有的车类数据 List <CarTypeModel> allmodel = AllCarType(model.ParkCode, model.ProjectGuid); foreach (var item in allmodel) { if (item.Guid == guid) { item.DefaultType = true; } else { item.DefaultType = false; } //批量保存到redis redisoperate.model = item; redisoperate.SaveToRedis(); //此时不需要判断redis是否成功,因为修改时redis一定会返回false //if (!flag) //{ // break; //} } return(flag); }