Ejemplo n.º 1
0
        protected void btnSearchAll_Click(object sender, EventArgs e)
        {
            DataTable dt = SqlObject.FetchDataTable("select * from seller");

            if (dt.Rows.Count != 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var    address         = dt.Rows[i]["location"].ToString();
                    var    locationService = new GoogleLocationService();
                    var    point           = locationService.GetLatLongFromAddress(address);
                    var    latitude        = point.Latitude;
                    var    longitude       = point.Longitude;
                    String htmltext        = "   <div class='col - md - 3 top - deal - top'><div class='top-deal'>" +
                                             "<a href = 'details.aspx' class='mask'>" +
                                             "<iframe src = 'https://maps.google.com/maps?q=" + latitude + "," + longitude + "&hl=es;z=14&amp;output=embed'></iframe></ a >" +
                                             "<div class='deal-bottom'>" +
                                             "<div class='top-deal1'>" +
                                             "<h5><a href = 'details.aspx' > " + dt.Rows[i]["location"].ToString() + " </ a ></ h5 >" +
                                             "<p> Available Rooms : " + dt.Rows[i]["availableroom"].ToString() + "</p>" +
                                             "<p>Rent : $ " + dt.Rows[i]["rent"].ToString() + "</p>" +
                                             "</div>" +
                                             "<div class='top-deal2'>" +
                                             "<a href = 'details.aspx?id=" + dt.Rows[i]["sellerid"].ToString() + "' class='hvr-sweep-to-right more'>More</a>" +
                                             "</div>" +
                                             "<div class='clearfix'></div>" +
                                             "</div>" +
                                             "</div>" +
                                             "</div>";
                    LiteralControl div1 = new LiteralControl(htmltext);
                    divAllRooms.Controls.Add(div1);
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            DataTable dt = SqlObject.FetchDataTable("select * from seller join review on seller.sellerid = review.sellerid join facility on facility.sellerid=seller.sellerid where review.rating = '" + ddlRating.SelectedValue.ToString() + "' and facility.bed = '" + chkFacilities.Items[0].Selected + "' or facility.parking = '" + chkFacilities.Items[1].Selected + "' or facility.transport = '" + chkFacilities.Items[2].Selected + "' or facility.wifi = '" + chkFacilities.Items[3].Selected + "' or facility.tv = '" + chkFacilities.Items[4].Selected + "' or facility.laundry = '" + chkFacilities.Items[5].Selected + "' or facility.heater = '" + chkFacilities.Items[6].Selected + "' or facility.breakfast = '" + chkFacilities.Items[7].Selected + "' and seller.availableroom = '" + ddlRooms.SelectedValue.ToString() + "' and seller.rent > '" + ddlPriceFrom.SelectedValue.ToString() + "' and seller.rent < '" + ddlPriceTo.SelectedValue.ToString() + "'");

            if (dt.Rows.Count != 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var    address         = dt.Rows[i]["location"].ToString();
                    var    locationService = new GoogleLocationService();
                    var    point           = locationService.GetLatLongFromAddress(address);
                    var    latitude        = point.Latitude;
                    var    longitude       = point.Longitude;
                    String htmltext        = "   <div class='col - md - 3 top - deal - top'><div class='top-deal'>" +
                                             "<a href = 'details.aspx' class='mask'>" +
                                             "<iframe src = 'https://maps.google.com/maps?q=" + latitude + "," + longitude + "&hl=es;z=14&amp;output=embed'></iframe></ a >" +
                                             "<div class='deal-bottom'>" +
                                             "<div class='top-deal1'>" +
                                             "<h5><a href = 'details.aspx' > " + dt.Rows[i]["location"].ToString() + " </ a ></ h5 >" +
                                             "<p> Available Rooms : " + dt.Rows[i]["availableroom"].ToString() + "</p>" +
                                             "<p>Rent : $ " + dt.Rows[i]["rent"].ToString() + "</p>" +
                                             "</div>" +
                                             "<div class='top-deal2'>" +
                                             "<a href = 'details.aspx?id=" + dt.Rows[i]["sellerid"].ToString() + "' class='hvr-sweep-to-right more'>More</a>" +
                                             "</div>" +
                                             "<div class='clearfix'></div>" +
                                             "</div>" +
                                             "</div>" +
                                             "</div>";
                    LiteralControl div1 = new LiteralControl(htmltext);
                    divAllRooms.Controls.Add(div1);
                }
            }
        }
