public string UpdateTempCard(TempCardViewModel tmp, int id) { var tmpmodel = new TempCardModel() { tempno = id, empid = tmp.empid, tempcardno = tmp.tempcardno, IsDeleted = tmp.IsDeleted, IsActive = tmp.IsActive, // addedby = "pooja", // addedon = DateTime.Now, modifiedby = tmp.modifiedby, modifiedon = DateTime.Now }; int k = dataobj.UpdateTempCard(tmpmodel, tmpmodel.tempno); if (k == 1) { return("record added"); } else { return("record not added"); } }
public static bool Execute(string parkingCode, string guid, string carNo, DateTime beginTime, DateTime lastTime) { if (string.IsNullOrEmpty(guid) || string.IsNullOrEmpty(carNo) || beginTime == null || lastTime == null) { return(false); } ILogger m_ilogger = new Logger.Logger(); ISerializer m_serializer = new JsonSerializer(m_ilogger); RabbitMQSender m_rabbitMQ = new RabbitMQSender(m_ilogger, m_serializer); IDatabase db; db = FollowRedisHelper.GetDatabase(0); RedisValue parklotredis = db.HashGet("ParkLotList", parkingCode); if (parklotredis != RedisValue.Null) { ParkLotModel parklotmodel = m_serializer.Deserialize <ParkLotModel>(parklotredis); if (parklotmodel != null) { List <string> drivewaylist = parklotmodel.DrivewayList; //所有车道 if (drivewaylist != null) { //要广播的缴费数据 TempCardModel tempCarModel = new TempCardModel(); tempCarModel.Guid = guid; tempCarModel.CarNo = carNo; tempCarModel.BeginTime = beginTime; tempCarModel.LatestTime = lastTime; tempCarModel.HavePaid = true; foreach (var drivewayguid in drivewaylist) { DrivewayModel drivewaymodel = m_serializer.Deserialize <DrivewayModel>(db.HashGet("DrivewayList", drivewayguid)); //广播到所有出口车道 if (drivewaymodel.Type == DrivewayType.Out) { CommandEntity <TempCardModel> sendCommand = new CommandEntity <TempCardModel>() { command = BussineCommand.TempCar, idMsg = Convert.ToBase64String(Guid.NewGuid().ToByteArray()), message = tempCarModel }; if (m_rabbitMQ.SendMessageForRabbitMQ("发送缴费数据广播命令", m_serializer.Serialize(sendCommand), drivewaymodel.DeviceMacAddress, parkingCode)) { //广播成功 } } } } } } return(true); }
public string AddCard(TempCardViewModel tmp) { var tmpmodel = new TempCardModel() { empid = tmp.empid, tempcardno = tmp.tempcardno, IsDeleted = tmp.IsDeleted, IsActive = tmp.IsActive, addedby = "pooja", addedon = DateTime.Now, modifiedby = "pooja", modifiedon = DateTime.Now }; int k = dataobj.AddCardEntry(tmpmodel); if (k == 1) { return("record added"); } else { return("record not added"); } }