protected void Page_Load(object sender, EventArgs e) { //This is to redirect the page if the user is not logged in if (string.IsNullOrEmpty((string)Session["role"])) { Response.Redirect("~/"); } if (!IsPostBack) { SqlConnection connection = new SqlConnection(Strcon); connection.Open(); SqlCommand Command = new SqlCommand("SELECT allocatedquarter.emp_id from allocatedquarter INNER JOIN rent ON allocatedquarter.emp_id=rent.emp_id WHERE rent.rent_status='Due'", connection); EmpID.DataSource = Command.ExecuteReader(); EmpID.DataBind(); EmpID.Items.Insert(0, new ListItem("Select a employee ID", "")); RentGrid.DataBind(); connection.Close(); } }
protected void Page_Load(object sender, EventArgs e) { //This is to redirect the page if the user is not logged in if (string.IsNullOrEmpty((string)Session["role"])) { Response.Redirect("~/"); } if (!IsPostBack) { SqlConnection connection = new SqlConnection(Strcon); connection.Open(); SqlCommand Command = new SqlCommand("SELECT employee.emp_id from employee LEFT JOIN allocatedquarter ON allocatedquarter.emp_id=employee.emp_id WHERE allocatedquarter.emp_id IS NULL;", connection); SqlCommand Command2 = new SqlCommand("SELECT quarterlist.quarter_id from quarterlist LEFT JOIN allocatedquarter ON allocatedquarter.quarter_id=quarterlist.quarter_id WHERE allocatedquarter.quarter_id IS NULL;", connection); EmpID.DataSource = Command.ExecuteReader(); QuarterID.DataSource = Command2.ExecuteReader(); EmpID.DataBind(); QuarterID.DataBind(); QuarterID.Items.Insert(0, new ListItem("Select a quarter ID", "")); EmpID.Items.Insert(0, new ListItem("Select a employee ID", "")); QuarterInfo.DataBind(); connection.Close(); } }