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 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 insertProperty(Property obj) { using (RealReportContext db = new RealReportContext()) { try { db.Properties.Add(obj); db.SaveChanges(); return true; } 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 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 bool updateAgency(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) { agency.Agency_Name = obj.Agency_Name; } #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 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 bool updateRealType(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) { foreach (RealType RealType in RealTypeList) { RealType.RealType_Name = obj.RealType_Name; } #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 bool updateWish(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) { foreach (Wish Wish in WishList) { //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 bool updateProperty(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 property in PropertyList) { //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 bool updateLocation(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.City = obj.City; location.Country_ID = obj.Country_ID; location.Country = null; } #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 bool updateOutsideInterest(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) { foreach (OutsideInterest OutsideInterest in OutsideInterestList) { //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 bool updateCountry(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) { country.Country_Name = obj.Country_Name; } #region Database Submission with Rollback try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }