public void previousdata()
        {
            // string query = "SELECT        temp_id, temp_category, temp_title, temp_description, temp_datetime, temp_price, temp_city     FROM     (SELECT        TOP (6) temp_id, temp_category, temp_title, temp_description, temp_datetime, temp_price, temp_city  FROM    (SELECT        TOP (10) temp_id, temp_category, temp_title, temp_description, temp_datetime, temp_price, temp_city     FROM    temp    ORDER BY temp_id) AS newtbl    ORDER BY temp_id DESC) AS newtbl2    ORDER BY temp_id";
            string        query      = "select  temp_title ,temp_price,temp_description,temp_city ,temp_datetime ,temp_category from temp where  temp_id = 1  ORDER  BY temp_datetime ";
            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                int           i      = 0;

                if (reader.HasRows)
                {
                    //while (reader.Read())
                    //{
                    //    i++;
                    //   // MessageBox.Show(reader["temp_title"].ToString() + reader["temp_price"].ToString()+ reader["temp_description"].ToString()+ reader["temp_city"].ToString() + reader["temp_datetime"].ToString()+ reader["temp_category"].ToString());
                    //   // this.leftbody(reader["temp_title"].ToString(), reader["temp_price"].ToString(), reader["temp_description"].ToString(), reader["temp_city"].ToString(), reader["temp_datetime"].ToString(), reader["temp_category"].ToString(), i++);
                    //}

                    this.leftbody(reader);
                }
                else
                {
                    admessage.Text = "No ad found";
                }
            }
            catch (Exception ex)
            {
                adexception.Text = ex.Message;
            }
        }
        public void myad()
        {
            SqlConnection connection = Connection_Manger.getConnection();
            string        query      = "select temp_title ,temp_id ,temp_city ,temp_price ,temp_datetime ,temp_category from  temp  ";
            SqlCommand    command    = new SqlCommand(query, connection);



            try
            {
                connection.Open();
                SqlDataAdapter dp = new SqlDataAdapter(command);
                DataSet        ds = new DataSet();
                dp.Fill(ds);

                //SqlDataReader reader = command.ExecuteReader();
                //if (reader.HasRows)
                //{

                ListView1.DataSource = ds;
                ListView1.DataBind();

                //}
                //else
                //{
                //    //admessage.Text = "no ad is posted by you";
                //    MessageBox.Show("no ad is posted by you");

                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void getdata(string title, int minprice, int maxprice, string city, string category)
        {
            string        query      = "select temp_title ,temp_price,temp_description,temp_city ,temp_datetime ,temp_category from temp where temp_title like '%" + title + "%' and temp_price between " + minprice + " and " + maxprice + " and temp_city='" + city + "' and temp_category='" + category + "'   ";
            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                int           i      = 0;

                if (reader.HasRows)
                {
                    message_label.Text = "Your Search Results";
                    while (reader.Read())
                    {
                        this.leftbody(reader["temp_title"].ToString(), reader["temp_price"].ToString(), reader["temp_description"].ToString(), reader["temp_city"].ToString(), reader["temp_datetime"].ToString(), reader["temp_category"].ToString(), i++);
                    }
                }
                else
                {
                    message_label.Text = "No Record found";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        public void myad(string userid)
        {
            SqlConnection connection = Connection_Manger.getConnection();
            string        query      = "select temp_title as Title,temp_id as Id,temp_city as City,temp_price as Price,temp_datetime as Date,temp_category as Category from  temp  where temp_userid='" + userid + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();

                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    myads_gv.DataSource = reader;
                    myads_gv.DataBind();
                }
                else
                {
                    admessage.Text = "no ad is posted by you";
                }
            }
            catch (Exception ex)
            {
                adexception.Text = ex.Message;
            }
        }
Exemplo n.º 5
0
        public void email(string userid)
        {
            SqlConnection connection = Connection_Manger.getConnection();
            string        query      = "select Email from aspnet_Membership where userid='" + userid + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();

                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        email_lb.Text = reader["Email".ToString()].ToString();
                    }
                }
                else
                {
                    message_lb.Text = "some record(s) not found";
                }
            }
            catch (Exception ex)
            {
                exception_lb.Text = ex.Message;
            }
        }
