Example #1
0
        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;
                    }
                }
            }
        }
Example #2
0
        public void Accumulation(int t)
        {
            DAL.IDAL dal = DAL.FactoryDal.GetDal();
            int      acu = dal.Get_accumulation() + t;

            dal.updateaccumulation(acu);
        }
Example #3
0
        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;
            }
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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());
        }
Example #7
0
        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);
        }
Example #8
0
        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());
        }
Example #9
0
        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);
        }
Example #10
0
        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());
        }
Example #11
0
        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());
        }
Example #12
0
        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());
        }
Example #13
0
        //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);
        }
Example #14
0
        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);
        }
Example #15
0
        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());
        }
Example #16
0
        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);
        }
Example #17
0
        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);
        }
Example #18
0
        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);
        }
Example #19
0
        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);
        }
Example #20
0
        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("אינך יכול לשנות את סטטוס הזמנתך");// צריך למצוא זריקת חריגה נכונה
            }
        }
Example #21
0
        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);
        }
Example #22
0
 public void AddHostingUnitB(HostingUnit T)
 {
     DAL.IDAL dal = DAL.FactoryDal.GetDal();
     try
     {
         dal.AddHostingUnit(T);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #23
0
        //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("הת.ז לא קיימת במערכת ");
        }
Example #24
0
 //GuestRequest
 public void UpdateGuestRequestB(GuestRequest T)
 {
     DAL.IDAL dal = DAL.FactoryDal.GetDal();
     try
     {
         dal.UpdateGuestRequest(T);
     }
     catch (KeyNotFoundException)
     {
         throw;
     }
 }
Example #25
0
 public void UpdateHostingUnitB(HostingUnit T)
 {
     DAL.IDAL dal = DAL.FactoryDal.GetDal();
     try
     {
         dal.UpdateHostingUnit(T);
     }
     catch (KeyNotFoundException ex)
     {
         throw ex;
     }
 }
Example #26
0
        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());
        }
Example #27
0
        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());
        }
Example #28
0
        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);
        }
Example #29
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);
            }
        }
Example #30
0
 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;
     }
 }