コード例 #1
0
        public List <Property> VerifyProperty(int propId, bool?state)
        {
            List <Property> prp = null;

            try
            {
                e = new EasyHousingSolutions_Entities();

                prp = (from p in e.Properties
                       where p.PropertyId == propId
                       select p).ToList <Property>();
                prp[0].IsActive = state;

                e.SaveChanges();
            }
            catch (AdminException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(prp);
        }
コード例 #2
0
ファイル: AdminOperations.cs プロジェクト: coderv8/EHS_Almost
        public IQueryable <Property> viewPropByRegion(string state, string city)
        {
            IQueryable <Property> result = null;

            entityObj = new EasyHousingSolutions_Entities();
            try
            {
                result = (from prop in entityObj.Properties
                          select prop);
                if (state != string.Empty && city != string.Empty)
                {
                    result = (from prop in entityObj.Properties
                              where prop.StateId == (from sId in entityObj.States where sId.StateName == state select sId.StateId).FirstOrDefault() &&
                              prop.CityId == (from sId in entityObj.Cities where sId.CityName == city select sId.CityId).FirstOrDefault()
                              select prop);
                }
                else if (state != string.Empty && city == string.Empty)
                {
                    result = (from prop in entityObj.Properties
                              where prop.StateId == (from sId in entityObj.States where sId.StateName == state select sId.StateId).FirstOrDefault()
                              select prop);
                }
            }
            catch (AdminException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
コード例 #3
0
 public void SortByPrice()
 {
     EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
     var SortedData = from a in entity.Properties
                      orderby a.PriceRange ascending
                      select a;
 }
コード例 #4
0
        public List <Property> DeleteFromCart(int id)
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            List <Property> propertyList         = new List <Property>();
            // delete from cart..
            var DeleteCart = (from p in entity.Carts
                              where p.PropertyId == id && p.BuyerId == Loginid
                              select p);

            foreach (var k in DeleteCart)
            {
                entity.Carts.Remove(k);
            }

            // fectching the property data which is deleted...
            var propdata = from k in entity.Properties
                           where k.PropertyId == id
                           select k;

            foreach (var k in propdata)
            {
                propertyList.Add(k);
            }

            entity.SaveChanges();
            return(propertyList);
        }
コード例 #5
0
        public List <Property> AddToCart(int propID)
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            List <Property> propertyList         = new List <Property>();

            // this is current buyer id... this has to be fetched from db



            // fectching the property data..
            var propdata = from k in entity.Properties
                           where k.PropertyId == propID
                           select k;

            foreach (var k in propdata)
            {
                propertyList.Add(k);
            }

            Cart cart = new Cart();

            cart.PropertyId = propID;
            cart.BuyerId    = Loginid;

            entity.Carts.Add(cart);

            entity.SaveChanges();

            return(propertyList);
        }
コード例 #6
0
        public void UpdateProperty(Property updateProperty)
        {
            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                List <Property> prp = (from p in ehsEntity.Properties
                                       where p.PropertyId == updateProperty.PropertyId
                                       select p).ToList();

                prp[0].PropertyName       = updateProperty.PropertyName;
                prp[0].Address            = updateProperty.Address;
                prp[0].Description        = updateProperty.Description;
                prp[0].Status_Description = updateProperty.Status_Description;
                prp[0].Images             = updateProperty.Images;
                prp[0].InitialDeposit     = updateProperty.InitialDeposit;
                prp[0].Landmark           = updateProperty.Landmark;
                prp[0].PriceRange         = updateProperty.PriceRange;
                prp[0].PropertyOption     = updateProperty.PropertyOption;
                prp[0].PropertyType       = updateProperty.PropertyType;
                ehsEntity.SaveChanges();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        public bool UpdateProperty(Property updateProperty)
        {
            bool propertyUpdated = false;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                List <Property> result = (from prop in ehsEntity.Properties
                                          where prop.PropertyId == updateProperty.PropertyId
                                          select prop).ToList();

                result[0].PropertyName       = updateProperty.PropertyName;
                result[0].Address            = updateProperty.Address;
                result[0].Description        = updateProperty.Description;
                result[0].Status_Description = updateProperty.Status_Description;
                result[0].Images             = updateProperty.Images;
                result[0].InitialDeposit     = updateProperty.InitialDeposit;
                result[0].Landmark           = updateProperty.Landmark;
                result[0].PriceRange         = updateProperty.PriceRange;
                result[0].PropertyOption     = updateProperty.PropertyOption;
                result[0].PropertyType       = updateProperty.PropertyType;
                ehsEntity.SaveChanges();
                propertyUpdated = true;
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(propertyUpdated);
        }
コード例 #8
0
ファイル: AdminOperations.cs プロジェクト: coderv8/EHS_Almost
        public List <Property> VerifyProperty(int propId, bool?state)
        {
            List <Property> result = null;

            try
            {
                entityObj = new EasyHousingSolutions_Entities();

                result = (from prop in entityObj.Properties
                          where prop.PropertyId == propId
                          select prop).ToList <Property>();
                result[0].IsActive = state;

                entityObj.SaveChanges();
            }
            catch (AdminException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #9
0
        public void InsertBuyer(Buyer newBuyer)
        {
            EasyHousingSolutions_Entities ehsEntity = new EasyHousingSolutions_Entities();

            ehsEntity.Buyers.Add(newBuyer);

            ehsEntity.SaveChanges();
        }
コード例 #10
0
        public List <Property> GetPropertiesByPrice(int min, int max)
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            var result = (from prop in entity.Properties
                          where prop.PriceRange >= min && prop.PriceRange <= max && prop.IsActive == true
                          select prop);

            return(result.ToList <Property>());
        }
コード例 #11
0
        /// <summary>
        /// Author: Batch3
        /// Description: This function is written to add buyer details.
        /// Function Name: ShowCart
        /// Input arguments:
        /// Return Type : A List which contain buyer details.
        /// Date: 07/14/2018
        /// </summary>
        public void InsertBuyer(Buyer newBuyer)
        {
            EasyHousingSolutions_Entities ehsEntity = new EasyHousingSolutions_Entities();

            // Adding buyer details to the BuyerTable
            ehsEntity.Buyers.Add(newBuyer);

            ehsEntity.SaveChanges();
        }
コード例 #12
0
        // this will Search the properties.. and s
        public void FilteredData(Property dfs)
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            var filteredData = from a in entity.Properties
                               where a.Address.ToString() == dfs.Address && a.PropertyType == dfs.PropertyType
                               orderby a.PriceRange ascending
                               select a;

            foreach (var k in filteredData)
            {
                Console.WriteLine(k.PropertyName + "" + k.PropertyOption + " " + k.SellerId + " " + k.PriceRange);
            }
        }
コード例 #13
0
        public List <Property> ShowALLProperties()
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            List <Property> propertyList         = new List <Property>();

            var HouseDetails = from p in entity.Properties
                               select p;

            foreach (var k in HouseDetails)
            {
                propertyList.Add(k);
            }
            return(propertyList);
        }
コード例 #14
0
ファイル: BuyerOperations.cs プロジェクト: manishraoj/EHS
        /// <summary>
        /// Author: Batch3
        /// Description: This function is written to Show all Property details of the buyer.
        /// Function Name: ShowCart
        /// Input arguments:
        /// Return Type : A List which contain all Property Details of the buyer.
        /// Date: 07/14/2018
        /// </summary>


        public List <Property> ShowALLProperties()
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            // Creating a list object of type Property
            List <Property> propertyList = new List <Property>();

            // A LINQ query to get all property details of the buyer
            var HouseDetails = from PropertyData in entity.Properties
                               select PropertyData;

            //This Loop will show the property Details of buyer
            foreach (var k in HouseDetails)
            {
                propertyList.Add(k);
            }
            return(propertyList);
        }
