示例#1
0
        public IEnumerable <IGrouping <int, Host> > GetAllHostsGruopByAmountOfHostingUnits()
        {
            Idal d = FactoryDal.getDal();

            return(from item in d.GetHosts()
                   let amount = item.amountOfHostingUnits
                                group item by amount into g
                                select g);
        }
示例#2
0
        public static Idal getDAL()
        {
            if (dal == null)
            {
                dal = new Dal_XML_imp(); //FILES
            }
            //dal = new Dal_imp();

            return(dal);
        }
示例#3
0
        private void fetchReport()
        {
            Idal dal = FactoryDal.GetDal();

            oldReport = dal.GetReport(updatedReport.ReportID);

            UpdatedReport.NewCoordinates = oldReport.LatLongLocation;
            UpdatedReport.NewTime        = oldReport.FallingTime;
            UpdatedReport.NumberOfHits   = oldReport.NumberOfBooms;
        }
示例#4
0
        public IEnumerable <Order> GetOrders()
        {
            Idal d = FactoryDal.getDal();

            if (d.GetOrders() == null)
            {
                throw new ArgumentNullException("BL: Couldn't return guests request because its list is empty");
            }
            return(d.GetOrders());
        }
示例#5
0
        public List <BankBranch> GetBankBranches()
        {
            Idal d = FactoryDal.getDal();

            if (d.GetBankBranches().Count() == 0)
            {
                throw new ArgumentNullException("BL: Couldn't return bank branches because its list is empty");
            }
            return(d.GetBankBranches());
        }
示例#6
0
        public IEnumerable <GuestRequest> GetGuests()
        {
            Idal d = FactoryDal.getDal();

            if (d.GetGuests().Count() == 0)
            {
                throw new ArgumentNullException("BL: Couldn't return guests request because its list is empty");
            }
            return(d.GetGuests());
        }
示例#7
0
        public IEnumerable <HostingUnit> GetHostingUnitCopy()
        {
            Idal d = FactoryDal.getDal();

            if (d.GetHostingUnitCopy().Count() == 0)
            {
                throw new ArgumentNullException("BL: Couldn't return hosting unit because its list is empty");
            }
            return(d.GetHostingUnitCopy());
        }
示例#8
0
        public List <Mother> SelectedMothers(String motherID)//returns list of mothers that close to specific mother
        {
            Idal          mydal           = FactoryDal.getDal();
            Mother        specificMother  = mydal.GetMothersList().ToList().Find(m => m.ID == motherID);
            List <Mother> Selectedmothers = (from mother in mydal.GetMothersList()
                                             where Distance(mother.PersonAddress, specificMother.PersonAddress) < 0.250 //checks for each mother if she close to the specific mother in a distance less than 250 meter
                                             select mother).ToList();

            return(Selectedmothers);
        }
示例#9
0
 public MyBL()
 {
     try
     {
         DataAccess = SingletonFactoryDAL.GetDal();
     }
     catch (DalFileErrorException)
     {
         throw new BlFileErrorException();
     }
 }
示例#10
0
        private bool canAddReporter()
        {
            Idal dal            = FactoryDal.GetDal();
            bool reporterExists = dal.ReporterIDExists(reporter.ReporterID);

            return
                (reporter.ReporterID != 0 &&
                 reporter.ReporterAddress != "" &&
                 reporter.ReporterAddress != null &&
                 !dal.ReporterIDExists(reporter.ReporterID));
        }
