//Build list of files uploaded.
    private void buildUploadTbl(MySqlConnection mySqlConnection)
    {
        if (tblUploads.Rows.Count > 1)
        {
            for (int i = tblUploads.Rows.Count - 1; i > 0; i--)
            {
                tblUploads.Rows.RemoveAt(i);
            }
        }
        MySqlCommand command = mySqlConnection.CreateCommand();
        int          staffID = Convert.ToInt32(Context.Request["StaffID"]);

        command.CommandText = @"SELECT Attachments.ID, FileName, AttchType, FileVersion, FileDate FROM Attachments LEFT JOIN TypeList ON Attachments.FileType = TypeList.ID WHERE AppID = " + Context.Request["AppID"];
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows)
        {
            while (reader.Read()) //Build each row.
            {
                HtmlTableRow row = new HtmlTableRow();

                //Display filename as a hyperlink, so file can be opened.
                HtmlTableCell statusCell = HTMLFactory.buildCell("200", "left", "");
                HyperLink     hl         = new HyperLink();
                hl.Text        = reader["FileName"].ToString();
                hl.NavigateUrl = "http://curtinethics-001-site1.smarterasp.net/Uploads/" + Request["AppID"].ToString() + "_" + reader["FileName"].ToString();
                hl.Target      = "_blank";
                statusCell.Controls.Add(hl);

                row.Cells.Add(statusCell);
                row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["AttchType"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("97", "left", reader["FileVersion"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", reader["FileDate"].ToString()));

                tblUploads.Rows.Add(row);
            }
        }
        else
        {
            if (tblUploads.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 4;
                blnkRow.Cells.Add(blnk);
                tblUploads.Rows.Add(blnkRow);
            }
        }
        reader.Dispose();
    }
    //Build list of CI's.
    private void buildReadCITable(MySqlConnection mySqlConnection)
    {
        MySqlCommand command = mySqlConnection.CreateCommand();

        command.CommandText = @"SELECT staff.StaffID, CONCAT(IFNULL(staff.NameLast,''),', ',IFNULL(staff.NameFirst,'')) AS FullName, a5_coinvestigators.CandidacyAppr, Staff.IntegTraining, RoleList.Role
                                FROM a5_coinvestigators LEFT JOIN staff ON a5_coinvestigators.StaffID = staff.StaffID LEFT JOIN RoleList ON a5_coinvestigators.Role = RoleList.ID 
                                WHERE a5_coinvestigators.AppID = " + Context.Request["AppID"];
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows) //Populate CI table.
        {
            while (reader.Read())
            {
                string chkCand = "";
                string chkIntg = "";

                if (Convert.ToBoolean(reader["CandidacyAppr"]))
                {
                    chkCand = "x";
                }
                if (Convert.ToBoolean(reader["IntegTraining"]))
                {
                    chkIntg = "x";
                }

                HtmlTableRow row = new HtmlTableRow();
                row.Cells.Add(HTMLFactory.buildCell("", "left", reader["FullName"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("", "left", reader["Role"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("", "center", chkCand));
                row.Cells.Add(HTMLFactory.buildCell("", "center", chkIntg));

                tblCI.Rows.Insert(1, row);
            }
        }
        else
        {
            if (tblCI.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 4;
                blnkRow.Cells.Add(blnk);
                tblCI.Rows.Add(blnkRow);
            }
        }
        reader.Dispose();
    }
コード例 #3
0
    //Deletes existing table entries and rebuilds on postback.
    private void buildSubmitted()
    {
        if (tblSubmitted.Rows.Count > 1) //If rows exist, delete.
        {
            for (int i = tblSubmitted.Rows.Count - 1; i > 0; i--)
            {
                tblSubmitted.Rows.RemoveAt(i);
            }
        }
        MySqlConnection mySqlConnection = new Connector().MySQLConnect();
        MySqlCommand    command         = mySqlConnection.CreateCommand();

        command.CommandText = @"SELECT Application.AppID, Application.a1_ProjTitle, Application.DateEndorsed, RiskLow_Bool, RiskNonLow_Bool, SchoolList.School, StatusList.AppStatus 
                                FROM Application LEFT JOIN Staff ON Application.a4_InvestStaffID = Staff.StaffID LEFT JOIN SchoolList ON Staff.School = SchoolList.ID 
                                LEFT JOIN StatusList ON Application.AppStatus = StatusList.ID ORDER BY " + sltSort.Items[sltSort.SelectedIndex].Value; //Uses selected sort value.
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows)       //Build table entries.
        {
            while (reader.Read()) //Build a table row for each row of query.
            {
                HtmlTableRow row = new HtmlTableRow();

                row.Cells.Add(HTMLFactory.buildCell("50", "left", reader["AppID"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("400", "left", reader["a1_ProjTitle"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["AppStatus"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["School"].ToString()));

                tblSubmitted.Rows.Add(row);
            }
        }
        else //Else display none.
        {
            if (tblSubmitted.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 4;
                blnkRow.Cells.Add(blnk);
                tblSubmitted.Rows.Add(blnkRow);
            }
        }
        reader.Dispose(); //Cleanup.
        command.Dispose();
        mySqlConnection.Close();
    }
コード例 #4
0
    //Deletes existing table entries and rebuilds.
    private void buildSubmitted()
    {
        if (tblSubmitted.Rows.Count > 1) //If rows exist, delete.
        {
            for (int i = tblSubmitted.Rows.Count - 1; i > 0; i--)
            {
                tblSubmitted.Rows.RemoveAt(i);
            }
        }
        MySqlConnection mySqlConnection = new Connector().MySQLConnect();
        MySqlCommand    command         = mySqlConnection.CreateCommand();

        command.CommandText = @"SELECT Application.AppID, Application.a1_ProjTitle, Application.DateEndorsed, RiskLow_Bool, RiskNonLow_Bool, SchoolList.School, StatusList.AppStatus 
                                FROM Application LEFT JOIN Staff ON Application.a4_InvestStaffID = Staff.StaffID LEFT JOIN SchoolList ON Staff.School = SchoolList.ID 
                                LEFT JOIN StatusList ON Application.AppStatus = StatusList.ID WHERE (Application.AppStatus = 4 OR Application.AppStatus = 6) AND RiskNonLow_Bool = 1 ORDER BY " +
                              sltSort.Items[sltSort.SelectedIndex].Value;
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows)       //Build table entries.
        {
            while (reader.Read()) //Build a table row for each row of query.
            {
                HtmlTableRow row = new HtmlTableRow();

                HtmlInputButton btnView = new HtmlInputButton();
                btnView.ID           = "ViewPI" + reader["AppID"].ToString();
                btnView.Value        = "View";
                btnView.ServerClick += btnView_ServerClick;

                HtmlInputButton btnReview = new HtmlInputButton();
                btnReview.ID           = "Review" + reader["AppID"].ToString();
                btnReview.Value        = "Email";
                btnReview.ServerClick += btnEndorseReviewer_ServerClick;

                HtmlInputButton btnEndorse = new HtmlInputButton();
                btnEndorse.ID           = "Endorse" + reader["AppID"].ToString();
                btnEndorse.Value        = "Select";
                btnEndorse.ServerClick += btnEndorseLowRisk_ServerClick;

                row.Cells.Add(HTMLFactory.buildCell("50", "left", reader["AppID"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("400", "left", reader["a1_ProjTitle"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["AppStatus"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["School"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("97", "left", reader["DateEndorsed"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", btnView));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", btnReview));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", btnEndorse));

                tblSubmitted.Rows.Add(row);
            }
        }
        else //Else display none.
        {
            if (tblSubmitted.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 8;
                blnkRow.Cells.Add(blnk);
                tblSubmitted.Rows.Add(blnkRow);
            }
        }
        divMsg.InnerText = ""; //Reset notification.
        reader.Dispose();      //Cleanup.
        command.Dispose();
        mySqlConnection.Close();
    }
    //Build the CI unsubmitted table.
    private void buildCIUnsubmittedTbl(MySqlConnection mySqlConnection)
    {
        if (tblCIUnsubmitted.Rows.Count > 1)
        {
            for (int i = tblCIUnsubmitted.Rows.Count - 1; i > 0; i--)
            {
                tblCIUnsubmitted.Rows.RemoveAt(i);
            }
        }
        MySqlCommand command = mySqlConnection.CreateCommand();
        int          staffID = Convert.ToInt32(Context.Request["StaffID"]);

        command.CommandText = @"SELECT Application.AppID, Application.a1_ProjTitle, StatusList.ID, StatusList.AppStatus, Application.Ownership_StaffID, a5_coinvestigators.Declaration, 
                                Application.RiskLow_Bool, Application.RiskNonLow_Bool 
                                FROM Application INNER JOIN a5_coinvestigators ON Application.AppID = a5_coinvestigators.AppID LEFT JOIN 
                                StatusList ON Application.AppStatus = StatusList.ID 
                                WHERE a5_CoInvestigators.StaffID = " + staffID + " AND (Application.AppStatus = 0 OR Application.AppStatus = 2 OR Application.AppStatus = 5)";
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows)
        {
            while (reader.Read()) //Build each row.
            {
                HtmlTableRow row       = new HtmlTableRow();
                string       riskLevel = "";

                //Build buttons.
                HtmlInputButton btnView = new HtmlInputButton();
                btnView.ID           = "ViewCI" + reader["AppID"].ToString();
                btnView.Value        = "View";
                btnView.ServerClick += btnView_ServerClick;

                HtmlInputButton btnDec = new HtmlInputButton();
                btnDec.ID           = "DecCI" + reader["AppID"].ToString();
                btnDec.Value        = "Declaration";
                btnDec.ServerClick += btnDec_ServerClick;

                HtmlInputButton btnEdit = new HtmlInputButton();
                btnEdit.ID           = "EditCI" + reader["AppID"].ToString();
                btnEdit.Value        = "Edit";
                btnEdit.ServerClick += btnEdit_ServerClick;

                Button btnDel = new Button(); //Need to use an ASP button to add the client side confirmation.
                btnDel.ID            = "DelPI" + reader["AppID"].ToString();
                btnDel.Text          = "Delete";
                btnDel.OnClientClick = "return(beforeDelete( ))"; //Asks user if they are sure they want to delete.
                btnDel.Click        += btnDel_ServerClick;

                //Determine if low or non low risk.
                if (Convert.ToBoolean(reader["RiskLow_Bool"]))
                {
                    riskLevel = "Low risk";
                }
                else if (Convert.ToBoolean(reader["RiskNonLow_Bool"]))
                {
                    riskLevel = "Non low risk";
                }

                //If status is HOS declined add a hyperlink to the comment.
                HtmlTableCell statusCell = HTMLFactory.buildCell("200", "left", reader["AppStatus"].ToString());
                if (Convert.ToInt32(reader["ID"]) == 2 || Convert.ToInt32(reader["ID"]) == 5) //HOS declined or incomplete.
                {
                    statusCell.InnerText += " - ";
                    HyperLink hl = new HyperLink();
                    hl.Text = "Comment";
                    char mode = 'R';
                    if (staffID == Convert.ToInt32(reader["Ownership_StaffID"].ToString())) //If CI has control, set to write access.
                    {
                        mode = 'W';
                    }
                    hl.NavigateUrl = "EthicsEditAppS7.aspx?Mode=" + mode + "&AppID=" + reader["AppID"].ToString() + "&StaffID=" + staffID + "&Type=" + Context.Request["Type"];
                    statusCell.Controls.Add(hl);
                }

                row.Cells.Add(HTMLFactory.buildCell("50", "left", reader["AppID"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("400", "left", reader["a1_ProjTitle"].ToString()));
                row.Cells.Add(statusCell);
                row.Cells.Add(HTMLFactory.buildCell("120", "left", riskLevel));

                //If CI has not made declaration, display a button.
                if (Convert.ToBoolean(reader["Declaration"]) == true)
                {
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", "Completed"));
                }
                else
                {
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", btnDec));
                }

                //If CI has been given control, allow editing.
                if (staffID == Convert.ToInt32(reader["Ownership_StaffID"].ToString()))
                {
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", btnEdit));
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", btnDel));
                }
                else
                {
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", btnView));
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", "No control"));
                }

                tblCIUnsubmitted.Rows.Add(row);
            }
        }
        else //Display none.
        {
            if (tblCIUnsubmitted.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 7;
                blnkRow.Cells.Add(blnk);
                tblCIUnsubmitted.Rows.Add(blnkRow);
            }
        }
        reader.Dispose(); //Cleanup.
        command.Dispose();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        MySqlConnection mySqlConnection = new Connector().MySQLConnect();
        MySqlCommand    command         = mySqlConnection.CreateCommand();
        int             staffID         = Convert.ToInt32(Context.Request["StaffID"]);

        //Populate labels.
        command.CommandText = "SELECT * FROM Staff LEFT JOIN AccountTypeList ON Staff.AccountType = AccountTypeList.ID WHERE StaffID = " + staffID;
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows)
        {
            reader.Read();
            lblWelcome.InnerText = "Welcome " + reader["NameFirst"].ToString() + " " + reader["NameLast"].ToString();
            LblAccnt.InnerText   = "Account Type: " + reader["AccntType"].ToString();
        }
        else
        {
            divMsg.InnerText = "Error: Could not find staff member in database";
        }
        reader.Dispose();

        //Populate Principal investigator unsubmitted table.
        buildPIUnsubmittedTbl(mySqlConnection);

        //Populate Principal investigator submitted table.
        command.CommandText = @"SELECT Application.AppID, Application.a1_ProjTitle, StatusList.ID, StatusList.AppStatus, RiskLow_Bool, RiskNonLow_Bool 
                                FROM Application LEFT JOIN StatusList ON Application.AppStatus = StatusList.ID 
                                WHERE a4_InvestStaffID = " + staffID + " AND Application.AppStatus != 0 AND Application.AppStatus != 2 AND Application.AppStatus != 5";
        reader = command.ExecuteReader();
        if (reader.HasRows)
        {
            while (reader.Read()) //Build each row.
            {
                HtmlTableRow row       = new HtmlTableRow();
                string       riskLevel = "";

                //Build view button.
                HtmlInputButton btnView = new HtmlInputButton();
                btnView.ID           = "ViewPI" + reader["AppID"].ToString();
                btnView.Value        = "View";
                btnView.ServerClick += btnView_ServerClick;

                //Determine if low or non low risk.
                if (Convert.ToBoolean(reader["RiskLow_Bool"]))
                {
                    riskLevel = "Low risk";
                }
                else if (Convert.ToBoolean(reader["RiskNonLow_Bool"]))
                {
                    riskLevel = "Non low risk";
                }

                //If status is declined add a hyperlink to the comment.
                HtmlTableCell statusCell = HTMLFactory.buildCell("200", "left", reader["AppStatus"].ToString());
                if (Convert.ToInt32(reader["ID"]) == 7) //Declined.
                {
                    statusCell.InnerText += " - ";
                    HyperLink hl = new HyperLink();
                    hl.Text        = "Comment";
                    hl.NavigateUrl = "EthicsEditAppS7.aspx?Mode=R&AppID=" + reader["AppID"].ToString() + "&StaffID=" + staffID + "&Type=" + Context.Request["Type"];
                    statusCell.Controls.Add(hl);
                }

                row.Cells.Add(HTMLFactory.buildCell("50", "left", reader["AppID"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("400", "left", reader["a1_ProjTitle"].ToString()));
                row.Cells.Add(statusCell);
                row.Cells.Add(HTMLFactory.buildCell("120", "left", riskLevel));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", btnView));

                tblPISubmitted.Rows.Add(row);
            }
        }
        else //Display none.
        {
            if (tblPISubmitted.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 5;
                blnkRow.Cells.Add(blnk);
                tblPISubmitted.Rows.Add(blnkRow);
            }
        }
        reader.Dispose();

        //Populate Co-investigator unsubmitted table.
        buildCIUnsubmittedTbl(mySqlConnection);

        //Populate Co-investigator submitted table.
        command.CommandText = @"SELECT Application.AppID, Application.a1_ProjTitle, StatusList.ID, StatusList.AppStatus, RiskLow_Bool, RiskNonLow_Bool 
                                FROM Application INNER JOIN a5_coinvestigators ON Application.AppID = a5_coinvestigators.AppID LEFT JOIN StatusList ON Application.AppStatus = StatusList.ID 
                                WHERE a5_CoInvestigators.StaffID = " + staffID + " AND Application.AppStatus != 0 AND Application.AppStatus != 2 AND Application.AppStatus != 5";
        reader = command.ExecuteReader();
        if (reader.HasRows)
        {
            while (reader.Read()) //Build each row.
            {
                HtmlTableRow row       = new HtmlTableRow();
                string       riskLevel = "";

                //Build view button.
                HtmlInputButton btnView = new HtmlInputButton();
                btnView.ID           = "ViewCI" + reader["AppID"].ToString();
                btnView.Value        = "View";
                btnView.ServerClick += btnView_ServerClick;

                //Determine if low or non low risk.
                if (Convert.ToBoolean(reader["RiskLow_Bool"]))
                {
                    riskLevel = "Low risk";
                }
                else if (Convert.ToBoolean(reader["RiskNonLow_Bool"]))
                {
                    riskLevel = "Non low risk";
                }

                //If status is declined add a hyperlink to the comment.
                HtmlTableCell statusCell = HTMLFactory.buildCell("200", "left", reader["AppStatus"].ToString());
                if (Convert.ToInt32(reader["ID"]) == 7) //Declined.
                {
                    statusCell.InnerText += " - ";
                    HyperLink hl = new HyperLink();
                    hl.Text        = "Comment";
                    hl.NavigateUrl = "EthicsEditAppS7.aspx?Mode=R&AppID=" + reader["AppID"].ToString() + "&StaffID=" + staffID + "&Type=" + Context.Request["Type"];
                    statusCell.Controls.Add(hl);
                }

                row.Cells.Add(HTMLFactory.buildCell("50", "left", reader["AppID"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("400", "left", reader["a1_ProjTitle"].ToString()));
                row.Cells.Add(statusCell);
                row.Cells.Add(HTMLFactory.buildCell("120", "left", riskLevel));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", btnView));

                tblCISubmitted.Rows.Add(row);
            }
        }
        else //Display none.
        {
            if (tblCISubmitted.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 5;
                blnkRow.Cells.Add(blnk);
                tblCISubmitted.Rows.Add(blnkRow);
            }
        }
        reader.Dispose(); //Cleanup.
        command.Dispose();
        mySqlConnection.Close();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        MySqlConnection mySqlConnection = new Connector().MySQLConnect();
        MySqlCommand    command         = mySqlConnection.CreateCommand();
        int             staffID         = Convert.ToInt32(Context.Request["StaffID"]);

        //Populate labels.
        command.CommandText = "SELECT * FROM Staff LEFT JOIN AccountTypeList ON Staff.AccountType = AccountTypeList.ID WHERE StaffID = " + staffID;
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows)
        {
            reader.Read();
            lblWelcome.InnerText = "Welcome " + reader["NameFirst"].ToString() + " " + reader["NameLast"].ToString();
            LblAccnt.InnerText   = "Account Type: " + reader["AccntType"].ToString();
        }
        else
        {
            divMsg.InnerText = "Error: Could not find staff member in database";
        }
        reader.Dispose();

        //Populate table.
        command.CommandText = @"SELECT Application.AppID, Application.a1_ProjTitle, StatusList.AppStatus, RiskLow_Bool, RiskNonLow_Bool 
                                FROM Application LEFT JOIN StatusList ON Application.AppStatus = StatusList.ID 
                                WHERE g_HOS_StaffID = " + staffID + " AND Application.AppStatus = 1";
        reader = command.ExecuteReader();
        if (reader.HasRows)       //Build table entries.
        {
            while (reader.Read()) //Build a table row for each row of query.
            {
                HtmlTableRow row = new HtmlTableRow();

                //Build buttons.
                HtmlInputButton btnView = new HtmlInputButton();
                btnView.ID           = "ViewPI" + reader["AppID"].ToString();
                btnView.Value        = "View";
                btnView.ServerClick += btnView_ServerClick;

                HtmlInputButton btnEndorse = new HtmlInputButton();
                btnEndorse.ID           = "Endorse" + reader["AppID"].ToString();
                btnEndorse.Value        = "Endorse";
                btnEndorse.ServerClick += btnEndorse_ServerClick;

                row.Cells.Add(HTMLFactory.buildCell("50", "left", reader["AppID"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("400", "left", reader["a1_ProjTitle"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["AppStatus"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", btnView));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", btnEndorse));

                tblUnsubmitted.Rows.Add(row);
            }
        }
        else //Else display none.
        {
            if (tblUnsubmitted.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 5;
                blnkRow.Cells.Add(blnk);
                tblUnsubmitted.Rows.Add(blnkRow);
            }
        }

        reader.Dispose(); //Cleanup.
        command.Dispose();
        mySqlConnection.Close();
    }
    //Build list of files uploaded.
    private void buildTbl(MySqlConnection mySqlConnection)
    {
        if (tblUploads.Rows.Count > 1)
        {
            for (int i = tblUploads.Rows.Count - 1; i > 0; i--)
            {
                tblUploads.Rows.RemoveAt(i);
            }
        }
        MySqlCommand command = mySqlConnection.CreateCommand();
        int          staffID = Convert.ToInt32(Context.Request["StaffID"]);

        command.CommandText = @"SELECT Attachments.ID, FileName, AttchType, FileVersion, FileDate FROM Attachments LEFT JOIN TypeList ON Attachments.FileType = TypeList.ID WHERE AppID = " + Context.Request["AppID"];
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows)
        {
            while (reader.Read()) //Build each row.
            {
                HtmlTableRow row = new HtmlTableRow();

                //Display filename as a hyperlink, so file can be opened.
                HtmlTableCell statusCell = HTMLFactory.buildCell("200", "left", "");
                HyperLink     hl         = new HyperLink();
                hl.Text        = reader["FileName"].ToString();
                hl.NavigateUrl = "http://curtinethics-001-site1.smarterasp.net/Uploads/" + Request["AppID"].ToString() + "_" + reader["FileName"].ToString();
                hl.Target      = "_blank";
                statusCell.Controls.Add(hl);

                //Delete button.
                Button btnDel = new Button(); //Need to use an ASP button to add the client side confirmation.
                btnDel.ID            = "Del" + reader["ID"].ToString();
                btnDel.Text          = "Delete";
                btnDel.OnClientClick = "return(beforeDelete( ))"; //Asks user if they are sure they want to delete.
                btnDel.Click        += btnDel_ServerClick;

                row.Cells.Add(statusCell);
                row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["AttchType"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("97", "left", reader["FileVersion"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("97", "center", reader["FileDate"].ToString()));

                if (Context.Request["Mode"].Equals("W")) //If write then construct delete button.
                {
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", btnDel));
                }
                else
                {
                    row.Cells.Add(HTMLFactory.buildCell("97", "center", "Read only"));
                }

                tblUploads.Rows.Add(row);
            }
        }
        else
        {
            if (tblUploads.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 5;
                blnkRow.Cells.Add(blnk);
                tblUploads.Rows.Add(blnkRow);
            }
        }
        reader.Dispose();
    }
    //Build Write access CI table, contains buttons to edit and delete.
    private void buildWriteCITable(MySqlConnection mySqlConnection)
    {
        for (int i = tblCI.Rows.Count - 1; i > 0; i--)
        {
            tblCI.Rows.RemoveAt(i);
        }
        MySqlCommand command = mySqlConnection.CreateCommand();

        command.CommandText = @"SELECT staff.StaffID, CONCAT(IFNULL(staff.NameLast,''),', ',IFNULL(staff.NameFirst,'')) AS FullName, a5_coinvestigators.CandidacyAppr, Staff.IntegTraining, RoleList.Role
                                FROM a5_coinvestigators LEFT JOIN staff ON a5_coinvestigators.StaffID = staff.StaffID LEFT JOIN RoleList ON a5_coinvestigators.Role = RoleList.ID 
                                WHERE a5_coinvestigators.AppID = " + Context.Request["AppID"];
        MySqlDataReader reader = command.ExecuteReader();

        if (reader.HasRows) //Populate CI table.
        {
            while (reader.Read())
            {
                HtmlInputButton btnEdit = new HtmlInputButton();
                btnEdit.ID           = "EditCI" + reader["StaffID"].ToString();
                btnEdit.Value        = "Edit";
                btnEdit.ServerClick += btnEditCI_ServerClick;

                Button btnDel = new Button(); //Need to use an ASP button to add the client side confirmation.
                btnDel.ID            = "DelCI" + reader["StaffID"].ToString();
                btnDel.Text          = "Delete";
                btnDel.OnClientClick = "return(beforeDelete( ))"; //Asks user if they are sure they want to delete.
                btnDel.Click        += btnDelCI_ServerClick;

                HtmlInputCheckBox chkCand = new HtmlInputCheckBox();
                chkCand.ID       = "chkCand" + reader["StaffID"].ToString();
                chkCand.Disabled = true;
                HtmlInputCheckBox chkIntg = new HtmlInputCheckBox();
                chkIntg.ID       = "chkIntg" + reader["StaffID"].ToString();
                chkIntg.Disabled = true;

                HtmlTableRow row = new HtmlTableRow();
                row.Cells.Add(HTMLFactory.buildCell("", "left", reader["FullName"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("", "left", reader["Role"].ToString()));
                row.Cells.Add(HTMLFactory.buildCell("", "left", Convert.ToBoolean(reader["CandidacyAppr"]), chkCand));
                row.Cells.Add(HTMLFactory.buildCell("", "left", Convert.ToBoolean(reader["IntegTraining"]), chkIntg));
                row.Cells.Add(HTMLFactory.buildCell("", "center", btnEdit));

                //If CI has control don't let her/him delete self.
                if (Convert.ToInt32(reader["StaffID"]) == Convert.ToInt32(Context.Request["StaffID"]))
                {
                    row.Cells.Add(HTMLFactory.buildCell("", "center", ""));
                }
                else
                {
                    row.Cells.Add(HTMLFactory.buildCell("", "center", btnDel));
                }

                tblCI.Rows.Insert(1, row);
            }
        }
        else //Display none.
        {
            if (tblCI.Rows.Count != 0)
            {
                HtmlTableRow  blnkRow = new HtmlTableRow();
                HtmlTableCell blnk    = new HtmlTableCell();
                blnk.InnerText = "None";
                blnk.ColSpan   = 6;
                blnkRow.Cells.Add(blnk);
                tblCI.Rows.Add(blnkRow);
            }
        }
        reader.Dispose();
    }