Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["New"] != null)
        {
            if (!IsPostBack)
            {
                WelcomeLabel.Text += Session["Email"].ToString();
                DataSet ds = client.GetFlatsLandlord(Session["Email"].ToString().Trim());
                GridViewAllFlats.DataSource = ds.Tables[0];

                GridViewAllFlats.DataBind();
                if (ds.Tables[0].Rows.Count == 0)
                {
                    LabelNoFlats.Visible = true;
                }
                else
                {
                    LabelNoFlats.Visible = false;
                }
            }
            for (int i = 0; i < GridViewAllFlats.Rows.Count; i++)
            {
                if ((GridViewAllFlats.Rows[i].Cells[2].Text.Trim() == "Closed") || (GridViewAllFlats.Rows[i].Cells[2].Text.Trim() == "Pending"))
                {
                    GridViewAllFlats.Rows[i].Cells[6].FindControl("ButtonSend").Visible = false;
                }
            }
        }
        else
        {
            Response.Redirect("Register.aspx");
        }
    }
Example #2
0
    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");
        }
    }