示例#11
0
文件: BL_imp.cs 项目: AmitShira/Nanny
        public void AddContract(Contract contract)
        {
            Idal mydal = FactoryDal.getDal();

            Nanny N_temp = new Nanny();

            if (mydal.getAllNannys().Find(item => item.ID == contract.NannyID) != null)
            {
                N_temp = mydal.getAllNannys().Find(item => item.ID == contract.NannyID);
                contract.SalaryPerHour  = N_temp.TariffPerHour;// updating tariff of contract according to nanny.
                contract.SalaryPerMonth = N_temp.TariffPerMonth;
            }
            else
            {
                throw new Exception("ERROR!:Nanny does not exist\n");
            }

            Child M_temp = new Child();

            if (mydal.getAllChilds().Find((item => item.ID == contract.ChildID)) != null)
            {
                M_temp = mydal.getAllChilds().Find(item => item.ID == contract.ChildID);
            }
            else
            {
                throw new Exception("ERROR!: Child does not exist\n");
            }

            if (!mydal.getAllMothers().Any(item => item.ID == M_temp.MotherID))
            {
                throw new Exception("ERROR!:Mother does not exist\n");
            }

            List <Contract> Nannys_Contracts = new List <Contract>(); // Checking if another contract can be added to specific nanny.

            Nannys_Contracts = mydal.getAllContracts().FindAll(item => item.NannyID == N_temp.ID);
            if (Nannys_Contracts.Count == N_temp.MaxKids)
            {
                throw new Exception("ERROR!:Nanny is full\n");
            }

            if (mydal.getAllContracts().Exists(item => item.MotherID == contract.MotherID))//check if the mother has more children and update if does(הנחה של אמא מול מערכת ולא מול נני)
            {
                contract.Siblings = true;
            }
            try
            {
                mydal.AddContract(contract);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#12
0
文件: BL.cs 项目: israelZ/restMeng
 public bool update_client(Client Cl)
 {
     XDal = FactorySingletonDal.getInstanceDal();
     if (XDal.update_client(Cl))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#13
0
文件: BL.cs 项目: israelZ/restMeng
 public bool update_ordered_d(Ordered_Dish Or)
 {
     XDal = FactorySingletonDal.getInstanceDal();
     if (XDal.update_ordered_d(Or))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#14
0
        private bool canSendReport()
        {
            Idal dal = FactoryDal.GetDal();

            return
                (report.NumberOfBooms != 0 &&
                 report.FallingTime != null &&
                 report.LatLongLocation != null &&
                 report.ReportID != 0 &&
                 !dal.ReportIDExists(report.ReportID) &&
                 dal.ReporterIDExists(report.ReporterID));
        }
示例#15
0
文件: BL.cs 项目: israelZ/restMeng
 public bool update_dish(Dish D)
 {
     XDal = FactorySingletonDal.getInstanceDal();
     if (XDal.update_dish(D))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#16
0
        public string TheMostWantedArea()
        {
            Idal d = FactoryDal.getDal();
            int  North = 0, South = 0, West = 0, East = 0, Center = 0;

            foreach (var item in d.GetGuests())
            {
                if (item.Area == BE.Enum.Area.North)
                {
                    North++;
                }
                if (item.Area == BE.Enum.Area.South)
                {
                    South++;
                }
                if (item.Area == BE.Enum.Area.West)
                {
                    West++;
                }
                if (item.Area == BE.Enum.Area.East)
                {
                    East++;
                }
                if (item.Area == BE.Enum.Area.Center)
                {
                    Center++;
                }
            }
            int    most = North;
            string name = "North";

            if (South > most)
            {
                most = South;
                name = "South";
            }
            if (West > most)
            {
                most = West;
                name = "West";
            }
            if (East > most)
            {
                most = East;
                name = "East";
            }
            if (Center > most)
            {
                most = Center;
                name = "Center";
            }
            return(name);
        }
示例#17
0
文件: BL.cs 项目: israelZ/restMeng
 public bool update_branch(Branch B)
 {
     XDal = FactorySingletonDal.getInstanceDal();
     if (XDal.update_branch(B))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#18
0
文件: BL.cs 项目: israelZ/restMeng
 public bool cancel_order(Order O)
 {
     XDal = FactorySingletonDal.getInstanceDal();
     if (XDal.cancel_order(O))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#19
0
        public static Idal getDal()
        {
            if (dl == null)
            {
                dl = new Dal_XML_imp();
            }


            //    dl = new Dal_imp();

            return(dl);
        }
示例#20
0
        public void AddNanny(Nanny nanny)
        {
            //logical actions
            if ((DateTime.Now.Year - nanny.NannyD_of_B.Year) < 18)
            {
                throw new Exception("We do not work with nannies under the age of 18");
            }
            //call DAL for action
            Idal mydal = FactoryDal.getDal();

            mydal.AddNanny(nanny);
        }
示例#21
0
        public void DeleteChild(Child newchild)
        {
            Contract contract = GetContractByChild(newchild);

            if (contract != null)
            {
                DeleteContract(contract);  //delete the contract with this child, if exist
            }
            Idal mydal = FactoryDal.getDal();

            mydal.DeleteChild(newchild);  //send to lower layer DAL
        }
示例#22
0
        public void DeleteNanny(Nanny Newnanny)
        {
            List <Contract> ContractOfNanny = GetContractByNanny(Newnanny);

            foreach (Contract contract in ContractOfNanny)   //delete all contracts of this nanny
            {
                DeleteContract(contract);
            }
            Idal mydal = FactoryDal.getDal();

            mydal.DeleteNanny(Newnanny);  //send to lower layer DAL
        }
示例#23
0
        public void DeleteMother(Mother newmother)
        {
            List <Child> ChildsByMother = GetChildsByMother(newmother); //get all childs of this mother

            foreach (Child child in ChildsByMother)                     //delete all childs (and their contracts)
            {
                DeleteChild(child);
            }
            Idal mydal = FactoryDal.getDal();

            mydal.DeleteMother(newmother);  //send to lower layer DAL
        }
示例#24
0
        public void DeleteNanny(Nanny n)
        {
            Idal mydal = FactoryDal.getDal();

            try
            {
                mydal.DeleteNanny(n, true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#25
0
        public void DeleteMother(Mother m)
        {
            Idal mydal = FactoryDal.getDal();

            try
            {
                mydal.DeleteMother(m, true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#26
0
        static List <Nanny> DisNannys = new List <Nanny>();//list of nannies that exist in the distance that the mother need

        public void AddChild(Child c)
        {
            Idal mydal = FactoryDal.getDal();

            try
            {
                mydal.AddChild(c);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#27
0
文件: BL_imp.cs 项目: AmitShira/Nanny
        public void UpdateNanny(Nanny nanny)
        {
            Idal mydal = FactoryDal.getDal();

            try
            {
                mydal.UpdateNanny(nanny);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#28
0
文件: BL_imp.cs 项目: AmitShira/Nanny
        public void UpdateMother(Mother mother)
        {
            Idal mydal = FactoryDal.getDal();

            try
            {
                mydal.UpdateMother(mother);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#29
0
文件: BL_imp.cs 项目: AmitShira/Nanny
        public void UpdateContract(Contract contract)
        {
            Idal mydal = FactoryDal.getDal();

            try
            {
                mydal.UpdateContract(contract);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#30
0
文件: BL_imp.cs 项目: AmitShira/Nanny
        public void UpdateChild(Child child)
        {
            Idal mydal = FactoryDal.getDal();

            try
            {
                mydal.UpdateChild(child);
            }
            catch (Exception e)
            {
                throw e;
            }
        }