Ejemplo n.º 1
0
        public static List<ResearchOutput> getMyPublishedRO(DocumentViewer doc, RegisteredUser user)
        {
            List<ResearchOutput> list = new List<ResearchOutput>();
            try
            {


                String SQL = String.Format("SELECT * FROM ResearchOutput WHERE AuthorID = '{0}'", user.SysID);

                DSL.Matrix matrix = RISReader.ReadTable(SQL);
                ArrayList AL2;
                ArrayList AL1;
                ResearchOutput cur;

                for (int x = 0; x < matrix.NumberOfRows; x++)
                {
                    cur = null;
                    AL1 = matrix.GetNextRow();
                    int ID = int.Parse(AL1[0].ToString());
                    switch (int.Parse(AL1[13].ToString()))
                    {
                        case 0:
                            SQL = String.Format("SELECT * FROM JournalArticle WHERE OutputID = '{0}'", ID);
                            AL2 = RISReader.GetFirstRow(SQL);
                            cur = new JournalArticle(AL1, AL2, doc);
                            break;
                        case 1:
                            SQL = String.Format("SELECT * FROM ConferencePaper WHERE OutputID = '{0}'", ID);
                            AL2 = RISReader.GetFirstRow(SQL);
                            cur = new ConferencePaper(AL1, AL2, doc);
                            break;
                        case 2:
                            SQL = String.Format("SELECT * FROM Book WHERE OutputID = '{0}'", ID);
                            AL2 = RISReader.GetFirstRow(SQL);
                            cur = new Book(AL1, AL2, doc);
                            break;
                        default: break;
                    }
                    if (cur != null)
                        cur.pendingPublication = false;
                    list.Add(cur);
                }
            }
            catch (ConnException e)
            {
                MessageBox.Show("System databases are offline. Contact a systems admin for support", "Get published research output failed");
            }
            catch (CmdException e)
            {
                MessageBox.Show("SQL Command Error.", "Get published research output failed");
            }
            catch (ReadException e)
            {
                MessageBox.Show("Output does not exists", "Get published research output failed");
            }
            catch (Exception e)
            {
                MessageBox.Show("Error: " + e.Message.ToString(), "Get published research output failed");
            }
            return list;
        }
Ejemplo n.º 2
0
 private static ResearchOutput getROFromDB(int ID, DocumentViewer doc)
 {
     ResearchOutput cur = null;
     String SQL = String.Format("SELECT * FROM ResearchOutput WHERE OutputID = '{0}'", ID);
     ArrayList AL1 = RISReader.GetFirstRow(SQL);
     ArrayList AL2;
     switch (int.Parse(AL1[13].ToString()))
     {
         case 0:
             SQL = String.Format("SELECT * FROM JournalArticle WHERE OutputID = '{0}'", ID);
             AL2 = RISReader.GetFirstRow(SQL);
             cur = new JournalArticle(AL1, AL2, doc);
             break;
         case 1:
             SQL = String.Format("SELECT * FROM ConferencePaper WHERE OutputID = '{0}'", ID);
             AL2 = RISReader.GetFirstRow(SQL);
             cur = new ConferencePaper(AL1, AL2, doc);
             break;
         case 2:
             SQL = String.Format("SELECT * FROM Book WHERE OutputID = '{0}'", ID);
             AL2 = RISReader.GetFirstRow(SQL);
             cur = new Book(AL1, AL2, doc);
             break;
         default: break;
     }
     return cur;
 }