Exemple #1
0
        public int CreateHouseHold(HouseHold newHouseHold)
        {
            bool ifExist    = IfHouseHoldExist(newHouseHold.StreetAddress, newHouseHold.Zip);
            bool ifZipValid = IfZipExist(newHouseHold.Zip);

            if (!ifExist && ifZipValid)
            {
                SqlCommand command = new SqlCommand(ConfigurationManager.AppSettings["queryCreateHouseHold"]);
                command.Parameters.AddWithValue("@rent", newHouseHold.Rent);
                command.Parameters.AddWithValue("@streetAddress", newHouseHold.StreetAddress);
                command.Parameters.AddWithValue("@zipCode", newHouseHold.Zip);
                command.Parameters.AddWithValue("@isAvailable", newHouseHold.IsAvailable);
                return(dao.Retrieve(command));
            }
            else
            {
                return(0);
            }
        }
Exemple #2
0
        //Check if zip exist in the ZipLocation table
        private bool IfUserExist(string email)
        {
            SqlCommand command = new SqlCommand(ConfigurationManager.AppSettings["querySelectEmail"]);

            command.Parameters.AddWithValue("@email", email);
            if (dao.Retrieve(command) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }