private void TryToBook() { MembersDao membersDao = new MembersDaoImpl(); MembersEntity whoBorrows = membersDao.getMemberByEmail(whoBorrowsEmail); RentRequestsEntity rentRequest = new RentRequestsEntity(); rentRequest.BoatToBorrow = boatToBorrow; //to DO deviceBorrow rentRequest.DeviceToBorrow = null; rentRequest.StartingDate = from; rentRequest.EndDate = to; rentRequest.FromWhere = fromWhere; rentRequest.ToWhere = toWhere; rentRequest.WhoBorrows = whoBorrows; rentRequest.Status = 1; dbc.RentRequests.Add(rentRequest); dbc.SaveChanges(); FeedbackMessage = "Foglalás kérés jelezve a tulajdonos felé!"; ServiceStatus = Status.OK; // it must be a method if (!string.IsNullOrEmpty(FeedbackMessage) && !string.IsNullOrWhiteSpace(FeedbackMessage)) { new PrintMessageBox(FeedbackMessage, ServiceStatus); } }
public void LoadData(string email) { this.email = email; MembersDaoImpl Members = new MembersDaoImpl(); RentRequestsDaoImpl RentRequests = new RentRequestsDaoImpl(); BoatsDaoImpl Boats = new BoatsDaoImpl(); int vaneuj = 0; foreach (var Hajok in Boats.GetAllBoatsByOwner(Members.getMemberByEmail(email))) { foreach (var Requests in RentRequests.GetAllRentRequestsByBoatToBorrow(Hajok)) { if (Requests.HowManyPersonWillTravel > 0) { vaneuj++; } } } if (vaneuj != 0) { foreach (var Hajok in Boats.GetAllBoatsByOwner(Members.getMemberByEmail(email))) { foreach (var Requests in RentRequests.GetAllRentRequestsByBoatToBorrow(Hajok)) { if (Requests.HowManyPersonWillTravel > 0) { GlobalRequest = Requests; lbNotification.Visibility = Visibility.Hidden; btAccept.Visibility = Visibility.Visible; btDecline.Visibility = Visibility.Visible; cv1.Visibility = Visibility.Visible; cv2.Visibility = Visibility.Visible; cv3.Visibility = Visibility.Visible; tbRenterEmail.Text = Requests.WhoBorrows.Email; tbRenterName.Text = Requests.WhoBorrows.MemberName; tbRenterResidency.Text = Requests.WhoBorrows.City; tbStartPlace.Text = Requests.FromWhere; tbEndPlace.Text = Requests.ToWhere; tbPeople.Text = Requests.HowManyPersonWillTravel.ToString(); tbBoatName.Text = Requests.ToWhere; dpEnd.Text = Requests.EndDate.ToString(); dpEnd.IsEnabled = false; dpStart.Text = Requests.StartingDate.ToString(); dpStart.IsEnabled = false; tbBoatName.Text = Hajok.BoatName; tbBoatPlace.Text = Hajok.WhereIsNowTheBoat; tbBoatDept.Text = Hajok.DiveDepth.ToString(); tbBoatPrice.Text = Hajok.DailyPrice.ToString(); tbBoatConsumption.Text = Hajok.Consumption.ToString(); tbBoatType.Text = Hajok.BoatType; tbBoatManpower.Text = Hajok.MaxPerson.ToString(); tbBoatSpeed.Text = Hajok.MaxSpeed.ToString(); tbBoatWidth.Text = Hajok.BoatWidth.ToString(); tbBoatLenght.Text = Hajok.BoatLength.ToString(); tbBoatYear.Text = Hajok.YearOfManufacture.ToString(); LoadUserDataService loadUserDataService = new LoadUserDataService(email); imgRenterPicture.Tag = loadUserDataService.ResponseMessage["MemberImage"]; var uri = new Uri(Convert.ToString(imgRenterPicture.Tag), UriKind.Absolute); var bitmap = new BitmapImage(uri); imgRenterPicture.Source = bitmap; LoadSelectedBoatService loadSelectedBoatService = new LoadSelectedBoatService(Convert.ToString(Requests.BoatToBorrow.BoatId)); imgBoatPicture.Source = LoadImage(loadSelectedBoatService.ResponseMessage["BoatImage"]); imgBoatPicture.Tag = loadSelectedBoatService.ResponseMessage["BoatImage"]; } } } } else { btAccept.Visibility = Visibility.Hidden; btDecline.Visibility = Visibility.Hidden; cv1.Visibility = Visibility.Hidden; cv2.Visibility = Visibility.Hidden; cv3.Visibility = Visibility.Hidden; lbNotification.Visibility = Visibility.Visible; } }