Exemplo n.º 6
0
        protected void NewUserWizard_CreatedUser(object sender, EventArgs e)
        {
            // Get the UserId of the just-added user
            MembershipUser newUser   = Membership.GetUser(NewUserWizard.UserName);
            Guid           newUserId = (Guid)newUser.ProviderUserKey;

            Console.WriteLine(newUserId);

            // Insert a new record into UserProfiles
            //string connectionString = ConfigurationManager.ConnectionStrings["SecurityTutorialsConnectionString"].ConnectionString;
            string insertSql = "INSERT INTO custom_profile(Userid, firstname,lastname,mobile,country,city,address,picture) VALUES(@UserId, @firstname,@lastname,@mobile,@country,@City,@address,@picture)";

            using (SqlConnection conn = Connection_Manger.getConnection())
            {
                conn.Open();
                SqlCommand myCommand = new SqlCommand(insertSql, conn);
                myCommand.Parameters.AddWithValue("@UserId", newUserId);
                myCommand.Parameters.AddWithValue("@firstname", DBNull.Value);
                myCommand.Parameters.AddWithValue("@lastname", DBNull.Value);
                myCommand.Parameters.AddWithValue("@mobile", DBNull.Value);
                myCommand.Parameters.AddWithValue("@country", DBNull.Value);
                myCommand.Parameters.AddWithValue("@city", DBNull.Value);
                myCommand.Parameters.AddWithValue("@address", DBNull.Value);
                myCommand.Parameters.AddWithValue("@picture", DBNull.Value);
                myCommand.ExecuteNonQuery();
                conn.Close();
            }
        }
Exemplo n.º 7
0
        public void update_country(Guid userid)
        {
            SqlConnection connection = Connection_Manger.getConnection();
            string        query      = "select country from custom_profile where userid='" + userid + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();

                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        country_tb.Text = reader["country".ToString()].ToString();
                    }
                }
                else
                {
                    message_lb.Text = "some record(s) not found";
                }
            }
            catch (Exception ex)
            {
                exception_lb.Text = ex.Message;
            }
        }
