public static GuestRequest Clone(this GuestRequest original) { GuestRequest target = new BE.GuestRequest(); target.GuestRequestKey = original.GuestRequestKey; target.PrivateName = original.PrivateName; target.FamilyName = original.FamilyName; target.MailAddress = original.MailAddress; target.Status = original.Status; target.RegistrationDate = original.RegistrationDate; target.EntryDate = original.EntryDate; target.ReleaseDate = original.ReleaseDate; target.area = original.area; target.type = original.type; target.Adults = original.Adults; target.Children = original.Children; target.pool = original.pool; target.jacuzzi = original.jacuzzi; target.wifi = original.wifi; target.tv = original.tv; target.garden = original.garden; target.childrensAttractions = original.childrensAttractions; target.publicTransportation = original.publicTransportation; target.view = original.view; target.smoking = original.smoking; target.roomService = original.roomService; target.snackBar = original.snackBar; return(target); }
public void updateGuestRequest(BE.GuestRequest guest) { //לשאול מרצה מה הכוונה כאן בתנאי ההוספה הזה. if (guest.GuestRequestKey == 0) //זה אומר שאין קוד ייחודי שהרי הערך לא מאותחל על ברירת מחדל { BE.Configuration.geustReqID++; //הענק לו קוד ייחודי } ////עדכון כללי כאן. //var ls = from item in ds.getGuestRequestList() // where guest.GuestRequestKey == item.GuestRequestKey // select new { item = guest }; var obj = ds.getGuestRequestList().FirstOrDefault(x => x.GuestRequestKey == guest.GuestRequestKey); if (obj != null) { obj.Status = guest.Status; } else if (obj == null) { throw new KeyNotFoundException(string.Format("מספר דרישת לקוח: {0} לא נמצא בבסיס הנתונים ", guest.GuestRequestKey)); } //אם איו מופע כנ"ל משמע שלא מצא אותו ברשימה // addGuestRequest(guest); }
public static BE.GuestRequest Clone(this BE.GuestRequest original) { BE.GuestRequest target = new BE.GuestRequest(); target.GuestRequestKey = original.GuestRequestKey; target.PrivateName = original.PrivateName; target.FamilyName = original.FamilyName; target.MailAddress = original.MailAddress; target.Status = original.Status; target.RegistrationDate = original.RegistrationDate; target.EntryDate = original.EntryDate; target.EndDate = original.EndDate; target.Type = original.Type; target.Area = original.Area; target.Adults = original.Adults; target.Children = original.Children; target.Pool = original.Pool; target.Jacuzzi = original.Jacuzzi; target.Garden = original.Garden; target.ChildrensAttractions = original.ChildrensAttractions; target.GuestRequestKey = original.GuestRequestKey; target.Hikes = original.Hikes; target.AirConditioner = original.AirConditioner; target.NumOfBeds = original.NumOfBeds; target.NumOfRooms = original.NumOfRooms; return(target); }
private void Button_Click(object sender, RoutedEventArgs e) { selected1 = status1ComboBox.SelectedItem.ToString(); selected1 = selected1.Substring(selected1.IndexOf(' ')); if (selected1 == " dealMade") { or.Status1 = BEEnum.Status.dealMade; or.OrderDate1 = DateTime.Now; try { bl.UpdateOrder(or); } catch { MessageBox.Show("this should work"); } BE.GuestRequest guesty = bl.GetGuestRequestByKey(Convert.ToInt64(guestRequestKey1Label.Content)); guesty.status1 = BEEnum.Status.dealMade; try { bl.UpdateGuestRequest(guesty); } catch { MessageBox.Show("this should work2"); } } Window HostWindow = new HostWindow(username); HostWindow.Show(); }
public GuestRequest() { InitializeComponent(); guest = new BE.GuestRequest(); this.AddGRGrid.DataContext = guest; bl = BL.FactoryBL.Instance; typeComboBox.SelectedIndex = 0; subAreaComboBox.SelectedIndex = 0; fitnessRoomComboBox.SelectedIndex = 0; synagogueComboBox.SelectedIndex = 0; jacuzziComboBox.SelectedIndex = 0; gardenComboBox.SelectedIndex = 0; poolComboBox.SelectedIndex = 0; areaComboBox.SelectedIndex = 0; childrenAttractionsComboBox.SelectedIndex = 0; poolComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Pool)); jacuzziComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Pool)); gardenComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Pool)); childrenAttractionsComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Pool)); areaComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Area)); typeComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Type)); subAreaComboBox.ItemsSource = Enum.GetValues(typeof(Enums.SubArea)); synagogueComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Pool)); fitnessRoomComboBox.ItemsSource = Enum.GetValues(typeof(Enums.Pool)); }
/// <summary> /// add order to date base /// </summary> /// <param name="order"></param> public void addOrder(BE.Order or) { BE.GuestRequest tmp = null; tmp = rGuest(or); BE.HostingUnit tmp2 = rHosting(or); int days = (tmp.ReleaseDate - tmp.EntryDate).Days; int price = (BE.Configuration.Commission * days); or.Commission = price; if (ApproveRequest(tmp, tmp2)) { //סימון במטריצה Approve(tmp, tmp2); DataSource.Orders.Add(or); } else { throw new Exception("הימים תפוסים ולא ניתן לבצע את ההזמנה"); } XMLHandler.GetXMLHandler().SaveToXML(DataSource.Orders, XMLHandler.GetXMLHandler().OrderPath); XMLHandler.GetXMLHandler().SaveToXML(DataSource.HostingUnits, XMLHandler.GetXMLHandler().HostingUnitPath); }
public void updateGuestRequest(BE.GuestRequest guest) { if (guest.GuestRequestKey == 0) //זה אומר שאין קוד ייחודי שהרי הערך לא מאותחל על ברירת מחדל- דרישות דף פרוייקט. { BE.Configuration.geustReqID++; //הענק לו קוד ייחודי } ////עדכון כללי כאן. //var ls = from item in ds.getGuestRequestList() // where guest.GuestRequestKey == item.GuestRequestKey // select new { item = guest }; //var obj = ds.getGuestRequestList().FirstOrDefault(x => x.GuestRequestKey == guest.GuestRequestKey); //if (obj != null) obj.Status = guest.Status; //else if (obj == null) //{ // throw new KeyNotFoundException(string.Format("מספר דרישת לקוח: {0} לא נמצא בבסיס הנתונים ", guest.GuestRequestKey)); //} //int itExists=(ds.getGuestRequestList().RemoveAll(x => x.GuestRequestKey == guest.GuestRequestKey)); //אם זה קיים הוא מוחק ישן ושם חדש. אם לא קיים, פשוט יוסיף אותו. ds.getGuestRequestList().RemoveAll(x => x.GuestRequestKey == guest.GuestRequestKey); addGuestRequest(guest); //אם איו מופע כנ"ל משמע שלא מצא אותו ברשימה // addGuestRequest(guest); }
public GuestWindow() { this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); SystemCommands.MaximizeWindow(this); guestRequest = new BE.GuestRequest(); WindowStartupLocation = WindowStartupLocation.CenterScreen; this.addGuestRequest.DataContext = guestRequest; myBL = FactoryBL.getBL(); this.entryDateDatePicker.DisplayDateStart = DateTime.Now; this.entryDateDatePicker.DisplayDateEnd = DateTime.Now.AddMonths(11); this.releaseDateDatePicker.DisplayDateStart = DateTime.Now; this.releaseDateDatePicker.DisplayDateEnd = DateTime.Now.AddMonths(11); this.areaComboBox.ItemsSource = System.Enum.GetValues(typeof(BE.Enum.Area)); this.poolComboBox.ItemsSource = System.Enum.GetValues(typeof(BE.Enum.Pool)); this.jacuzziComboBox.ItemsSource = System.Enum.GetValues(typeof(BE.Enum.Jacuzzi)); this.spookyComboBox.ItemsSource = System.Enum.GetValues(typeof(BE.Enum.Spooky)); this.typeComboBox.ItemsSource = System.Enum.GetValues(typeof(BE.Enum.ResortType)); this.childrensAttractionsComboBox.ItemsSource = System.Enum.GetValues(typeof(BE.Enum.ChildrensAttractions)); this.gardenComboBox.ItemsSource = System.Enum.GetValues(typeof(BE.Enum.Garden)); _myData = new Message() { message = "" }; TextBlockReview.DataContext = _myData; errorMessages = new List <string>(); }
// יצירת הזמנה private void createOrders(int idGuest) { try { List <BE.HostingUnit> listHostingUnit = bl.ReadAllHostingUnit().ToList(); BE.GuestRequest guest = bl.ReadAllGuestRequest().Where(x => x.GuestRequestKey == idGuest).FirstOrDefault(); foreach (var item in listHostingUnit) { if (check(item, guest)) { Order order = new Order(); order.GuestRequestKey = guest.GuestRequestKey; order.HostingUnitKey = item.HostingUnitKey; order.orderStatus = BE.Enums.OrderStatus.טרם_טופל; order.OrderDate = DateTime.Now; bl.CreateOrder(order); } } } catch (BE.ZimmerException a) { MessageBox.Show(a.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } }
public GRuserControlForAddOrder(BE.GuestRequest guesty, long key1, long hostkey) { InitializeComponent(); if (hebEnglish.hebrew) { hebChange(); } key2 = key1; hostkey1 = hostkey; gr = guesty; hu = bl.GetHostingUnitByKey(key2); grid1.DataContext = guesty; order = new BE.Order(); client = new SmtpClient() { Port = 587, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Host = "smtp.gmail.com", EnableSsl = true, Credentials = credentials }; }
// updateOrder function add update Order to Xml data public void updateGuestRequest(BE.GuestRequest guest) { guest = guest.Clone(); XElement oldGuest = (from guestXml in GuestRoot.Elements() where guestXml.Element("GuestRequestKey").Value == guest.GuestRequestKey.ToString() select guestXml).FirstOrDefault(); oldGuest.Element("GuestRequestKey").Value = guest.GuestRequestKey.ToString(); oldGuest.Element("PrivateName").Value = guest.PrivateName.ToString(); oldGuest.Element("FamilyName").Value = guest.FamilyName.ToString(); oldGuest.Element("Status").Value = guest.Status.ToString(); oldGuest.Element("RegistrationDate").Value = guest.RegistrationDate.ToString(); oldGuest.Element("EntryDate").Value = guest.EntryDate.ToString(); oldGuest.Element("ReleaseDate").Value = guest.ReleaseDate.ToString(); oldGuest.Element("Area").Value = guest.Area.ToString(); oldGuest.Element("Type").Value = guest.Type.ToString(); oldGuest.Element("Pool").Value = guest.Pool.ToString(); oldGuest.Element("Jacuzzi").Value = guest.Jacuzzi.ToString(); oldGuest.Element("Garden").Value = guest.Garden.ToString(); oldGuest.Element("ChildrensAttractions").Value = guest.ChildrensAttractions.ToString(); oldGuest.Element("Adults").Value = guest.Adults.ToString(); oldGuest.Element("Children").Value = guest.Children.ToString(); oldGuest.Element("MailAddress").Value = guest.MailAddress.ToString(); GuestRoot.Save(BE.Tools.GuestPath); }
public void addOrder(BE.Order order) { BE.GuestRequest tmp = rGuest(order); if (tmp == null) { throw new SomeException("לא קיים אורח כזה "); } BE.HostingUnit tmp2 = rHosting(order); if (tmp2 == null) { throw new SomeException("אין יחידת אירוח כזאת "); } if (order.Status == BE.StatusGuest.נשלח_מייל && tmp2.Owner.CollectionClearance) { order.OrderDate = DateTime.Now; } else if (tmp2.Owner.CollectionClearance == false && order.Status == BE.StatusGuest.נשלח_מייל) { throw new SomeException("איו אפשרות לשלוח מייל אם אין הרשאה לחיוב חשבון "); } else { IDAL.addOrder(order); } }
/// <summary> /// adds a guest request /// </summary> /// <param name="guest"></param> public void AddGuestRequest(BE.GuestRequest guest) { try { if (GetGuestList().Any(x => x.GuestRequestKey == guest.GuestRequestKey)) { throw new InvalidOperationException(string.Format("Guest " + guest.GuestRequestKey + " already exists")); } if (guest.EntryDate >= guest.ReleaseDate || DateTime.Now > guest.EntryDate) { throw new InvalidOperationException("Invalid date range"); } var isValid = new EmailAddressAttribute().IsValid(guest.MailAddress); if (!isValid) { throw new InvalidOperationException("invalid email address"); } guest.Status = RequestStatus.active; dalAccess.AddGuestRequest(guest); } catch (Exception e) { throw e; } }
public void SelectInvitation(BE.Order order) { List <BE.GuestRequest> allReq = _dal.GetAllRequests(); BE.GuestRequest request = null; try { // find the much guest request to the given order... request = (from gReq in allReq where gReq.GuestRequestKey == order.GuestRequestKey select gReq).Single(); // /// and update his status _dal.UpdateGuestRequest(request, BE.Enums.Status.CloseByApp); } catch (ArgumentNullException exc) { Console.WriteLine(exc.Message); } catch (InvalidOperationException exc) { Console.WriteLine(exc.Message); } // find the rest of the orders which mach to the request... IEnumerable <BE.Order> orders = from matchOrder in _dal.GetAllOrders() where matchOrder.GuestRequestKey == request.GuestRequestKey select matchOrder; // ...and close them too foreach (BE.Order matchOrder in orders) { _dal.UpdateOrder(matchOrder, BE.Enums.Status.CloseByApp); } }
/// <summary> /// add order to date base /// </summary> /// <param name="order"></param> public void addOrder(BE.Order order) { BE.GuestRequest tmp = null; tmp = rGuest(order); BE.HostingUnit tmp2 = rHosting(order); int days = (tmp.ReleaseDate - tmp.EntryDate).Days; int price = (BE.Configuration.Commission * days); if (ApproveRequest(tmp, tmp2)) { //סימון במטריצה Approve(tmp, tmp2); if (tmp2.Owner.CollectionClearance) { order.Status = BE.StatusGuest.נשלח_מייל; order.OrderDate = DateTime.Now; } DS.DataSource.Orders.Add(order); } else { throw new SomeException("הימים תפוסים ולא ניתן לבצע את ההזמנה"); } }
/// <summary> /// add GuestRequest to data base /// </summary> /// <param name="Gue"></param> public void addGuestRequest(BE.GuestRequest Gue) { // int num = r.Next(0, 3); DataSource.GuestRequests.Add(Gue); }
public GuestRequestWindow() { InitializeComponent(); double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; double windowWidth = this.Width; double windowHeight = this.Height; this.Left = (screenWidth / 2) - (windowWidth / 2); this.Top = (screenHeight / 2) - (windowHeight / 2); guest = new BE.GuestRequest(); this.GuestRequestGrid.DataContext = guest; bl = BL.FactoryBL.getBL(); this.DataContext = guest; this.areaComboBox.ItemsSource = Enum.GetValues(typeof(Enums.area)); this.Type.ItemsSource = Enum.GetValues(typeof(Enums.hostingUnitType)); this.poolComboBox.ItemsSource = Enum.GetValues(typeof(Enums.response)); this.jacuzziComboBox.ItemsSource = Enum.GetValues(typeof(Enums.response)); this.attractionComboBox.ItemsSource = Enum.GetValues(typeof(Enums.response)); MyCalendar = CreateCalendar(); vbCalendar.Child = null; vbCalendar.Child = MyCalendar; }
//שליחת מייל private void mail_click(object sender, RoutedEventArgs e) { MailMessage mail = new MailMessage(); BE.Order order = (BE.Order)((Button)sender).DataContext; string HostMail = "*****@*****.**";// BL.BL_imp.loggedInUser.Email; BE.GuestRequest guest = bl.ReadAllGuestRequest().Where(x => x.GuestRequestKey == order.GuestRequestKey).FirstOrDefault(); string GuestMail = guest.MailAddress; string PasswordMail = "hhhaaalll";//BL.BL_imp.loggedInUser.Password; mail.To.Add(GuestMail); mail.From = new MailAddress(HostMail); mail.Subject = "הצעת ארוח ממערכת גן עדן"; BE.HostingUnit hostingUnit = bl.ReadHostingUnit(order.HostingUnitKey); mail.Body = GetMailBody(guest, hostingUnit); mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential(HostMail, PasswordMail); smtp.EnableSsl = true; try { smtp.Send(mail); } catch (Exception ex) { MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } ChangeStatus(order); }
private void GuestRequestKey_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.GuestRequestKey.SelectedItem is GuestRequest) { this.guestRequest = ((GuestRequest)this.GuestRequestKey.SelectedItem); //setGuestRequestFields(); } }
public bool checkRequestDates(BE.GuestRequest guest) { if (guest.EntryDate >= guest.ReleaseDate) // check if the dates are not equal and if the relase date are not bigger then EntryDate { return(false); } return(true); }
public int OrderCount(BE.GuestRequest gReq) { IEnumerable <BE.Order> orders = from order in _dal.GetAllOrders() where order.GuestRequestKey == gReq.GuestRequestKey select order; return(orders.Count()); }
private void gComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gComboBox.SelectedIndex == -1) { return; } guestRequest = guestRequestKeys[gComboBox.SelectedIndex]; order.GuestRequestKey = guestRequest.GuestRequestKey; }
/// <summary> /// apdate GuestRequest to data base /// </summary> /// <param name="Gue"></param> public void apdateGuestRequest(BE.GuestRequest Gue) { for (int i = 0; i < DS.DataSource.GuestRequests.Count; i++) { if (DS.DataSource.GuestRequests[i].GuestRequestkey == Gue.GuestRequestkey) { DS.DataSource.GuestRequests[i] = Gue; } } }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (errorMessages.Any()) { string err = "Exception: "; foreach (var item in errorMessages) { err += item + "\n"; } MessageBox.Show(err); return; } int number; if (!int.TryParse(adultsTextBox.Text, out number) || !int.TryParse(childrenTextBox.Text, out number)) { MessageBox.Show("Please check you entered an invalid input", "warning", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (familyNameTextBox.Text == "" || privateNameTextBox.Text == "" || mailAddressTextBox.Text == "" || mailAddressTextBox.Text == "" || entryDateDatePicker.Text == "1/1/0001" || releaseDateDatePicker.Text == "1/1/0001" || adultsTextBox.Text == "" || childrenTextBox.Text == "") { MessageBox.Show($"Missing information", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } myBL.AddGuestRequest(guestRequest); MessageBox.Show($"The order was added to the system, If there is a suitable unit you will receive an email", "", MessageBoxButton.OK, MessageBoxImage.Information); familyNameTextBox.Text = ""; privateNameTextBox.Text = ""; mailAddressTextBox.Text = ""; CodeTextBox.Text = ""; entryDateDatePicker.Text = "1/1/2020"; releaseDateDatePicker.Text = "2/1/2020"; adultsTextBox.Text = ""; childrenTextBox.Text = ""; gardenComboBox.Text = null; jacuzziComboBox.Text = null; poolComboBox.Text = null; spookyComboBox.Text = null; typeComboBox.Text = null; childrensAttractionsComboBox.Text = null; areaComboBox.Text = null; guestRequest = new BE.GuestRequest(); this.addGuestRequest.DataContext = guestRequest; } catch (System.Exception exp) { MessageBox.Show(exp.Message, "", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Add Guest Request /// </summary> /// <param name="G"></param> public void AddGuestRequest(BE.GuestRequest G) { if (G.GuestRequestKey == 0) { BE.Configuration.GuestRequestKeySt++; G.GuestRequestKey = BE.Configuration.GuestRequestKeySt; } GuestRequestsList.Add(G.Copy()); SaveToXML <List <BE.GuestRequest> >(GuestRequestsList, GuestRequestsPath); SaveConfigToXml(); }
public AddGuestRequest() { InitializeComponent(); bl = MyBL.Instance; cbxArea.ItemsSource = Enum.GetNames(typeof(BE.Enums.Regions)); cbxHostingType.ItemsSource = Enum.GetValues(typeof(BE.Enums.HostingUnitType)); guestRequest = new GuestRequest(); NewRequestOfSameGuest(); DataContext = guestRequest; }
public void UpdateGuestRequest(BE.GuestRequest gRequest, BE.Enums.Status newStat) { if (!IsGuestRequestClose(gRequest)) { _dal.UpdateGuestRequest(gRequest.Clone(), newStat); } else { throw new ArgumentOutOfRangeException("can't change close Guest Request!"); } }
/// <summary> /// apdate GuestRequest to data base /// </summary> /// <param name="Gue"></param> public void apdateGuestRequest(BE.GuestRequest Gue) { for (int i = 0; i < DataSource.GuestRequests.Count; i++) { if (DataSource.GuestRequests[i].GuestRequestkey == Gue.GuestRequestkey) { DataSource.GuestRequests[i] = Gue; XMLHandler.GetXMLHandler().SaveToXML(DataSource.GuestRequests, XMLHandler.GetXMLHandler().GuestRequestPath); } } }
public Client() { InitializeComponent(); guestRequest = new BE.GuestRequest(); this.DataContext = guestRequest; areaComboBox.ItemsSource = Enum.GetValues(typeof(BE.Area)); gardenComboBox.ItemsSource = Enum.GetValues(typeof(BE.CollectionClearance)); jaccuzziComboBox.ItemsSource = Enum.GetValues(typeof(BE.CollectionClearance)); childrenAttractionComboBox.ItemsSource = Enum.GetValues(typeof(BE.CollectionClearance)); poolComboBox.ItemsSource = Enum.GetValues(typeof(BE.CollectionClearance)); }
/// <summary> /// updates a guest's last name /// </summary> /// <param name="guest"></param> /// <param name="newName"></param> public void UpdateGuestFamilyName(BE.GuestRequest guest, string newName) { try { guest.FamilyName = newName; UpdateGuestRequest(guest.Clone()); } catch (Exception e) { throw e; } }