public static bool FlushHomeSalesTableToXml() { bool done = false; using (var context = new HSTDataModel()) { var homesalesList = context.HomeSales.OrderBy(hs => hs.SaleID).ToList(); var xDocument = new XDocument( new XDeclaration(xDeclaration), new XElement("HomeSales", from hs in homesalesList select new XElement("HomeSale", new XElement("SaleID", hs.SaleID), new XElement("HomeID", hs.HomeID), new XElement("SoldDate", hs.SoldDate), new XElement("AgentID", hs.AgentID), new XElement("SaleAmount", hs.SaleAmount), new XElement("BuyerID", hs.BuyerID), new XElement("MarketDate", hs.MarketDate), new XElement("CompanyID", hs.CompanyID) ))); string filename = "HomeSales.xml"; done = FilesHelper.WriteOutXmlFiles(xDocument, filename); } return(done); }
/// <summary> /// Owner has a collection of Homes /// </summary> /// <returns></returns> public static List <Owner> GetTreeListOfOwners() { List <Owner> ownerList = null; using (HSTDataModel context = new HSTDataModel()) { foreach (var owner in context.Owners.Include(h => h.Homes) .Include(p => p.Person)) { ownerList.Add(owner); } } return(ownerList); }
/// <summary> /// Agent has a collection of HomeSales /// </summary> /// <returns></returns> public static List <Agent> GetTreeListOfAgents() { var agentList = default(List <Agent>); using (HSTDataModel context = new HSTDataModel()) { foreach (var agent in context.Agents.Include(p => p.Person) .Include(r => r.RealEstateCompany) .Include(a => a.HomeSales)) { agentList.Add(agent); } } return(agentList); }
/// <summary> /// RealEstateCompany has a collection of Agents and HomeSales /// </summary> /// <returns></returns> public static List <RealEstateCompany> GetTreeListOfRECompanies() { var recosList = default(List <RealEstateCompany>); // allows using var, forces null if nullable type using (var context = new HSTDataModel()) { recosList = new List <RealEstateCompany>(); foreach (var reco in context.RealEstateCompanies.Include(hs => hs.HomeSales) .Include(a => a.Agents)) { recosList.Add(reco); } } return(recosList); }
/// <summary> /// Home has a collection of HomeSales /// </summary> /// <returns></returns> public static List <Home> GetTreeListOfHomes() { List <Home> homesList = null; using (HSTDataModel context = new HSTDataModel()) { homesList = new List <Home>(); foreach (Home home in context.Homes.Include(hs => hs.HomeSales) .Include(o => o.Owner)) { homesList.Add(home); } } return(homesList); }
/// <summary> /// Buyer has a collection of HomeSales /// </summary> /// <returns></returns> public static List <Buyer> GetTreeListOfBuyers() { var buyersList = default(List <Buyer>); using (var context = new HSTDataModel()) { buyersList = new List <Buyer>(); foreach (var buyer in context.Buyers.Include(p => p.Person) .Include(b => b.HomeSales)) { buyersList.Add(buyer); } } return(buyersList); }
/// <summary> /// A Person is the parent model for Agents, Buyers, and Owners, who contain PersonID reference pointers. /// </summary> /// <returns></returns> public static List <Person> GetListOfPeople() { List <Person> peopleList = null; using (HSTDataModel context = new HSTDataModel()) { peopleList = new List <Person>(); foreach (Person person in context.People.Include(o => o.Owner) .Include(a => a.Agent) .Include(b => b.Buyer)) { peopleList.Add(person); } } return(peopleList); }
/// <summary> /// HomeSale does not contain any collection of other entities /// </summary> /// <returns></returns> public static List <HomeSale> GetListOfHomeSales() { List <HomeSale> homeSalesList = null; using (HSTDataModel context = new HSTDataModel()) { homeSalesList = new List <HomeSale>(); foreach (HomeSale homesale in context.HomeSales.Include(hs => hs.Agent) .Include(a => a.RealEstateCompany) .Include(b => b.Buyer) .Include(h => h.Home)) { homeSalesList.Add(homesale); } } return(homeSalesList); }
/// <summary> /// Flush Owners entities to an XDocument and write it to file /// </summary> /// <returns></returns> public static bool FlushOwnersTableToXml() { bool done = false; using (var context = new HSTDataModel()) { var ownersList = context.Owners.OrderBy(o => o.OwnerID).ToList(); var xDocument = new XDocument( new XDeclaration(xDeclaration), new XElement("Owners", from o in ownersList select new XElement("Owner", new XElement("OwnerID", o.OwnerID), new XElement("PreferredLender", o.PreferredLender) ))); string filename = "Owners.xml"; done = FilesHelper.WriteOutXmlFiles(xDocument, filename); } return(done); }
public static bool FlushBuyersTableToXml() { bool done = false; using (var context = new HSTDataModel()) { var buyersList = context.Buyers.OrderBy(b => b.BuyerID).ToList(); var xDocument = new XDocument( new XDeclaration(xDeclaration), new XElement("Buyers", from b in buyersList select new XElement("Buyer", new XElement("BuyerID", b.BuyerID), new XElement("CreditRating", b.CreditRating) ))); string filename = "Buyers.xml"; done = FilesHelper.WriteOutXmlFiles(xDocument, filename); } return(done); }
public static bool FlushRealEstateCompaniesTableToXml() { bool done = false; using (var context = new HSTDataModel()) { var reCosList = context.RealEstateCompanies.OrderBy(re => re.CompanyID).ToList(); var xDocument = new XDocument( new XDeclaration(xDeclaration), new XElement("RealEstateCommpanies", from re in reCosList select new XElement("RealEstateCompany", new XElement("CompanyID", re.CompanyID), new XElement("CompanyName", re.CompanyName), new XElement("Phone", re.Phone) ))); string filename = "RealEstateCompanies.xml"; done = FilesHelper.WriteOutXmlFiles(xDocument, filename); } return(done); }
public static bool FlushAgentsTableToXml() { bool done = false; using (var context = new HSTDataModel()) { var agentsList = context.Agents.OrderBy(a => a.AgentID).ToList(); var xDocument = new XDocument( new XDeclaration(xDeclaration), new XElement("Agents", from a in agentsList select new XElement("Agent", new XElement("AgentID", a.AgentID), new XElement("CompanyID", a.CompanyID), new XElement("CommissionPercent", a.CommissionPercent) ))); string filename = "Agents.xml"; done = FilesHelper.WriteOutXmlFiles(xDocument, filename); } return(done); }
public static bool FlushHomesTableToXml() { bool done = false; using (var context = new HSTDataModel()) { var homesList = context.Homes.OrderBy(h => h.HomeID).ToList(); var xDocument = new XDocument( new XDeclaration(xDeclaration), new XElement("Homes", from h in homesList select new XElement("Home", new XElement("HomeID", h.HomeID), new XElement("Address", h.Address), new XElement("City", h.City), new XElement("State", h.State), new XElement("Zip", h.Zip), new XElement("OwnerID", h.OwnerID) ))); string filename = "Homes.xml"; done = FilesHelper.WriteOutXmlFiles(xDocument, filename); } return(done); }
/// <summary> /// Flush People entities to an XDocument and write it to file /// </summary> /// <returns></returns> public static bool FlushPeopleTableToXml() { bool done = false; using (var context = new HSTDataModel()) { //var peopleList = EntityLists.GetListOfPeople(); var peopleList = context.People.OrderBy(p => p.PersonID).ToList(); var xDocument = new XDocument( new XDeclaration(xDeclaration), new XElement("People", from p in peopleList select new XElement("Person", new XElement("PersonID", p.PersonID), new XElement("FirstName", p.FirstName), new XElement("LastName", p.LastName), new XElement("Phone", p.Phone), new XElement("Email", p.Email) ))); string filename = "People.xml"; done = FilesHelper.WriteOutXmlFiles(xDocument, filename); } return(done); }