コード例 #15
0
 public void AddUser(User newUser)
 {
     try
     {
         entityObj = new EasyHousingSolutions_Entities();
         entityObj.Users.Add(newUser);
         entityObj.SaveChanges();
     }
     catch (UserException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #16
0
        public void AddProperty(Property newProperty)
        {
            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                ehsEntity.Properties.Add(newProperty);

                ehsEntity.SaveChanges();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #17
0
        public void AddSeller(Seller newSeller)
        {
            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                ehsEntity.Sellers.Add(newSeller);

                ehsEntity.SaveChanges();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #18
0
ファイル: UsersOperations.cs プロジェクト: manishraoj/EHS
        public bool AddUser(User newUser)
        {
            bool userAdded = false;

            try
            {
                entityObj = new EasyHousingSolutions_Entities();
                userAdded = entityObj.Users.Add(newUser);
                entityObj.SaveChanges();
            }
            catch (UserException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(userAdded);
        }
コード例 #19
0
        public bool AddSeller(Seller newSeller)
        {
            bool sellerAdded = false;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();
                ehsEntity.Sellers.Add(newSeller);
                ehsEntity.SaveChanges();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(sellerAdded);
        }
コード例 #20
0
        public bool AddProperty(Property newProperty)
        {
            bool propertyAdded = false;

            try
            {
                ehsEntity     = new EasyHousingSolutions_Entities();
                propertyAdded = ehsEntity.Properties.Add(newProperty);
                ehsEntity.SaveChanges();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(propertyAdded);
        }
コード例 #21
0
        public List <Property> ShowCart()
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            List <Property> propertyList         = new List <Property>();

            // fetching cart data...
            var shoWCart = from p in entity.Properties
                           from c in entity.Carts

                           where p.PropertyId == c.PropertyId &&
                           c.BuyerId == Loginid
                           select p;

            foreach (var k in shoWCart)
            {
                propertyList.Add(k);
            }

            return(propertyList);
        }
コード例 #22
0
ファイル: UsersOperations.cs プロジェクト: manishraoj/EHS
        public User LoginUser(User login)
        {
            entityObj = new EasyHousingSolutions_Entities();
            var result = new User();

            try
            {
                result = (from user in entityObj.Users
                          where user.UserName == login.UserName && user.Password == login.Password
                          select user).FirstOrDefault();
            }
            catch (UserException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #23
0
ファイル: AdminOperations.cs プロジェクト: coderv8/EHS_Almost
        public List <Seller> GetOwners()
        {
            List <Seller> result = null;

            try
            {
                entityObj = new EasyHousingSolutions_Entities();
                result    = (from p in entityObj.Sellers
                             select p).ToList();
            }
            catch (AdminException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
コード例 #24
0
        public List <Property> viewProperties(int sellerID, bool?status)
        {
            List <Property> prp = null;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                prp = (from p in ehsEntity.Properties
                       where p.SellerId == sellerID && p.IsActive == status
                       select p).ToList();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(prp);
        }
コード例 #25
0
        public List <Property> viewProperties(int sellerID)
        {
            List <Property> result = null;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                result = (from prop in ehsEntity.Properties
                          where prop.SellerId == sellerID
                          select prop).ToList();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #26
0
        public int SellerId(string userName)
        {
            int prp;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                prp = (from p in ehsEntity.Sellers
                       where p.UserName == userName
                       select p.SellerId).FirstOrDefault();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(prp);
        }
コード例 #27
0
        public List <State> GetState()
        {
            List <State> prp = null;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                prp = (from p in ehsEntity.States

                       select p).ToList();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(prp);
        }
コード例 #28
0
        public List <City> Get_City(int cityId)
        {
            List <City> prp = null;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                prp = (from p in ehsEntity.Cities
                       where p.CityId == cityId
                       select p).ToList();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(prp);
        }
コード例 #29
0
        public Property GetProp(int propId)
        {
            Property prp = null;

            try
            {
                ehsEntity = new EasyHousingSolutions_Entities();

                prp = (from p in ehsEntity.Properties
                       where p.PropertyId == propId
                       select p).FirstOrDefault();
            }
            catch (SellerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(prp);
        }
コード例 #30
0
        /// <summary>
        /// Author: Batch3
        /// Description: This function is written to Show all Property details of the buyer.
        /// Function Name: ShowCart
        /// Input arguments:
        /// Return Type : A List which contain all Property Details of the buyer.
        /// Date: 07/14/2018
        /// </summary>


        public List <Property> ShowALLProperties(string state, string city)
        {
            EasyHousingSolutions_Entities entity = new EasyHousingSolutions_Entities();
            var result = (from prop in entity.Properties
                          where prop.IsActive == true
                          select prop);

            if (state != string.Empty && city != string.Empty)
            {
                result = (from prop in entity.Properties
                          where prop.StateId == (from sId in entity.States where sId.StateName == state select sId.StateId).FirstOrDefault() &&
                          prop.CityId == (from sId in entity.Cities where sId.CityName == city select sId.CityId).FirstOrDefault() && prop.IsActive == true
                          select prop);
            }
            else if (state != string.Empty && city == string.Empty)
            {
                result = (from prop in entity.Properties
                          where prop.StateId == (from sId in entity.States where sId.StateName == state select sId.StateId).FirstOrDefault() && prop.IsActive == true
                          select prop);
            }
            return(result.ToList <Property>());
        }