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); }
public static Idal getDAL() { if (dal == null) { dal = new Dal_XML_imp(); //FILES } //dal = new Dal_imp(); return(dal); }
private void fetchReport() { Idal dal = FactoryDal.GetDal(); oldReport = dal.GetReport(updatedReport.ReportID); UpdatedReport.NewCoordinates = oldReport.LatLongLocation; UpdatedReport.NewTime = oldReport.FallingTime; UpdatedReport.NumberOfHits = oldReport.NumberOfBooms; }
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()); }
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()); }
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()); }
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()); }
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); }
public MyBL() { try { DataAccess = SingletonFactoryDAL.GetDal(); } catch (DalFileErrorException) { throw new BlFileErrorException(); } }
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)); }
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; } }
public bool update_client(Client Cl) { XDal = FactorySingletonDal.getInstanceDal(); if (XDal.update_client(Cl)) { return(true); } else { return(false); } }
public bool update_ordered_d(Ordered_Dish Or) { XDal = FactorySingletonDal.getInstanceDal(); if (XDal.update_ordered_d(Or)) { return(true); } else { return(false); } }
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)); }
public bool update_dish(Dish D) { XDal = FactorySingletonDal.getInstanceDal(); if (XDal.update_dish(D)) { return(true); } else { return(false); } }
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); }
public bool update_branch(Branch B) { XDal = FactorySingletonDal.getInstanceDal(); if (XDal.update_branch(B)) { return(true); } else { return(false); } }
public bool cancel_order(Order O) { XDal = FactorySingletonDal.getInstanceDal(); if (XDal.cancel_order(O)) { return(true); } else { return(false); } }
public static Idal getDal() { if (dl == null) { dl = new Dal_XML_imp(); } // dl = new Dal_imp(); return(dl); }
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); }
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 }
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 }
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 }
public void DeleteNanny(Nanny n) { Idal mydal = FactoryDal.getDal(); try { mydal.DeleteNanny(n, true); } catch (Exception e) { throw e; } }
public void DeleteMother(Mother m) { Idal mydal = FactoryDal.getDal(); try { mydal.DeleteMother(m, true); } catch (Exception e) { throw e; } }
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; } }
public void UpdateNanny(Nanny nanny) { Idal mydal = FactoryDal.getDal(); try { mydal.UpdateNanny(nanny); } catch (Exception e) { throw e; } }
public void UpdateMother(Mother mother) { Idal mydal = FactoryDal.getDal(); try { mydal.UpdateMother(mother); } catch (Exception e) { throw e; } }
public void UpdateContract(Contract contract) { Idal mydal = FactoryDal.getDal(); try { mydal.UpdateContract(contract); } catch (Exception e) { throw e; } }
public void UpdateChild(Child child) { Idal mydal = FactoryDal.getDal(); try { mydal.UpdateChild(child); } catch (Exception e) { throw e; } }