Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
        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;
            }
        }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 8
0
        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;
            }
        }
Exemplo n.º 9
0
        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;
            }
        }
Exemplo n.º 10
0
        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;
            }
        }
Exemplo n.º 11
0
        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;
                }
            }
        }
Exemplo n.º 12
0
        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;
                }
            }
        }
Exemplo n.º 13
0
        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;
                }
            }
        }
Exemplo n.º 14
0
        public bool insertOutsideInterest(OutsideInterest obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    db.OutsideInterests.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Exemplo n.º 15
0
        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;
            }
        }
Exemplo n.º 16
0
        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;
            }
        }
Exemplo n.º 17
0
        public bool insertProperty(Property obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    db.Properties.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Exemplo n.º 18
0
        public bool insertAgent(Agent obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    db.Agents.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Exemplo n.º 19
0
        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;
                }
            }
        }
Exemplo n.º 20
0
        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;
                }
            }
        }
Exemplo n.º 21
0
        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;
                }
            }
        }
Exemplo n.º 22
0
        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;
                }
            }
        }
Exemplo n.º 23
0
        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;
                }
            }
        }
Exemplo n.º 24
0
        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;
                }
            }
        }
Exemplo n.º 25
0
        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;
                }
            }
        }
Exemplo n.º 26
0
        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;
                }
            }
        }
Exemplo n.º 27
0
        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;
            }
        }
Exemplo n.º 28
0
        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;
                }

            }
        }
Exemplo n.º 29
0
        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;
            }
        }
Exemplo n.º 30
0
        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;
            }
        }