public static bool CancelParkGrant(string grantId) { if (grantId.IsEmpty()) { throw new ArgumentNullException("grantId"); } IParkGrant factory = ParkGrantFactory.GetFactory(); IBaseCard cardFactory = BaseCardFactory.GetFactory(); IEmployeePlate plateFactory = EmployeePlateFactory.GetFactory(); using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { try { ParkGrant grant = factory.QueryByGrantId(grantId); dbOperator.BeginTransaction(); bool result = plateFactory.Delete(grant.PlateID, dbOperator); if (!result) { throw new MyException("删除车牌失败"); } result = cardFactory.Delete(grant.CardID, dbOperator); if (!result) { throw new MyException("删除卡失败"); } result = factory.Delete(grantId, dbOperator); if (!result) { throw new MyException("删除授权失败"); } dbOperator.CommitTransaction(); if (result) { OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("grantId:{0}", grantId)); } return(result); } catch { dbOperator.RollbackTransaction(); throw; } } }
public static bool Delete(string grantId) { if (grantId.IsEmpty()) { throw new ArgumentNullException("grantId"); } IParkGrant factory = ParkGrantFactory.GetFactory(); bool result = factory.Delete(grantId); if (result) { OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("recordId:{0}", grantId)); } return(result); }
public static bool Delete(string cardId, string parkingId) { if (cardId.IsEmpty()) { throw new ArgumentNullException("cardId"); } if (parkingId.IsEmpty()) { throw new ArgumentNullException("parkingId"); } IParkGrant factory = ParkGrantFactory.GetFactory(); bool result = factory.Delete(cardId, parkingId); if (result) { OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("cardId:{0},parkingId:{1}", cardId, parkingId)); } return(result); }