protected void ButtonReopen_Click(object sender, EventArgs e) { if (MessageBox.Show("If you click yes the flat will be open and people can apply for it. Are you sure you want to continue?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { client.UpdateFlatStatus(Convert.ToInt32(DropDownList1.SelectedValue), "Open", "", Calendar1.SelectedDate.ToString("dd / MM / yyyy")); LabelStatus.Text = "Open"; if (client.UpdateFlatStatus(Convert.ToInt32(DropDownList1.SelectedValue), "Open", "", Calendar1.SelectedDate.ToString("dd / MM / yyyy")) == true) { LabelStatusUpdated.Text = "Flat sucessfully updated"; } else { LabelStatusUpdated.Text = "Flat failed to be updated"; } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Send") { int flatId = Convert.ToInt32(GridViewAllFlats.Rows[int.Parse(e.CommandArgument.ToString())].Cells[0].Text); string availableFrom = GridViewAllFlats.Rows[int.Parse(e.CommandArgument.ToString())].Cells[4].Text.Trim(); client.UpdateFlatStatus(flatId, "Pending", "", availableFrom); Response.Redirect("MainPageLandlord.aspx"); } if (e.CommandName == "View") { Session["Flat"] = Convert.ToInt32(GridViewAllFlats.Rows[int.Parse(e.CommandArgument.ToString())].Cells[0].Text); Response.Redirect("FlatsDetailsLandlord.aspx"); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Remove") { int flatId = Convert.ToInt32(GridView1.Rows[int.Parse(e.CommandArgument.ToString())].Cells[0].Text); string studentEmail = Session["Email"].ToString(); client.RemoveFromWishlist(studentEmail.Trim(), flatId); Response.Redirect("WishList.aspx"); } if (e.CommandName == "Accept") { if (MessageBox.Show("If you click yes the flat will be removed from wishlist and you will pay a fee. Do you wish to continue?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { int flatId = Convert.ToInt32(GridView1.Rows[int.Parse(e.CommandArgument.ToString())].Cells[0].Text); if (client.ConfirmTenants(flatId, Session["Email"].ToString().Trim())) { client.UpdateFlatStatus(flatId, "Closed", "", "Not available"); string studentEmail = Session["Email"].ToString(); client.RemoveFromWishlist(studentEmail.Trim(), flatId); Response.Redirect("WishList.aspx"); } else { Response.Redirect("ErrorPage.aspx"); } } else { int flatId = Convert.ToInt32(GridView1.Rows[int.Parse(e.CommandArgument.ToString())].Cells[0].Text); string studentEmail = Session["Email"].ToString(); client.RemoveFromWishlist(studentEmail.Trim(), flatId); Response.Redirect("WishList.aspx"); } } if (e.CommandName == "Deny") { if (MessageBox.Show("If you click yes the flat will be removed from wishlist. Do you wish to continue?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { int flatId = Convert.ToInt32(GridView1.Rows[int.Parse(e.CommandArgument.ToString())].Cells[0].Text); string studentEmail = Session["Email"].ToString(); client.RemoveFromWishlist(studentEmail.Trim(), flatId); Response.Redirect("WishList.aspx"); } } }