protected void Page_Load(object sender, EventArgs e) { if (Session["New"] != null) { if (Session["Type"].ToString() == "Student") { if (!IsPostBack) { WelcomeLabel.Text += Session["Email"].ToString(); DataSet ds1 = client.GetWishlist(Session["Email"].ToString()); GridView1.DataSource = ds1.Tables[0]; GridView1.DataBind(); } DataSet ds2 = client.GetAllFlats(); for (int i = 0; i < GridView1.Rows.Count; i++) { if (Convert.ToInt32(GridView1.Rows[i].Cells[2].Text) == 1) { int rowCount = 0; int finalRow = 0; string status; foreach (DataRow row in ds2.Tables[0].Rows) { if ((row["Id"].ToString().Trim()).Equals(GridView1.Rows[i].Cells[0].Text.Trim())) { finalRow = rowCount; } rowCount++; status = ds2.Tables[0].Rows[finalRow]["Status"].ToString().Trim(); if (status.Equals("Pending")) { GridView1.Rows[i].Cells[4].FindControl("ButtonAccept").Visible = true; GridView1.Rows[i].Cells[4].FindControl("ButtonDeny").Visible = true; } else { GridView1.Rows[i].Cells[4].FindControl("ButtonAccept").Visible = false; GridView1.Rows[i].Cells[4].FindControl("ButtonDeny").Visible = false; } } } } } else if (Session["Type"].ToString() == "Landlord") { Response.Redirect("MainPageLandlord.aspx"); } } else { Response.Redirect("Register.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["New"] != null) { if (!IsPostBack) { if (Session["Type"].ToString() == "Landlord") { WelcomeLabel.Text += Session["New"].ToString(); DataSet ds = client.GetFlatsLandlord(Session["New"].ToString()); DropDownList1.DataSource = ds; DropDownList1.DataBind(); } int rowCount = 0; int finalRow = 0; DataSet ds2 = client.GetAllFlats(); foreach (DataRow row in ds2.Tables[0].Rows) { if ((row["Id"].ToString().Trim()).Equals(DropDownList1.SelectedValue)) { finalRow = rowCount; } rowCount++; LabelStatus.Text = ds2.Tables[0].Rows[finalRow]["Status"].ToString().Trim(); LabelId.Text = DropDownList1.SelectedValue.ToString().Trim(); TextBoxDeposit.Text = ds2.Tables[0].Rows[finalRow]["Deposit"].ToString().Trim(); TextBoxRent.Text = ds2.Tables[0].Rows[finalRow]["Rent"].ToString().Trim(); TextBoxDescription.Text = ds2.Tables[0].Rows[finalRow]["Description"].ToString().Trim(); } } } else { Response.Redirect("Register.aspx"); } }
private void BindFlatsDataAll() { DataSet ds = client.GetAllFlats(); DataTable dt2 = new DataTable(); dt2.Columns.Add("Id"); dt2.Columns.Add("LandlordEmail"); dt2.Columns.Add("Type"); dt2.Columns.Add("Address"); dt2.Columns.Add("PostCode"); dt2.Columns.Add("City"); dt2.Columns.Add("Rent"); dt2.Columns.Add("Deposit"); dt2.Columns.Add("AvailableFrom"); dt2.Columns.Add("DateOfCreation"); dt2.Columns.Add("Description"); dt2.Columns.Add("Status"); dt2.Columns.Add("Date_of_offer"); ds.Tables.Add(dt2); GridViewAllFlats.DataSource = ds.Tables[0]; GridViewAllFlats.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["New"] != null) { if (Session["Type"].ToString() == "Landlord") { if (!IsPostBack) { WelcomeLabel.Text += Session["New"].ToString(); DataSet ds = client.GetAllFlats(); int finalRow = 0; int rowCount = 0; foreach (DataRow row in ds.Tables[0].Rows) { if ((row["Id"].ToString().Trim()).Equals(Session["Flat"].ToString().Trim())) { DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Columns.Add("LandlordEmail"); dt.Columns.Add("Type"); dt.Columns.Add("Address"); dt.Columns.Add("PostCode"); dt.Columns.Add("City"); dt.Columns.Add("Rent"); dt.Columns.Add("Deposit"); dt.Columns.Add("AvailableFrom"); dt.Columns.Add("DateOfCreation"); dt.Columns.Add("Description"); dt.Columns.Add("Status"); dt.Columns.Add("DateOfOffer"); dt.ImportRow(row); finalRow = rowCount; FormView1.DataSource = dt; FormView1.DataBind(); } rowCount++; } } } else { Response.Redirect("Register.aspx"); } } else { Response.Redirect("Register.aspx"); } using (var client = new GoogleMapsGeolocationClient()) { try { Label IDLabel1 = (Label)FormView1.FindControl("AddressLabel"); Label IDLabel2 = (Label)FormView1.FindControl("CityLabel"); string MyValue = IDLabel2.Text + ", " + IDLabel1.Text; string[] location = client.GetLattitudeAndLogitudeByAdress(MyValue).Split('#'); LabelGoogleMaps.Visible = true; string url1 = "https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=" + location[0].Replace(',', '.') + "," + location[1].Replace(',', '.') + " (custom heading)&output=embed"; loc.Value = url1; } catch { Response.Redirect("ErrorPage.aspx"); } } }