protected void btnAssign_Click(object sender, EventArgs e)
 {
     lblWONum.Visible = false;
     string workOrderNum;
     string empNum;
     workOrderNum = ddlWOList.SelectedValue;
     empNum = ddlEmpList.SelectedValue;
     try
     {
         string connection = ConfigurationManager.ConnectionStrings["testDB"].ConnectionString;
         SqlConnection conn = new SqlConnection(connection);
         SqlCommand cmd = new SqlCommand("UPDATE WorkOrder SET EmpID = @EmpID WHERE WorkOrderID = @WorkOrderID;", conn);
         cmd.Parameters.AddWithValue("@EmpID", empNum);
         cmd.Parameters.AddWithValue("@WorkOrderID", workOrderNum);
         conn.Open();
         cmd.ExecuteNonQuery();
         conn.Close();
         //call the mail class to send the notification
         SendMail sm = new SendMail();
         bool success = sm.Send_EmpEmail(workOrderNum);
         //Check to see if the email was actually sent or not
         if (success)
         {
             lblWONum.Text = ddlEmpList.SelectedItem.ToString() + " was assigned to work order #" + workOrderNum + " and they were notified by email.";
             lblWONum.Visible = true;
         }
         else
         {
             //If there was a problem display this message
             lblWONum.Text = "There was a problem sending the notification email. But the employee was assigned to the workorder. Please try again later";
             lblWONum.ForeColor = System.Drawing.Color.Red;
             lblWONum.Visible = true;
         }
     }
     catch (SqlException ex)
     {
         lblWONum.Text = "The work order was not assigned due to an error";
         lblWONum.ForeColor = System.Drawing.Color.Red;
         lblWONum.Visible = true;
     }
 }