public bool deleteAgreement(Agreement obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Agreement> AgreementList = from agreement in db.Agreements where agreement.Agreement_ID == obj.Agreement_ID select agreement; if ((AgreementList.ToArray().Length > 0)) { foreach (Agreement agreement in AgreementList.ToList()) { for (int n = 0; n < (agreement.Properties.ToArray()).Length; n++ ) { db.Properties.Remove((agreement.Properties.ToArray())[0]); } } db.Agreements.Remove((AgreementList.ToArray())[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public List<Country> selectAllCountries() { RealReportContext db = new RealReportContext(); try { IQueryable<Country> CountryList = from country in db.Countries select country; return CountryList.ToList(); } catch (Exception ex) { return null; } }
public List<Price> selectAllPrices() { RealReportContext db = new RealReportContext(); try { IQueryable<Price> PriceList = from price in db.Prices select price; return PriceList.ToList(); } catch (Exception ex) { return null; } }
public List<Property> selectAllProperties() { RealReportContext db = new RealReportContext(); try { IQueryable<Property> PropertyList = from property in db.Properties select property; return PropertyList.ToList(); } catch (Exception ex) { return null; } }
public List<Interest> selectAllInterests() { RealReportContext db = new RealReportContext(); try { IQueryable<Interest> InterestList = from interest in db.Interests select interest; return InterestList.ToList(); } catch (Exception ex) { return null; } }
public List<RealType> selectAllRealTypes() { RealReportContext db = new RealReportContext(); try { IQueryable<RealType> RealTypeList = from RealType in db.RealTypes select RealType; return RealTypeList.ToList(); } catch (Exception ex) { return null; } }
public List<Location> selectAllLocations() { RealReportContext db = new RealReportContext(); try { IQueryable<Location> LocationList = from location in db.Locations select location; return LocationList.ToList(); } catch (Exception ex) { return null; } }
public List<Wish> selectAllWishes() { RealReportContext db = new RealReportContext(); try { IQueryable<Wish> WishList = from Wish in db.Wishes select Wish; return WishList.ToList(); } catch (Exception ex) { return null; } }
public List<Client> selectAllClients() { RealReportContext db = new RealReportContext(); try { IQueryable<Client> ClientList = from Client in db.Clients select Client; return ClientList.ToList(); } catch (Exception ex) { return null; } }
public List<OutsideInterest> selectAllOutsideInterests() { RealReportContext db = new RealReportContext(); try { IQueryable<OutsideInterest> OutsideInterestList = from outsideInterest in db.OutsideInterests select outsideInterest; return OutsideInterestList.ToList(); } catch (Exception ex) { return null; } }
public bool deleteCountry(Country obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Country> CountryList = from country in db.Countries where country.Country_ID == obj.Country_ID select country; if ((CountryList.ToArray().Length > 0)) { foreach (Country country in CountryList) { for (int n = 0; n < country.Locations.Count; n++) { db.Locations.Remove((country.Locations.ToArray())[0]); } } db.Countries.Remove((CountryList.ToArray())[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteAgency(Agency obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Agency> AgencyList = from agency in db.Agencies where agency.Agency_ID == obj.Agency_ID select agency; if ((AgencyList.ToArray().Length > 0)) { foreach (Agency agency in AgencyList.ToList()) { for (int n = 0; n < agency.Agents.Count; n++) { db.Agents.Remove((agency.Agents.ToArray())[0]); } } db.Agencies.Remove((AgencyList.ToArray())[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteLocation(Location obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Location> LocationList = from location in db.Locations where location.Location_ID == obj.Location_ID select location; if ((LocationList.ToArray().Length > 0)) { foreach (Location location in LocationList) { location.Properties.Clear(); location.Country = null; } db.Locations.Remove((LocationList.ToArray())[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool insertOutsideInterest(OutsideInterest obj) { using (RealReportContext db = new RealReportContext()) { try { db.OutsideInterests.Add(obj); db.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
public Agency selectAgency(Agency obj) { RealReportContext db = new RealReportContext(); try { IQueryable<Agency> AgencyList = from agency in db.Agencies where agency.Agency_ID == obj.Agency_ID select agency; return (AgencyList.ToList())[0]; } catch (Exception ex) { return null; } }
public Agent selectAgent(Agent obj) { RealReportContext db = new RealReportContext(); try { IQueryable<Agent> AgentList = from agent in db.Agents where agent.Agent_ID == obj.Agency_ID select agent; return (AgentList.ToList())[0]; } catch (Exception ex) { return null; } }
public bool insertProperty(Property obj) { using (RealReportContext db = new RealReportContext()) { try { db.Properties.Add(obj); db.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
public bool insertAgent(Agent obj) { using (RealReportContext db = new RealReportContext()) { try { db.Agents.Add(obj); db.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
public bool deleteProperty(Property obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Property> PropertyList = from property in db.Properties where property.MLS_Prop_ID == obj.MLS_Prop_ID select property; if ((PropertyList.ToArray().Length > 0)) { foreach(Property proper in PropertyList.ToList()) { for (int n = 0; n < (proper.Interests.ToList()).Count; n++) { db.Interests.Remove((proper.Interests.ToList()[0])); } } #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteInterest(Interest obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Interest> InterestList = from interest in db.Interests where interest.Buying_Agent == obj.Buying_Agent && interest.Selling_Agent == obj.Selling_Agent && interest.Property_ID == obj.Property_ID select interest; if ((InterestList.ToArray().Length > 0)) { db.Interests.Remove((InterestList.ToArray())[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteOutsideInterest(OutsideInterest obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<OutsideInterest> OutsideInterestList = from outsideInterest in db.OutsideInterests where outsideInterest.ID == obj.ID select outsideInterest; if ((OutsideInterestList.ToArray().Length > 0)) { db.OutsideInterests.Remove((OutsideInterestList.ToArray()[0])); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteAgent(Agent obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Agent> AgentList = from agent in db.Agents where agent.Agent_ID == obj.Agent_ID select agent; if ((AgentList.ToArray().Length > 0)) { //Remove Dependencies #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteWish(Wish obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Wish> WishList = from Wish in db.Wishes where Wish.Wish_ID == obj.Wish_ID select Wish; if ((WishList.ToArray().Length > 0)) { db.Wishes.Remove((WishList.ToArray())[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteRealType(RealType obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<RealType> RealTypeList = from realType in db.RealTypes where realType.RealType_ID == obj.RealType_ID select realType; if ((RealTypeList.ToArray().Length > 0)) { db.RealTypes.Remove(RealTypeList.ToArray()[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deletePrice(Price obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Price> PriceList = from price in db.Prices where price.Range == obj.Range select price; if ((PriceList.ToArray().Length > 0)) { //Remove Dependencies #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public bool deleteClient(Client obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Client> ClientList = from client in db.Clients where client.ClientID == obj.ClientID select client; if ((ClientList.ToArray().Length > 0)) { // #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public List<Agent> selectAllAgents() { RealReportContext db = new RealReportContext(); try { IQueryable<Agent> AgentList = from agent in db.Agents select agent; return AgentList.ToList(); } catch (Exception ex) { return null; } }
public bool updateAgent(Agent obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Agent> AgentList = from agent in db.Agents where agent.Agent_ID == obj.Agent_ID select agent; if ((AgentList.ToArray()).Length > 0) { foreach (Agent Agent in AgentList) { //Modify Attributes } #region Database Submission with Rollback try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Client selectClient(Client obj) { RealReportContext db = new RealReportContext(); try { IQueryable<Client> ClientList = from Client in db.Clients where Client.ClientID == obj.ClientID select Client; return (ClientList.ToList())[0]; } catch (Exception ex) { return null; } }
public RealType selectRealType(RealType obj) { RealReportContext db = new RealReportContext(); try { IQueryable<RealType> RealTypeList = from RealType in db.RealTypes where RealType.RealType_ID == obj.RealType_ID select RealType; return (RealTypeList.ToList())[0]; } catch (Exception ex) { return null; } }