/// <summary> /// request a UserTravel according to a predicate /// </summary> /// <param name="Id"></param> /// <returns></returns> public UserTravel RequestUserTravel(Predicate <UserTravel> pr = null) { UserTravel ret = DataSource.UserTravelList.Find(userTravel => pr(userTravel)); if (ret == null) { throw new DOBusException("no userTravel that meets these conditions!"); } if (ret.Valid == false) { throw new DOBusException("userTravel that meets these conditions is not valid"); } return(ret.GetPropertiesFrom <UserTravel, UserTravel>()); }
public void CreateUserTravel(string userName, long lineNumber, DateTime onStopTime, DateTime offStopTime) { string exception = ""; bool foundException = false; try { //userName } catch (BOBadBusIdException ex) { exception += ex.Message; foundException = true; } try { //validate lineNumber } catch (BOBadBusIdException ex) { if (!foundException) { exception += ex.Message; foundException = true; } } try { //onStopTime } catch (BOBadBusIdException ex) { if (!foundException) { exception += ex.Message; foundException = true; } } try { //OffStopTime } catch (BOBusException ex) { exception += ex.Message; foundException = true; } if (foundException) { throw new BOBusException("There is something wrong with your input." + "Please Check these things :\n" + exception); //להוסיף את האינפוט שלו עם דולר } UserTravel userTravelBO = new UserTravel(userName, lineNumber, onStopTime, offStopTime); DO.UserTravel userTravelDO = userTravelBO.GetPropertiesFrom <DO.UserTravel, BO.UserTravel>(); try { dal.CreateUserTravel(userTravelDO); } catch (DO.DOBadBusIdException ex) { throw new BODOBadBusIdException("cant create this userTravel", ex); } }