/// <summary> /// save Data /// </summary> /// <param name="owner"></param> /// <param name="plate"></param> /// <param name="user"></param> /// <returns></returns> public CommandResult saveData(Common.BLL.Entity.GasStation.Owner owner, Common.BLL.Entity.GasStation.Plate plate, Common.BLL.Entity.GasStation.User user) //Common.BLL.Entity.GasStation.Car car, //Common.BLL.Entity.GasStation.LegalOwner legalOwner) { CommandResult result; if (null != owner && null != user) { result = BaseDAL.DBaseHelper.executeCommand(BaseDAL.Base.EnumExecuteType.procedureReader, connection, C_spSaveData, true, new KeyValuePair("@nationalCode", owner.nationalCode), new KeyValuePair("@name", owner.name), new KeyValuePair("@lastname", owner.lastname), new KeyValuePair("@birthdate", owner.birthdate), new KeyValuePair("@birthdatelocal", owner.birthdatelocal), new KeyValuePair("@gen", owner.gen), new KeyValuePair("@mobile", owner.mobile), new KeyValuePair("@address", owner.address), new KeyValuePair("@phone", owner.phone), new KeyValuePair("@plate", plate.plate), new KeyValuePair("@palteCityId", plate.plateCityId), new KeyValuePair("@palteTypeId", plate.plateTypeId), new KeyValuePair("@insertedById", user.id) ); } else { result = CommandResult.makeNullDataResult(); } return(result); }
private bool deleteCar_Plate(int carId) { bool result = false; int id, plateId; id = carId; Common.BLL.Entity.GasStation.Car model = new Common.BLL.Entity.GasStation.Car() { id = carId }; Common.BLL.Logic.GasStation.Car lCar = new Common.BLL.Logic.GasStation.Car(Common.Enum.EDatabase.GasStation); CommandResult resultCar = lCar.read(model, "id"); if (resultCar.status == BaseDAL.Base.EnumCommandStatus.success) { plateId = model.plateId; CommandResult opResult = lCar.delete(model); if (opResult.status == BaseDAL.Base.EnumCommandStatus.success) { Common.BLL.Entity.GasStation.Plate modelPlate = new Common.BLL.Entity.GasStation.Plate() { id = plateId }; Common.BLL.Logic.GasStation.Plate lPlate = new Common.BLL.Logic.GasStation.Plate(Common.Enum.EDatabase.GasStation); CommandResult resultPlate = lPlate.delete(modelPlate); if (resultPlate.status == BaseDAL.Base.EnumCommandStatus.success) { result = true; } } } return(result); }