public void StatusChange(Order O) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <GuestRequest> guestRequest = dal.Get_GuestRequestList(); var gu = guestRequest.FirstOrDefault(g => O.GuestRequestKey == g.GuestRequestKey); gu.Status = OrderStatus.Closes_with_customer_response;//סטטוס ההזמנה נסגרה עסקה try { dal.UpdateGuestRequest(gu); } catch (KeyNotFoundException ex) { throw ex; } IEnumerable <Order> order = dal.Get_Orders(); foreach (var item in order) { if (gu.GuestRequestKey == item.GuestRequestKey)// צריך לבדוק שהלולואה לא אנסופית { item.Status = OrderStatus.Closes_with_customer_response; try { dal.OrderChanged(item); } catch (KeyNotFoundException ex) { throw ex; } } } }
public IEnumerable <IGrouping <int, GuestRequest> > SumOfVacationers() { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <GuestRequest> guestRequest = dal.Get_GuestRequestList(); var sum_of_Vacationers = from item in guestRequest group item by(item.Adults + item.Children) into count_person select count_person; return(sum_of_Vacationers); }
//grouping //------------------------------------------------------------------------- public IEnumerable <IGrouping <AreasInTheCountry, GuestRequest> > VacationArea() { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <GuestRequest> guestRequest = dal.Get_GuestRequestList(); var Request_With_Same_Area = from item in guestRequest group item by item.Area into groupByArea select groupByArea; return(Request_With_Same_Area); }
public IEnumerable <GuestRequest> Condition_Guest_Request(Predicate <GuestRequest> conditions)//צריך לכתוב את הפונקציה טוב יותר { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <GuestRequest> match_condition = dal.Get_GuestRequestList(); var applicable = from item in match_condition where conditions(item) select item; return(applicable); }
public IEnumerable <GuestRequest> MailwasSent()//שאילתת רשימת לקוחות שטופלו { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <GuestRequest> guestReques = dal.Get_GuestRequestList(); var V = from item in guestReques where item.Status == OrderStatus.נשלח_מייל select item; return(V.ToList()); }
public IEnumerable <GuestRequest> NoTreat()//שאילתת רשימת לקוחות שלא טופלו { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <GuestRequest> guestReques = dal.Get_GuestRequestList(); var V = from item in guestReques where item.Status == OrderStatus.לא_טופל select item; return(V.ToList()); }
public IEnumerable <GuestRequest> CloseGR()//שאילתת רשימת לקוחות שנסגרה עסקה { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <GuestRequest> guestReques = dal.Get_GuestRequestList(); var V = from item in guestReques where item.Status == OrderStatus.נסגרה_עסקה select item; return(V.ToList()); }
public int StatusDone(Order O) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); GuestRequest v = dal.Get_GuestRequestList().FirstOrDefault(g => O.GuestRequestKey == g.GuestRequestKey); if (O.Status == OrderStatus.Closes_with_customer_response) { if (v != null) { return((v.ReleaseDate - v.EntryDate).Days * SiteOwner.Commission); } } return(0); }
public void BusyDate(Order O) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); GuestRequest guestRequest = dal.Get_GuestRequestList().FirstOrDefault(g => O.GuestRequestKey == g.GuestRequestKey); HostingUnit hostingUnit = dal.Get_HostingUnitsList().FirstOrDefault(g => O.HostingUnitKey == g.HostingUnitKey); DateTime Date = guestRequest.EntryDate; while (Date < guestRequest.ReleaseDate) { int day = Date.Day; int month = Date.Month; hostingUnit.Diary[day, month] = true; Date.AddDays(1); } }
public void AddOrderB(Order O) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> hostingUnit = dal.Get_HostingUnitsList(); var H = hostingUnit.FirstOrDefault(X => O.HostingUnitKey == X.HostingUnitKey); IEnumerable <GuestRequest> guestReques = dal.Get_GuestRequestList(); var G = guestReques.First(Y => O.GuestRequestKey == Y.GuestRequestKey); if (H == null) { throw new OverflowException("?????? לא תקינה"); } if (G == null) { throw new OverflowException("דרישת האירוח לא תקינה"); } dal.AddOrder(O); if (!AvailableDate(H, G)) { throw new OverflowException("שלח בקשת אירוח"); } }
public IEnumerable <GuestRequest> Get_GuestRequestListB() { DAL.IDAL dal = DAL.FactoryDal.GetDal(); return(dal.Get_GuestRequestList()); }
public IEnumerable <IGrouping <AreasInTheCountry, GuestRequest> > VacationArea()//קיבוץ לקוחות לפי תת אדור { IEnumerable <GuestRequest> guestRequest = dal.Get_GuestRequestList(); var Request_With_Same_Area = from item in guestRequest group item by item.Area into groupByArea select groupByArea; return(Request_With_Same_Area); }