Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DB dB = new DB();

            String query = "SELECT project_ID, project_name, files.file_name, users.first_name, users.last_name, users.department, projects.RIS_accepted, projects.ass_dean_accepted, projects.dean_accepted, projects.RIS_denied  FROM PROJECTS  JOIN users ON researcher_ID = users.staff_no  JOIN files ON projects.file_ID = files.file_ID WHERE projects.researcher_ID ='" + (string)Session["StaffNo"] + "'";
            //(RIS_accepted = 0 OR RIS_accepted is NULL)

            //  String queryImage = "SELECT RIS_accepted, ass_dean_accepted, dean_accepted FROM projects";

            //CHECK FOR LOGIN
            string LI = (string)(Session["loggedin"]);

            if (LI != "Loggedin")
            {
                Response.Redirect("Index.aspx", false);
            }
            else  //CHECK & ENSURE USER IS RESEARCHER
            {
                DB     db      = new DB();
                string staffID = (string)(Session["StaffNo"]);

                Redirect(getDetails(db, staffID));
            }

            int i = 0;

            try
            {
                reader = dB.Select(query);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        for (int n = 0; n < 10; n++)
                        {
                            data[i] += reader.GetString(n) + ',';
                        }



                        i++;

                        Array.Resize <String>(ref data, i + 1);
                    }
                }
            }
            catch
            {
                // nothing
            }

            // String info = new String[][];

            for (int j = 0; j < i; j++)
            {
                System.Diagnostics.Debug.WriteLine("++++++++++++++++++++++++++++++++++");
                //System.Diagnostics.Debug.WriteLine(data[j]);

                Array.Resize <String>(ref projectID, j + 1);
                Array.Resize <String>(ref projectName, j + 1);
                Array.Resize <String>(ref fileName, j + 1);
                Array.Resize <String>(ref firstName, j + 1);
                Array.Resize <String>(ref lastName, j + 1);
                Array.Resize <String>(ref department, j + 1);
                Array.Resize <String>(ref RIS_accepted, j + 1);
                Array.Resize <String>(ref ass_dean_accepted, j + 1);
                Array.Resize <String>(ref dean_accepted, j + 1);
                Array.Resize <String>(ref RIS_denied, j + 1);



                System.Diagnostics.Debug.WriteLine(data[j]);
                String[] words = data[j].Split(',');
                projectID[j]         = words[0];
                projectName[j]       = words[1];
                fileName[j]          = words[2];
                firstName[j]         = words[3];
                lastName[j]          = words[4];
                department[j]        = words[5];
                RIS_accepted[j]      = words[6];
                ass_dean_accepted[j] = words[7];
                dean_accepted[j]     = words[8];
                RIS_denied[j]        = words[9];
                //risID[j] = words[6];
                System.Diagnostics.Debug.WriteLine(projectID[j]);
                System.Diagnostics.Debug.WriteLine(projectName[j]);
                System.Diagnostics.Debug.WriteLine(fileName[j]);
                System.Diagnostics.Debug.WriteLine(firstName[j]);
                System.Diagnostics.Debug.WriteLine(lastName[j]);
                System.Diagnostics.Debug.WriteLine(department[j]);
            }
        }