Ejemplo n.º 3
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            DataTable dt = SqlObject.FetchDataTable("SELECT * FROM dbo.person WHERE username = '******' and password = '******'");

            if (dt.Rows.Count != 0)
            {
                Session["personid"] = dt.Rows[0]["PERSONID"].ToString();
                Session["username"] = dt.Rows[0]["USERNAME"].ToString();
                Response.Redirect("~/allRooms.aspx");
            }
            else
            {
                lblError.Text = "Invalid Username or password.Try again.";
            }
        }
Ejemplo n.º 4
0
        protected void btnSaveRoomDetails_Click(object sender, EventArgs e)
        {
            //add to seller table
            UserDetails.TableName = "tblSELLER";
            SqlObject._objCmd.Parameters.Clear();
            SqlObject._objCmd.Parameters.AddWithValue("agentid", Session["personid"].ToString());
            SqlObject._objCmd.Parameters.AddWithValue("title", txtTitle.Text);
            SqlObject._objCmd.Parameters.AddWithValue("availableroom", txtAvailableRoom.Text);
            SqlObject._objCmd.Parameters.AddWithValue("vacancy", txtVacancy.Text);
            SqlObject._objCmd.Parameters.AddWithValue("rent", txtRent.Text);
            SqlObject._objCmd.Parameters.AddWithValue("location", txtAddress.Text);
            SqlObject._objCmd.Parameters.AddWithValue("description", txtDescription.Text);
            UserDetails.Insert();
            //add to facility table
            DataTable dt = SqlObject.FetchDataTable("SELECT * FROM dbo.seller WHERE title = '" + txtTitle.Text + "' and availableroom = '" + txtAvailableRoom.Text + "' and vacancy = '" + txtVacancy.Text + "' and rent = '" + txtRent.Text + "' and location like '" + txtAddress.Text + "' ");

            UserDetails.TableName = "tblFACILITY";
            SqlObject._objCmd.Parameters.Clear();
            SqlObject._objCmd.Parameters.AddWithValue("sellerid", dt.Rows[0]["SELLERID"].ToString());
            int i = 1;

            foreach (ListItem item in chkFacilities.Items)
            {
                SqlObject._objCmd.Parameters.AddWithValue("a" + i, item.Selected);
                i++;
            }
            UserDetails.Insert();
            //add to rule table
            UserDetails.TableName = "tblRULE";
            SqlObject._objCmd.Parameters.Clear();
            SqlObject._objCmd.Parameters.AddWithValue("sellerid", dt.Rows[0]["SELLERID"].ToString());
            SqlObject._objCmd.Parameters.AddWithValue("rules", txtRules.Text);
            UserDetails.Insert();
            UserDetails.TableName = "tblREVIEW";
            SqlObject._objCmd.Parameters.Clear();
            SqlObject._objCmd.Parameters.AddWithValue("sellerid", dt.Rows[0]["SELLERID"].ToString());
            SqlObject._objCmd.Parameters.AddWithValue("userid", dt.Rows[0]["AGENTID"].ToString());
            SqlObject._objCmd.Parameters.AddWithValue("comment", "No reviews or feedback yet available");
            Random random       = new Random();
            int    randomNumber = random.Next(0, 6);

            SqlObject._objCmd.Parameters.AddWithValue("rating", randomNumber);
            UserDetails.Insert();
            lbladdRoomNotification.Visible   = true;
            lbladdRoomNotification.Text      = "Room added successfully.";
            lbladdRoomNotification.ForeColor = System.Drawing.Color.Green;
        }
