Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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());
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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());
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
        public IEnumerable <string> NameOfUnit(Host HO)//מקבץ לי שמות יחדות אירוח לפי מספר זהות של המארח
        {
            DAL.IDAL dal = DAL.FactoryDal.GetDal();
            IEnumerable <HostingUnit> hostingUnit = dal.Get_HostingUnitsList();
            var unit_Name = from item in hostingUnit
                            where item.Owner.HostKey == HO.HostKey
                            select item.HostingUnitName;

            foreach (var item in unit_Name)
            {
                if (unit_Name.ToList() == null)
                {
                    throw new KeyNotFoundException("אין יחידות אירוח למארח זה במערכת ");
                }
            }
            return(unit_Name.ToList());
        }
Ejemplo n.º 11
0
        //public void Signed_bank_debit_authoization(GuestRequest x)// הסטטוס של הזזמנת הלקוח תהיה לפי אם הוא חתם על הרשאת גישה עבור חשבון בנק
        //{
        //    try
        //    {
        //        if (x.Its_Signed == true)
        //            x.Status = OrderStatus.נשלח_מייל;
        //        else
        //        {
        //            throw new OverflowException("לא חתמתה על השראת גישה לחיוב חשבון הבנק");//איזה סוג של  זריקת חריגה צריך פה???
        //        }
        //    }
        //    catch (OverflowException a)
        //    {
        //        throw a;
        //    }
        //}
        #endregion

        #region GuestRequest
        public bool AvailableUnit(DateTime Entry, int sumDay)//בודק אם יש תאריכים פונים לדרישת לקוח
        {
            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;

            foreach (var item in v)
            {
                if (v.ToList() == null)
                {
                    throw new OverflowException("כל יחידות האירוח תפוסות בתאריכים אילו");
                }
            }
            return(true);
        }
Ejemplo n.º 12
0
        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("שלח בקשת אירוח");
            }
        }
Ejemplo n.º 13
0
 public IEnumerable <HostingUnit> Get_HostingUnitsListB()
 {
     DAL.IDAL dal = DAL.FactoryDal.GetDal();
     return(dal.Get_HostingUnitsList());
 }
Ejemplo n.º 14
0
 public IEnumerable <HostingUnit> Get_HostingUnitsListB()//מחזיר רשימת של יחידות אירוח
 {
     DAL.IDAL dal = DAL.FactoryDal.GetDal();
     return(dal.Get_HostingUnitsList());
 }