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 void Accumulation(int t) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); int acu = dal.Get_accumulation() + t; dal.updateaccumulation(acu); }
public void RemoveHostingUnitB(HostingUnit H) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Order> order = dal.Get_Orders(); var v = from item in order where item.HostingUnitKey == H.HostingUnitKey && (item.Status == OrderStatus.mail_has_been_sent || item.Status == OrderStatus.Not_treated && item.HostingUnitKey == H.HostingUnitKey) select item; try { if (v == null) { throw new OverflowException("לא ניתן למחוק יחידת אירוח כל עוד יש הצעה הקשורה אליה במצב פתוח"); } else { dal.DeleteHostingUnit(H); } } catch (OverflowException ex) { throw ex; } catch (KeyNotFoundException ex) { throw ex; } }
public HostingUnit Host_ToHostingUnit(Host h, string name) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> HU = dal.Get_HostingUnitsList(); var V = HU.FirstOrDefault(X => X.HostingUnitName == name && X.Owner.HostKey == h.HostKey); return(V); }
public string KeyToNameHu(int key)//מקבלת מפתח של יחידת אירוח ומחזירה את השם של היחידה { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> hu = dal.Get_HostingUnitsList(); var v = hu.FirstOrDefault(X => key == X.HostingUnitKey); return(v.HostingUnitName); }
public IEnumerable <Order> UnitToOrder(HostingUnit H)//מקבלת את היחדת אירוח ומחזירה את ההזמנות ששיכות ליחדה זו { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Order> orders = dal.Get_Orders(); return((from item in orders where item.HostingUnitKey == H.HostingUnitKey select item).ToList()); }
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); }
public List <HostingUnit> Host_ToHostingUnits(Host h) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> HU = dal.Get_HostingUnitsList(); var V = from item in HU where item.Owner.HostKey == h.HostKey select item; return(V.ToList()); }
public IEnumerable <IGrouping <AreasInTheCountry, HostingUnit> > RegionOfUnit() { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> hostingUnit = dal.Get_HostingUnitsList(); var unit_area = from item in hostingUnit group item by item.Area into Ua select Ua; return(unit_area); }
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()); }
//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 List <HostingUnit> FindHostingUnit(int id) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> hostingUnits = dal.Get_HostingUnitsList(); var v = from item in hostingUnits where id == item.Owner.HostKey select item; return(v.ToList()); }
public int NumOfOrder(GuestRequest gu)//מספר ההזמנות שנשלחו ללקוח לפי דרישת לקוח { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Order> order = dal.Get_Orders(); var countOfOrder = (from item in order where gu.GuestRequestKey == item.GuestRequestKey select new { OKey = item.OrderKey }).Count(); return(countOfOrder); }
public IEnumerable <Order> DateOfcreateOrder(int sumDay) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Order> order = dal.Get_Orders(); var v = from item in order where (DateTime.Now - item.OrderDate).Days >= sumDay select item.Clone();// מתי צריך לעשות clone return(v); }
public int NumOfOrderClosed(HostingUnit hu) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Order> order = dal.Get_Orders(); var countOfClosed = (from item in order let closed = item.Status == OrderStatus.Closes_with_customer_response where hu.HostingUnitKey == item.HostingUnitKey && closed == true select item).Count(); return(countOfClosed); }
public IEnumerable <IGrouping <int, Host> > SumOfHostingunit()//צריך לשנות את הפונקציה { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> hostingUnit = dal.Get_HostingUnitsList(); var numUnit = from item in hostingUnit group item by item.Owner into unit group unit.Key by unit.Count() into count_unit select count_unit; return(numUnit); }
public void CheckStatus(Order O)//לאחר שסטטוס ההזמנה השתנה לסגירת עסקה – לא ניתן לשנות יותר את הסטטוס שלה. { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Order> order = dal.Get_Orders(); var v = order.First(o => O.OrderKey == o.OrderKey); if (v.Status == OrderStatus.נסגר_מחוסר_הענות || v.Status == OrderStatus.נסגרה_עסקה) { throw new KeyNotFoundException("אינך יכול לשנות את סטטוס הזמנתך");// צריך למצוא זריקת חריגה נכונה } }
public IEnumerable <Order> pagTokef() { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Order> orders = dal.Get_Orders(); //gets the list of orders var createResult = from item in orders //creates a list of all orders that need to be closed where item.OrderDate.AddDays(Configuration.orderValidity) < DateTime.Now && item.Status == OrderStatus.נשלח_מייל select item; return(createResult); }
public void AddHostingUnitB(HostingUnit T) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); try { dal.AddHostingUnit(T); } catch (Exception) { throw; } }
//HostingUnit public Host CheckId(int id) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <Host> hostList = dal.Get_HostList(); var H = hostList.FirstOrDefault(X => X.HostKey == id); if (H != null) { return(H); } throw new KeyNotFoundException("הת.ז לא קיימת במערכת "); }
//GuestRequest public void UpdateGuestRequestB(GuestRequest T) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); try { dal.UpdateGuestRequest(T); } catch (KeyNotFoundException) { throw; } }
public void UpdateHostingUnitB(HostingUnit T) { DAL.IDAL dal = DAL.FactoryDal.GetDal(); try { dal.UpdateHostingUnit(T); } catch (KeyNotFoundException ex) { throw ex; } }
public IEnumerable <HostingUnit> AvailableUnitList(DateTime Entry, int sumDay)//מחזירה את כל רשימת יחידות אירוח פנויות { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> hostingUnits = dal.Get_HostingUnitsList(); DateTime Release = Entry.AddDays(sumDay); var v = from item in hostingUnits where AvailableDate(item, new GuestRequest { EntryDate = Entry, ReleaseDate = Release }) select item; return(v.ToList()); }
public IEnumerable <HostingUnit> BusyUnitList(DateTime Entry, int sumDay)//בודק את הימים התפוסים { DAL.IDAL dal = DAL.FactoryDal.GetDal(); IEnumerable <HostingUnit> hostingUnits = dal.Get_HostingUnitsList(); DateTime Release = Entry.AddDays(sumDay); var v = from item in hostingUnits where (!AvailableDate(item, new GuestRequest { EntryDate = Entry, ReleaseDate = Release })) 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 AddGuestRequestB(GuestRequest T)//הוספת יחידת לקוח { DAL.IDAL dal = DAL.FactoryDal.GetDal(); try { CheckSumDay(T); CheackMail(T.MailAddress); CheackNumOfPeople(T.Adults + T.Children); AvailableUnit(T.EntryDate, (T.ReleaseDate - T.EntryDate).Days); dal.AddGuestRequest(T); } catch (Exception b) { throw b; } }