Exemplo n.º 8
0
        public void myad()
        {
            SqlConnection connection = Connection_Manger.getConnection();
            string        query      = "select temp_title as Title,temp_id as Id,temp_city as City,temp_price as Price,temp_datetime as Date,temp_category as Category from  temp  ";
            SqlCommand    command    = new SqlCommand(query, connection);



            try
            {
                connection.Open();

                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    ListView1.DataSource = reader;
                    ListView1.DataBind();
                }
                else
                {
                    //admessage.Text = "no ad is posted by you";
                    MessageBox.Show("no ad is posted by you");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void user(string query)
        {
            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            command.ExecuteNonQuery();
        }
        protected void ass_Click(object sender, EventArgs e)
        {
            SqlConnection conn = Connection_Manger.getConnection();

            conn.Open();
            string     query = "insert into ram values('" + tb.Text + "','" + TextBox1.Text + "','" + TextBox2.Text + "')";
            SqlCommand comm  = new SqlCommand(query, conn);

            comm.ExecuteNonQuery();
            conn.Close();
        }
        public int other_vehcile_counter()
        {
            SqlConnection conn  = Connection_Manger.getConnection();
            string        query = "select count(*) from ad_autos_other_vehicle";
            SqlCommand    cmd   = new SqlCommand(query, conn);

            conn.Open();
            int count = Convert.ToInt32(cmd.ExecuteScalar());

            conn.Close();
            return(count);
        }
Exemplo n.º 12
0
        public DataTable showuser(string query)
        {
            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            SqlDataAdapter dp = new SqlDataAdapter(command);
            DataTable      ds = new DataTable();

            dp.Fill(ds);

            return(ds);
        }
Exemplo n.º 13
0
        protected void NewUserWizard_ActiveStepChanged(object sender, EventArgs e)
        {
            // Have we JUST reached the Complete step?
            if (NewUserWizard.ActiveStep.Title == "Complete")
            {
                WizardStep UserSettings = NewUserWizard.FindControl("UserSettings") as WizardStep;

                // Programmatically reference the TextBox controls
                //TextBox HomeTown = UserSettings.FindControl("HomeTown") as TextBox;
                //TextBox HomepageUrl = UserSettings.FindControl("HomepageUrl") as TextBox;
                //TextBox Signature = UserSettings.FindControl("Signature") as TextBox;

                ///////////////////////////////////////////////////////////////////////////////
                TextBox FirstName = UserSettings.FindControl("FirstName") as TextBox;
                TextBox LastName  = UserSettings.FindControl("LastName") as TextBox;
                TextBox Mobile    = UserSettings.FindControl("Mobile") as TextBox;
                TextBox Country   = UserSettings.FindControl("Country") as TextBox;
                TextBox City      = UserSettings.FindControl("City") as TextBox;
                TextBox Address   = UserSettings.FindControl("Address") as TextBox;
                //TextBox picture = UserSettings.FindControl("picture") as TextBox;



                ///////////////////////////////////////////////////////////////////////////////


                // Update the UserProfiles record for this user
                // Get the UserId of the just-added user
                MembershipUser newUser   = Membership.GetUser(NewUserWizard.UserName);
                Guid           newUserId = (Guid)newUser.ProviderUserKey;

                // Insert a new record into UserProfiles
//                string connectionString = ConfigurationManager.ConnectionStrings["SecurityTutorialsConnectionString"].ConnectionString;
                string updateSql = "UPDATE custom_profile SET firstname=@firstname,lastname=@lastname,mobile=@mobile,country=@country,city=@city,address=@address,picture=@picture where userid='" + newUserId + "'";

                using (SqlConnection conn = Connection_Manger.getConnection())
                {
                    conn.Open();
                    SqlCommand myCommand = new SqlCommand(updateSql, conn);
                    myCommand.Parameters.AddWithValue("@firstname", FirstName.Text.Trim());
                    myCommand.Parameters.AddWithValue("@lastname", LastName.Text.Trim());
                    myCommand.Parameters.AddWithValue("@mobile", Mobile.Text.Trim());
                    myCommand.Parameters.AddWithValue("@country", Country.Text.Trim());
                    myCommand.Parameters.AddWithValue("@city", City.Text.Trim());
                    myCommand.Parameters.AddWithValue("@address", Address.Text.Trim());
                    myCommand.Parameters.AddWithValue("@picture", DBNull.Value);
                    myCommand.ExecuteNonQuery();
                    conn.Close();
                }
            }
        }
        public void insert_ad_autos_motor_vehicle(string title, string city, string location, string content, string user_type, int price, string images, string maker, string model, string year, string condition, string mileage, string colour, string engine_capacity, DateTime datetime, Guid userid, int views)
        {
            string        query      = "insert into ad_autos_motor_vehicle values('" + title + "','" + city + "','" + location + "','" + content + "','" + user_type + "'," + price + ",'" + images + "','" + maker + "','" + model + "','" + year + "','" + condition + "','" + mileage + "','" + colour + "','" + engine_capacity + "','" + datetime + "','" + userid + "'," + views + ")";
            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
        public void insert_ad_autos_car(string title, string city, string location, string content, string user_type, int price, string images, string maker, string model, string year, string condition, string transmission, string engine_type, string mileage, string colour, int engine_capacity, string power_steering, string power_locks, string power_windows, string fm_radio, string cd_Player, string drive_air_bags, string sun_roofs, string abs, string tracker, string air_conditioning, string pessenger_air_bags, DateTime datetime, Guid userid, int views)
        {
            string        query      = "insert into ad_autos_car values('" + title + "','" + city + "','" + location + "','" + content + "','" + user_type + "'," + price + ",'" + images + "','" + maker + "','" + model + "','" + year + "','" + condition + "','" + transmission + "','" + engine_type + "','" + mileage + "','" + colour + "'," + engine_capacity + ",'" + power_steering + "','" + power_locks + "','" + power_windows + "','" + fm_radio + "','" + cd_Player + "','" + drive_air_bags + "','" + sun_roofs + "','" + abs + "','" + tracker + "','" + air_conditioning + "','" + pessenger_air_bags + "','" + datetime + "','" + userid + "'," + views + ")";
            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
        public void insert_ad_autos_boats_ships(string title, string city, string location, string content, string user_type, int price, string images, DateTime datetime, Guid userid, int views)
        {
            string        query      = "insert into ad_autos_boats_ships values('" + title + "','" + city + "','" + location + "','" + content + "','" + user_type + "'," + price + ",'" + images + "','" + datetime + "','" + userid + "'," + views + ")";
            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    command    = new SqlCommand(query, connection);

            try
            {
                connection.Open();
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
        public void selectlocation(string city)
        {
            string        query   = "select ad_location from ad_city_location where ad_city='" + city + "'";
            SqlConnection conn    = Connection_Manger.getConnection();
            SqlCommand    command = new SqlCommand(query, conn);

            try
            {
                conn.Open();
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            }

            catch (Exception ex) {
                //MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 18
0
        public void updateprofile(string firstname, string lastname, string mobile, string country, string city, string address, Guid userid)
        {
            SqlConnection connection = Connection_Manger.getConnection();
            string        query      = "update custom_profile set firstname='" + firstname + "',lastname='" + lastname + "',mobile='" + mobile + "',country='" + country + "',city='" + city + "',address='" + address + "' where userid='" + userid + "'";

            SqlCommand command = new SqlCommand(query, connection);

            try
            {
                connection.Open();
                command.ExecuteNonQuery();
                update_lb.Text = "profile updated";
            }
            catch (Exception ex)
            {
                exception_lb.Text = ex.Message;
            }
            connection.Close();
        }
Exemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection connection = Connection_Manger.getConnection();

            MessageBox.Show(Request.QueryString["id"]);
            MessageBox.Show(Request.QueryString["tablename"]);
            if (Request.QueryString["id"] != null && Request.QueryString["tablename"] != null)
            {
                connection.Open();
                string viewquery = "update  ad_" + Request.QueryString["tablename"] + " set  " + Request.QueryString["tablename"] + "_views=" + Request.QueryString["tablename"] + "_views+1  where " + Request.QueryString["tablename"] + "_id =  " + Request.QueryString["id"];
                string query     = "select custom.firstname as firstname,custom.lastname as lastname,custom.mobile as mobile ,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_title as title,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_content as content,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_id as id,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_price as price,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_city as city,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_datetime as datetime,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_views as views,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_image as image from  ad_" + Request.QueryString["tablename"] + " ad_" + Request.QueryString["tablename"] + "    left join custom_profile custom on ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_userid =custom.userid where ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_id = " + Request.QueryString["id"] + "";

                //string query = "select " + Request.QueryString["tablename"] + "_title as title," + Request.QueryString["tablename"] + "_content as content," + Request.QueryString["tablename"] + "_price as price," + Request.QueryString["tablename"] + "_city as city," + Request.QueryString["tablename"] + "_datetime as datetime," + Request.QueryString["tablename"] + "_views as views," + Request.QueryString["tablename"] + "_image as image  from  ad_" + Request.QueryString["tablename"] + " where " + Request.QueryString["tablename"] + "_id =  " + Request.QueryString["id"];
                SqlCommand command     = new SqlCommand(query, connection);
                SqlCommand viewcommand = new SqlCommand(viewquery, connection);

                viewcommand.ExecuteNonQuery();

                SqlDataAdapter dp = new SqlDataAdapter(command);

                DataSet ds = new DataSet();
                dp.Fill(ds);
                ListView1.DataSource = ds;
                ListView1.DataBind();
                connection.Close();
            }

            //string userinfoquery = "select firstname as firstname ,lastname as lastname,mobile as mobile from custom_profile where userid=(select " + Request.QueryString["tablename"] + "_userid from ad_" + Request.QueryString["tablename"] + " where " + Request.QueryString["tablename"] + "_id =  " + Request.QueryString["id"] + " )";
            //SqlCommand userinfocommand = new SqlCommand(userinfoquery, connection);
            //SqlDataAdapter userdp = new SqlDataAdapter(userinfocommand);
            //DataSet userds = new DataSet();
            //userdp.Fill(userds);
            //ListView1.DataSource = userds;
            //ListView1.DataBind();
            //connection.Close();

            //string abc = "select custom.firstname as firstname,custom.lastname as lastname,custom.mobile as mobile ,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_title,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_content as content,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_price as price,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_city as city,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_datetime as datetime,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_views as views,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_image as image from table ad_" + Request.QueryString["tablename"] + "   left join table custom on ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_userid =custom.userid where ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_id = " + Request.QueryString["id"]+"";
        }
Exemplo n.º 20
0
        protected void RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            /*************************************************************************************/

            // Get the UserId of the just-added user
            MembershipUser newUser   = Membership.GetUser(RegisterUser.UserName);
            Guid           newUserId = (Guid)newUser.ProviderUserKey;

            // Insert a new record into UserProfiles
            //string connectionString = Connection_Manger.getConnection();
            //SqlConnection conn = Connection_Manger.getConnection();
            //ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
            MessageBox.Show(newUserId.ToString());
            //int a = Convert.ToInt32(newUserId.ToString());
            //string insertSql = "INSERT INTO custom_profile values('"+newUserId+"','firstname','lastname','mobile','address','city')";
            string insertSql = "INSERT INTO custom_profile(Userid, firstname,lastname,mobile,country,city,address,picture) VALUES(@UserId, @firstname,@lastname,@mobile,@country,@City,@address,@picture)";

            /*try
             * {
             *  conn.Open();
             *  SqlCommand command = new SqlCommand(insertSql, conn);
             *
             *  command.ExecuteNonQuery();
             * }
             * catch (Exception sqe)
             * {
             *
             *  MessageBox.Show(sqe.Message);
             *
             * }
             * conn.Close();
             */

            using (SqlConnection conn = Connection_Manger.getConnection())


            {
                conn.Open();
                SqlCommand myCommand = new SqlCommand(insertSql, conn);
                myCommand.Parameters.AddWithValue("@UserId", newUserId);
                myCommand.Parameters.AddWithValue("@firstname", DBNull.Value);
                myCommand.Parameters.AddWithValue("@lastname", DBNull.Value);
                myCommand.Parameters.AddWithValue("@mobile", DBNull.Value);
                myCommand.Parameters.AddWithValue("@country", DBNull.Value);
                myCommand.Parameters.AddWithValue("@city", DBNull.Value);
                myCommand.Parameters.AddWithValue("@address", DBNull.Value);
                myCommand.Parameters.AddWithValue("@picture", DBNull.Value);
                myCommand.ExecuteNonQuery();
                conn.Close();
            }



            /*************************************************************************************/


            FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */);

            string continueUrl = RegisterUser.ContinueDestinationPageUrl;

            if (String.IsNullOrEmpty(continueUrl))
            {
                continueUrl = "~/";
            }
            Response.Redirect(continueUrl);
        }
Exemplo n.º 21
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string query = "";

            if (DropDownList2.SelectedValue.Equals("Books"))
            {
                query = "select title ,description,city ,date ,province,price from adbook WHERE title ='" + TextBox1.Text + "' and price between '" + TextBox2.Text + "' and '" + TextBox3.Text + "' and city='" + DropDownList1.SelectedValue + "' ";
            }
            else if (DropDownList2.SelectedValue.Equals("Cameras"))
            {
                query = "select title ,description,city ,date ,province,price from adcamera WHERE title ='" + TextBox1.Text + "' and price between '" + TextBox2.Text + "' and '" + TextBox3.Text + "' and city='" + DropDownList1.SelectedValue + "' ";
            }
            else if (DropDownList2.SelectedValue.Equals("Home Appliances"))
            {
                query = "select title ,description,city ,date ,province,price from adhomeappliences WHERE title ='" + TextBox1.Text + "' and price between '" + TextBox2.Text + "' and '" + TextBox3.Text + "' and city='" + DropDownList1.SelectedValue + "' ";
            }
            else if (DropDownList2.SelectedValue.Equals("LapTops"))
            {
                query = "select title ,description,city ,date ,province,price from adlaptop WHERE title ='" + TextBox1.Text + "' and price between '" + TextBox2.Text + "' and '" + TextBox3.Text + "' and city='" + DropDownList1.SelectedValue + "' ";
            }
            else if (DropDownList2.SelectedValue.Equals("Mobiles"))
            {
                query = "select title ,description,city ,date ,province,price from admobile WHERE title ='" + TextBox1.Text + "' and price between '" + TextBox2.Text + "' and '" + TextBox3.Text + "' and city='" + DropDownList1.SelectedValue + "' ";
            }
            else if (DropDownList2.SelectedValue.Equals("Pcs"))
            {
                query = "select title ,description,city ,date ,province,price from adpc WHERE title ='" + TextBox1.Text + "' and price between '" + TextBox2.Text + "' and '" + TextBox3.Text + "' and city='" + DropDownList1.SelectedValue + "' ";
            }
            else if (DropDownList2.SelectedValue.Equals("Real Estates"))
            {
                query = "select title ,description,city ,date ,province,price from adRealEastate WHERE title ='" + TextBox1.Text + "' and price between '" + TextBox2.Text + "' and '" + TextBox3.Text + "' and city='" + DropDownList1.SelectedValue + "' ";
            }

            SqlConnection connection = Connection_Manger.getConnection();
            SqlCommand    cmd        = new SqlCommand(query, connection);



            try
            {
                //to call a SP from SqlCommand use this
                //cmd.CommandType = CommandType.StoredProcedure;
                connection.Open();
                SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                int           i      = 0;
                //we'll check if there is any data in reader? if so then proceed otherwise terminate
                //and inform user

                if (reader.HasRows)
                {
                    result_message.Text = "Search Results";
                    //looping through the fetched result set
                    while (reader.Read())
                    {
                        //for each record/touple/row we'll call a procedure
                        //that will load data dynamically into the Div Controls....
                        this.divz(reader["title"].ToString(), reader["price"].ToString(), reader["description"].ToString(), reader["date"].ToString(), reader["city"].ToString(), reader["province"].ToString(), i++);
                    }
                }

                else
                {
                    result_message.Text = "No Record Found";
                }
            }

            catch (Exception ex)
            {
                result_message.Text = "Can not open connection !" + ex.Message;
            }


            if (DropDownList2.SelectedValue.Equals("Eating Outlets"))
            {
                query = "select title ,description,city ,date ,province,user_name from adEatingOutlet WHERE title ='" + TextBox1.Text + "' and city='" + DropDownList1.SelectedValue + "' ";



                SqlConnection conn    = Connection_Manger.getConnection();
                SqlCommand    command = new SqlCommand(query, connection);



                try
                {
                    //to call a SP from SqlCommand use this
                    //cmd.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    int           i      = 0;
                    //we'll check if there is any data in reader? if so then proceed otherwise terminate
                    //and inform user

                    if (reader.HasRows)
                    {
                        result_message.Text = "Search Results";
                        //looping through the fetched result set
                        while (reader.Read())
                        {
                            //for each record/touple/row we'll call a procedure
                            //that will load data dynamically into the Div Controls....
                            this.divz(reader["title"].ToString(), reader["user_name"].ToString(), reader["description"].ToString(), reader["date"].ToString(), reader["city"].ToString(), reader["province"].ToString(), i++);
                        }
                    }

                    else
                    {
                        result_message.Text = "No Record Found";
                    }
                }

                catch (Exception ex)
                {
                    result_message.Text = "Can not open connection !" + ex.Message;
                }
            }


            if (DropDownList2.SelectedValue.Equals("Eating Outlets"))
            {
                query = "select title ,description,city ,date ,province,user_name from adEatingOutlet WHERE title ='" + TextBox1.Text + "' and city='" + DropDownList1.SelectedValue + "' ";



                SqlConnection conn    = Connection_Manger.getConnection();
                SqlCommand    command = new SqlCommand(query, connection);



                try
                {
                    //to call a SP from SqlCommand use this
                    //cmd.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    int           i      = 0;
                    //we'll check if there is any data in reader? if so then proceed otherwise terminate
                    //and inform user

                    if (reader.HasRows)
                    {
                        result_message.Text = "Search Results";
                        //looping through the fetched result set
                        while (reader.Read())
                        {
                            //for each record/touple/row we'll call a procedure
                            //that will load data dynamically into the Div Controls....
                            this.divz(reader["title"].ToString(), reader["user_name"].ToString(), reader["description"].ToString(), reader["date"].ToString(), reader["city"].ToString(), reader["province"].ToString(), i++);
                        }
                    }

                    else
                    {
                        result_message.Text = "No Record Found";
                    }
                }

                catch (Exception ex)
                {
                    result_message.Text = "Can not open connection !" + ex.Message;
                }
            }


            else if (DropDownList2.SelectedValue.Equals("Events"))
            {
                query = "select title ,location,city ,date ,province,event_datetime from adevent WHERE title ='" + TextBox1.Text + "' and city='" + DropDownList1.SelectedValue + "' ";



                SqlConnection conn    = Connection_Manger.getConnection();
                SqlCommand    command = new SqlCommand(query, connection);



                try
                {
                    //to call a SP from SqlCommand use this
                    //cmd.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    int           i      = 0;
                    //we'll check if there is any data in reader? if so then proceed otherwise terminate
                    //and inform user

                    if (reader.HasRows)
                    {
                        result_message.Text = "Search Results";
                        //looping through the fetched result set
                        while (reader.Read())
                        {
                            //for each record/touple/row we'll call a procedure
                            //that will load data dynamically into the Div Controls....
                            this.divz(reader["title"].ToString(), reader["location"].ToString(), reader["event_datetime"].ToString(), reader["date"].ToString(), reader["city"].ToString(), reader["province"].ToString(), i++);
                        }
                    }

                    else
                    {
                        result_message.Text = "No Record Found";
                    }
                }

                catch (Exception ex)
                {
                    result_message.Text = "Can not open connection !" + ex.Message;
                }
            }



            else if (DropDownList2.SelectedValue.Equals("Jobs"))
            {
                query = "select title ,description,city ,date ,province,company_id from adjob WHERE title ='" + TextBox1.Text + "' and city='" + DropDownList1.SelectedValue + "' ";



                SqlConnection conn    = Connection_Manger.getConnection();
                SqlCommand    command = new SqlCommand(query, connection);



                try
                {
                    //to call a SP from SqlCommand use this
                    //cmd.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    int           i      = 0;
                    //we'll check if there is any data in reader? if so then proceed otherwise terminate
                    //and inform user

                    if (reader.HasRows)
                    {
                        result_message.Text = "Search Results";
                        //looping through the fetched result set
                        while (reader.Read())
                        {
                            //for each record/touple/row we'll call a procedure
                            //that will load data dynamically into the Div Controls....
                            this.divz(reader["title"].ToString(), reader["company_id"].ToString(), reader["description"].ToString(), reader["date"].ToString(), reader["city"].ToString(), reader["province"].ToString(), i++);
                        }
                    }

                    else
                    {
                        result_message.Text = "No Record Found";
                    }
                }

                catch (Exception ex)
                {
                    result_message.Text = "Can not open connection !" + ex.Message;
                }
            }
            else if (DropDownList2.SelectedValue.Equals("Services"))
            {
                query = "select type ,description,city ,date ,province from adService WHERE title ='" + TextBox1.Text + "' and city='" + DropDownList1.SelectedValue + "' ";



                SqlConnection conn    = Connection_Manger.getConnection();
                SqlCommand    command = new SqlCommand(query, connection);



                try
                {
                    //to call a SP from SqlCommand use this
                    //cmd.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    int           i      = 0;
                    //we'll check if there is any data in reader? if so then proceed otherwise terminate
                    //and inform user

                    if (reader.HasRows)
                    {
                        result_message.Text = "Search Results";
                        //looping through the fetched result set
                        while (reader.Read())
                        {
                            //for each record/touple/row we'll call a procedure
                            //that will load data dynamically into the Div Controls....
                            this.divz(reader["type"].ToString(), "", reader["description"].ToString(), reader["date"].ToString(), reader["city"].ToString(), reader["province"].ToString(), i++);
                        }
                    }

                    else
                    {
                        result_message.Text = "No Record Found";
                    }
                }

                catch (Exception ex)
                {
                    result_message.Text = "Can not open connection !" + ex.Message;
                }
            }
        }