public HostingUnit GetGuestRequest_RrtrunHostingUnit(GuestRequest g) { foreach (var item in Dal_XML_imp.GetHostingUnitFromXml()) { if (g.Adults == item.Adults && g.Area == item.Area && g.Children == item.Children && g.ChildrensAttractions == item.ChildrensAttractions && g.Pool == item.Pool && g.Jacuzzi == item.Jacuzzi && g.Garden == item.Garden && g.SubArea == item.SubArea && g.Type == item.Type) { if (one_of_available_units(g.EntryDate, (g.ReleaseDate - g.EntryDate).Days) != null) { return(item); } else { throw new NotImplementedException("התאריכים שבחרת תפוסים אנא בחר תאריכים אחרים "); } } else { throw new NotImplementedException("אין יחידת אירוח שמתאימה לדרישה המבוקשת"); } } return(null); //לא נימצאה יחידת אירוח שתואמת לדרישות של הלקוח }
public List <HostingUnit> My_HostingUnitList() { if (Dal_XML_imp.GetHostingUnitFromXml() == null) { throw new Exception("רשימת יחידות האירוח ריקה"); } return(Dal_XML_imp.GetHostingUnitFromXml().Select(hu => (HostingUnit)hu.Clone()).ToList()); }
public HostingUnit GetName_GiveHostingUnit(string My_Name) { foreach (var item in Dal_XML_imp.GetHostingUnitFromXml()) { if (item.HostingUnitName == My_Name) { return(item); } } return(null); //השם של היחידה לא נמצא ברשימה }
public void deleteHostingUnit(HostingUnit My_HostingUnit) { var L = from item in Dal_XML_imp.GetHostingUnitFromXml() where My_HostingUnit.hosting_unit_key == item.hosting_unit_key select item; if (L == null) { throw new NotImplementedException("not found"); } else { Dal_XML_imp.RemoveHostingUnitToXml(My_HostingUnit.hosting_unit_key); --Configuration.HostingUnitKey; } }
public HostingUnit one_of_available_units(DateTime d1, int days) { bool Approved = true; foreach (var item in Dal_XML_imp.GetHostingUnitFromXml()) { for (int index = 0; index < days; index++, d1 = d1.AddDays(1)) { if (item.Diary[d1.Month - 1, d1.Day - 1] == true) { Approved = false; } } if (Approved)// היחידה פנויה { return(item); } } return(null); }