Ejemplo n.º 5
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            try
            {
                UserDetails.TableName = "tblPERSON";
                SqlObject._objCmd.Parameters.Clear();
                SqlObject._objCmd.Parameters.AddWithValue("role", rbtnRoleList.SelectedValue);
                SqlObject._objCmd.Parameters.AddWithValue("name", txtNameRegister.Text);
                SqlObject._objCmd.Parameters.AddWithValue("contact", txtEmailRegister.Text);
                SqlObject._objCmd.Parameters.AddWithValue("username", txtUsernameRegister.Text);
                SqlObject._objCmd.Parameters.AddWithValue("password", txtPasswordRegister.Text);

                UserDetails.Insert();

                DataTable dt = SqlObject.FetchDataTable("SELECT PERSONID FROM dbo.person WHERE contact = '" + txtEmailRegister.Text + "'");
                Session["personid"] = dt.Rows[0]["PERSONID"].ToString();
                Session["username"] = txtUsernameRegister.Text;
                Response.Redirect("~/allRooms.aspx");
            }
            catch (Exception er)
            {
                txtNameRegister.Text = er.Message.ToString();
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Session["sellerid"] = Request.QueryString["id"];;
                if (Session["personid"] == null)
                {
                    Response.Redirect("~/index.aspx");
                }
                else if (Session["sellerid"] != null)
                {
                    DataTable dtSeller = SqlObject.FetchDataTable("select  * from dbo.person,dbo.seller,dbo.facility where dbo.seller.sellerid = '" + Session["sellerid"].ToString() + "' and agentid=dbo.person.personid and dbo.facility.sellerid= dbo.seller.sellerid ");
                    DataTable dtRules  = SqlObject.FetchDataTable("select * from rules where sellerid = '" + Session["sellerid"].ToString() + "'");
                    DataTable dtReview = SqlObject.FetchDataTable("select * from review where sellerid = '" + Session["sellerid"].ToString() + "'");
                    //show room details
                    lblavailablerooms.Text = dtSeller.Rows[0]["availableroom"].ToString();
                    lblvacancy.Text        = dtSeller.Rows[0]["vacancy"].ToString();
                    lblTitle.Text          = dtSeller.Rows[0]["title"].ToString();
                    lblrent.Text           = dtSeller.Rows[0]["rent"].ToString();
                    lblBed.Text            = yesno(dtSeller.Rows[0]["bed"].ToString());
                    lblParking.Text        = yesno(dtSeller.Rows[0]["parking"].ToString());
                    lblTransport.Text      = yesno(dtSeller.Rows[0]["transport"].ToString());
                    lblWifi.Text           = yesno(dtSeller.Rows[0]["wifi"].ToString());
                    lblTv.Text             = yesno(dtSeller.Rows[0]["tv"].ToString());
                    lblLaundry.Text        = yesno(dtSeller.Rows[0]["laundry"].ToString());
                    lblHeater.Text         = yesno(dtSeller.Rows[0]["heater"].ToString());
                    lblBreakfast.Text      = yesno(dtSeller.Rows[0]["breakfast"].ToString());
                    //contact info
                    lblContact.Text     = " Name: " + dtSeller.Rows[0]["name"].ToString() + "    Email:" + dtSeller.Rows[0]["contact"].ToString();
                    lblDescription.Text = dtSeller.Rows[0]["description"].ToString();
                    lblRules.Text       = dtRules.Rows[0]["rules"].ToString();
                    int rate = Convert.ToInt32(dtReview.Rows[0]["rating"].ToString());
                    switch (rate)
                    {
                    case 1:
                        star1.Checked = true;
                        break;

                    case 2:
                        star2.Checked = true;
                        break;

                    case 3:
                        star3.Checked = true;
                        break;

                    case 4:
                        star4.Checked = true;
                        break;

                    case 5:
                        star5.Checked = true;
                        break;

                    default:
                        break;
                    }
                    //fetch map for the location
                    var address         = dtSeller.Rows[0]["location"].ToString();
                    var locationService = new GoogleLocationService();
                    var point           = locationService.GetLatLongFromAddress(address);
                    var latitude        = point.Latitude;
                    var longitude       = point.Longitude;
                    mapFrame.Src = "https://maps.google.com/maps?q=" + latitude + "," + longitude + "&hl=es;z=14&amp;output=embed";
                }
                else
                {
                    Response.Redirect("~/allRooms.aspx");
                }
            }
            catch (Exception err)
            {
            }
        }