public StatisticsM() { BL = new BLImp(); Packages = BL.GetAllPackages(); GetStatistics(30); }
public AdminDistributionsM() { BL = new BLImp(); OldDistributions = new List <Distribution>(BL.GetAllDistributions(x => (x.Admin.MailAddress == ((App)Application.Current).Currents.LoggedUser.GetMailAddress()) && x.IsDelivered).ToList()); NewDistributions = new List <Distribution>(BL.GetAllDistributions(x => (x.Admin.MailAddress == ((App)Application.Current).Currents.LoggedUser.GetMailAddress()) && !x.IsDelivered).ToList()); }
private void DeleteRequestButton_Click(object sender, RoutedEventArgs e) { System.Media.SystemSounds.Hand.Play(); var dialogResult = MessageBox.Show("Are you sure you want to delete the request?\nNote! This will permanently delete the request and all related Orders!", "Alert!", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { if (RequestListBox.SelectedItem == null) { return; } try { BLImp.getBL().RemoveGuestRequest(((GuestRequest)RequestListBox.SelectedItem).GuestRequestKey); Refresh(); } catch (KeyNotFoundException) { MessageBox.Show("Please select the request from the list and try again", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } catch (ChangedWhileLinkedException) { MessageBox.Show("This request cannot be deleted because there are orders linked to it,\n accept/reject offers and try again", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
public LoginM() { BL = new BLImp(); Volunteers = BL.GetAllVolunteers(); Admins = BL.GetAllAdmins(); }
public PrintPdfM(int DistributionId) { BL = new BLImp(); Distribution = BL.GetAllDistributions(d => d.DistributionId == DistributionId).First(); Packages = BL.GetAllPackages(p => p.DistributionId == DistributionId); Volunteer = BL.GetAllVolunteers(v => v.VolunteerId == Distribution.VolunteerId).First(); }
public bool IsValidAddress(Address address) { JsonAddress AddressDetails = new BLImp().GetAddressDetails(address); if (AddressDetails == null) { return(false); } return(AddressDetails.DisplayName.Contains(address.Street) && AddressDetails.DisplayName.Contains(address.City)); }
public double[] GetLocation(Address address) { JsonAddress AddressDetails = new BLImp().GetAddressDetails(address); double lat = Convert.ToDouble(AddressDetails.Latitude); double lon = Convert.ToDouble(AddressDetails.Longitude); double[] location = new double[2] { lat, lon }; return(location); }
static void Main(string[] args) { //Tester tester = new Tester(); IBL BL = new BLImp(); Address addressA1 = new Address("Jerusalem", Areas.והסביבה_ירושלים, "Hafetz Haim", 2); Admin mainAdmin = new Admin("Haim", "Klar", "0533111111", "*****@*****.**", addressA1, "0533111111", true); BL.AddAdmin(mainAdmin); Address addressV1 = new Address("Beitar", Areas.והסביבה_ירושלים, "Hafetz Haim", 6); int adminIdV1 = BL.FindClosetAdmin(addressV1.Area); Volunteer v1 = new Volunteer("Etty", "Cohen", "0533333333", "*****@*****.**", addressV1, "0533333333", adminIdV1); BL.AddVolunteer(v1); List <Admin> Admins; Console.WriteLine("Admins:\n"); Admins = BL.GetAllAdmins(); foreach (var admin in Admins) { Console.WriteLine(admin.GetFirstName()); Console.WriteLine(admin.GetLastName()); } /* * List<Volunteer> volunteers; * volunteers = BL.GetAllVolunteers(); * Console.WriteLine("Volunteers:\n"); * foreach (var volunteer in volunteers) * { * Console.WriteLine(volunteer.GetFirstName(), volunteer.GetLastName()); * } */ /*List<Admin> Admins = BL.GetAllAdmins(p => p.IsMainAdmin=true); * foreach (var a in Admins) * { * if(a.AdminId == 2) * BL.RemoveAdmin(a); * }*/ }
public RecipientsViewM() { BL = new BLImp(); Recipients = new List <Recipient>(BL.GetAllRecipients()); }
public AddDistributionM() { BL = new BLImp(); Recipients = BL.GetAllRecipients(); }
static void Main(string[] args) { IBL bl = BLImp.getBL(); GuestRequest gr = new GuestRequest { Adults = 2, Area = Enums.Area.Jerusalem, Children = 2, ChildrensAttractions = Enums.IsInterested.Uninterested, EntryDate = new DateTime(2019, 5, 2), FamilyName = "Ben Komay", Garden = Enums.IsInterested.Necessary, Jacuzzi = Enums.IsInterested.Necessary, MailAddress = "*****@*****.**", Pool = Enums.IsInterested.Possible, PrivateName = "Ellen", RegistrationDate = new DateTime(2019, 1, 12), ReleaseDate = new DateTime(2019, 7, 30), Status = Enums.RequestStatus.Open, Type = Enums.HostingUnitType.Hotel }; bl.AddGuestRequest(gr); HostingUnit hu = new HostingUnit { Area = Enums.Area.North, HostingUnitName = "Black Nose World", Diary = null, IsThereChildrensAttractions = false, IsThereGarden = true, IsThereJacuzzi = true, IsTherePool = true, NumberOfPlacesForAdults = 4, NumberOfPlacesForChildren = 1, Type = Enums.HostingUnitType.Zimmer }; Host schnorer = new Host { BankAccountNumber = 5000, BankBranchDetails = new BankBranch { BankAccountNumber = 10000, BankName = "Mizrachi", BankNumber = 100, BranchAddress = "31 Maple St.", BranchCity = "Police", BranchNumber = 1221 }, CollectionClearance = true, FamilyName = "Slaggish", HostKey = 31262, MailAddress = "*****@*****.**", PhoneNumber = "12015684586", PrivateName = "Schnorer", }; hu.Owner = schnorer; try { bl.AddHostingUnit(hu); } catch (AlreadyExistsException e) { Console.WriteLine(e.Message); } HostingUnit hu2 = new HostingUnit() { Area = Enums.Area.Jerusalem, HostingUnitName = "Black Falcon", IsThereChildrensAttractions = false, IsThereGarden = true, IsThereJacuzzi = true, IsTherePool = true, NumberOfPlacesForAdults = 3, NumberOfPlacesForChildren = 2, Owner = schnorer, Type = Enums.HostingUnitType.Hotel }; try { bl.AddHostingUnit(hu2); } catch (AlreadyExistsException e) { Console.WriteLine(e.Message); } Order o = new Order() { CreateDate = new DateTime(2019, 2, 25), GuestRequestKey = gr.GuestRequestKey, HostingUnitKey = hu2.HostingUnitKey, OrderDate = new DateTime(2019, 4, 2), Status = Enums.OrderStatus.UnTreated }; try { bl.AddOrder(o); } catch (AlreadyExistsException e) { Console.WriteLine(e.Message); } // Now let's make it fail try { bl.AddOrder(o); } w catch (AlreadyExistsException e) { Console.WriteLine(e.Message); } Console.WriteLine("available hostingunits:"); try { foreach (var i in bl.GetAllAvailableHostingUnit(new DateTime(2019, 3, 2), 60)) { Console.WriteLine(i); } } catch (ArgumentException e) { Console.WriteLine(e.Message); } Console.WriteLine("guestrequests requiring a pool:"); foreach (var i in bl.GetAllGuestRequestWhere(isGuestRequestWithPool)) { Console.WriteLine(i); } Console.WriteLine("all bank accounts:"); try { foreach (var i in bl.GetAllBankAccounts()) { Console.WriteLine(i); } } catch (NoItemsException e) { Console.WriteLine(e.Message); } Console.WriteLine("Amount of orders to the guest:"); try { Console.WriteLine(bl.GetAmountOfOrderToGuest(gr.GuestRequestKey)); } catch (NoItemsException e) { Console.WriteLine(e.Message); } }
public VolunteersViewM() { BL = new BLImp(); Volunteers = new List <Volunteer>(BL.GetAllVolunteers()); }