Beispiel #1
0
 public Chapter(String title, RichTextBox rtb, Book b, RegisteredUser author)
     : base(title,rtb,author)
 {
     this.book = b;
     newDoc();
     this.Unlock();
     number = book.NumberOfChapters + 1;
 }
        public MaintainUser(MainUI main, int state)
        {
            this.InitializeComponent();
            this.state = state;
            // Insert code required on object creation below this point.
            this.main = main;

            RegisteredUser newUser = new RegisteredUser();

            ArrayList Dep = new ArrayList(); /**/
        public void PopulateProfile(RegisteredUser newUser)
        {
            RegisteredUser NewUser = newUser;
            viewedUSer = newUser;
            if (NewUser == null)
                return;

            for (int x = 0; x < cmbxTitle.Items.Count; x++)
            {

                if (((ComboBoxItem)cmbxTitle.Items[x]).Content.ToString().Equals(NewUser.Title.Trim()))
                {
                    cmbxTitle.SelectedIndex = x;
                }

            }
            txtUN.Text = NewUser.username;
            pBPass.Password = NewUser.Password;
            pBConf.Password = NewUser.Password;
            txtName.Text = NewUser.Name;
            txtSname.Text = NewUser.SName;
            dpDoB.Text = NewUser.DateOfBirth;
            if (NewUser.Gender == "Male")
                rbGenM.IsChecked = true;
            else
                rbGenF.IsChecked = true;
            txtCNo.Text = NewUser.ContactNum.ToString();
            txtEmail.Text = NewUser.Email;
            lbSysIDV.Content = NewUser.SysID;

            ArrayList Dep = new ArrayList(); /**/
            Dep = (ArrayList)NewUser.popDept();
            cmbxDep.Items.Clear();
            for (int x = 0; x < Dep.Count; x++)
            {
                cmbxDep.Items.Add(Dep[x].ToString());
            }




            //cmbxDep.Items.Add(CI);


            for (int x = 0; x < cmbxDep.Items.Count; x++)
            {

                if ((cmbxDep.Items[x]).Equals(NewUser.getDept().Trim()))  /**/
                {
                    cmbxDep.SelectedIndex = x;
                }

            }
Beispiel #4
0
        public static void loadDataSet(RegisteredUser User)
        {


            String SQL = "SELECT R.OutputID, R.Title, (U.Name + ' ' + U.SName) AS AuthorName, R.Subject, R.AdditionalInfo, D.PublicationDate, R.Author2, R.Author3, R.Author4, R.PageBegin, R.PageEnd, " +
                "(R.PageEnd - R.PageBegin + 1) AS PagesClaimed FROM ResearchOutput As R INNER JOIN RegisteredUser AS U ON R.AuthorID = U.SysID INNER JOIN "+
                    "(SELECT JA.OutputID AS ID, J.PublicationDate AS PublicationDate FROM Journal AS J INNER JOIN JournalArticle AS JA ON JA.JournalISSN = J.ISSN "+
                        "UNION "+
                     "SELECT OutputID AS ID, PublicationDate FROM ConferencePaper " +
                        "UNION " +
                    "SELECT OutputID AS ID, PublishDate AS PublicationDate FROM Book) AS D ON D.ID = R.OutputID "+
                " WHERE R.ActiveStatus = 'True';";
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = "SELECT R.OutputID, R.Title, (U.Name + ' ' + U.SName) AS AuthorName, R.Subject, R.AdditionalInfo, D.PublicationDate, R.ActiveStatus, R.RejectReason, R.Author2, R.Author3, R.Author4, R.PageBegin, R.PageEnd, " +
                "(R.PageEnd - R.PageBegin + 1) AS PagesClaimed FROM ResearchOutput As R INNER JOIN RegisteredUser AS U ON R.AuthorID = U.SysID INNER JOIN " +
                    "(SELECT JA.OutputID AS ID, J.PublicationDate AS PublicationDate FROM Journal AS J INNER JOIN JournalArticle AS JA ON JA.JournalISSN = J.ISSN " +
                        "UNION " +
                     "SELECT OutputID AS ID, PublicationDate FROM ConferencePaper " +
                        "UNION " +
                    "SELECT OutputID AS ID, PublishDate AS PublicationDate FROM Book) AS D ON D.ID = R.OutputID;";
                }
            loadDataset(SQL);

        }
Beispiel #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RegisteredUser newUser = new RegisteredUser();

            ArrayList Dep = new ArrayList(); /**/
            Dep = (ArrayList)newUser.popDept();
            cmbxDep.Items.Clear();
            for (int x = 0; x < Dep.Count; x++)
            {
                cmbxDep.Items.Add(Dep[x].ToString());
            }
            this.Focus();
        }
        private bool Checknum(TextBox t)
        {
            if (t.Text == "")
            {

                MessageBox.Show("There is a problem with your recent changes. Please check you have no missing entries", "Missing Info Error");
                return false;
            }
            else
            {
                string str = t.Text;
                double dNo;
                dNo = double.Parse(str);
                return true;
            }


        }
        private bool CheckinputSI(TextBox t)
        {
            if (t.Text == "")
            {

                MessageBox.Show("There is a problem with your recent changes. Please check you have no missing entries", "Missing Info Error");
                return false;
            }
            else
            {
                string MyString = t.Text;

                for (int charpos = 0; charpos < MyString.Length; charpos++)
                {
                    if (!(Char.IsLetterOrDigit(MyString, charpos)))
                    {
                        if (MyString.Contains("@"))  //check for email
                            return true;
                    }
                }
                MessageBox.Show("There is a problem with your recent changes. Please check you have entered the information as specified via the ToolTip eg. Email: [email protected]", "Input Error");
                return false;
            }


        }
        private bool CheckUserN(TextBox t) ///changed
        {
            if (t.Text == "")
            {
                MessageBox.Show("Please enter you desired Username", "Username Missing");
                return false;
            }
            else
            {
                /*Place code to check or duplicate username*/
            }
Beispiel #6
0
 //Draft Documents
 public JournalArticle(String title, RichTextBox rtb, RegisteredUser author)
     :base(title,rtb,author)
 {
     newDoc();
 }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {

            if (!curUser.isExceptionFree())
                throw new Exception("Cannot save to the database while there are errors on the form");


            RegisteredUser NewOne = new RegisteredUser();
            Char G;
            if (rbGenM.IsChecked == true)
            {
                G = '1';
            }
            else
            {
                G = '0';
            }
            String photo = @"\\openbox\WRR301\Team03\RISDB\Images\" + curUser.SysID.ToString() + ".jpg";
            
              
            
            String depcode = NewOne.getDcode(cmbxDep.Text); 

            NewOne.AddUser(txtName.Text, cmbxTitle.Text, txtSname.Text, txtUN.Text, pBPass.Text, txtCNo.Text, depcode, photo, dpDoB.Text, txtEmail.Text, G, cmbxToU.Text);
            setUserDataSource();
            txtUN.Text = "";
            pBPass.Text = "";
            pBConf.Text = "";
            txtName.Text = "";
            txtSname.Text = "";
            txtCNo.Text = "";
            txtEmail.Text = "";

            btnUpdate.Visibility = Visibility.Hidden;
            MessageBox.Show("Registered User Added", "~Added~");

        }
Beispiel #8
0
        public static void loadDataSet(RegisteredUser User)
        {


            String SQL = "SELECT ISSN, Title, Volume, Number, EditorName, Publisher, Organisation, Email, PublicationDate, "
            + "SCI, SSCI, AHI, IBSS, SAJ  FROM Journal WHERE ActiveStatus = 'True';";
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = "SELECT * FROM Journal;";
                }
            loadDataset(SQL);

        }
Beispiel #9
0
        public void LoggedIn(RegisteredUser user)
        {
            this.IsEnabled = true;//this is after the user logged in and the screen closed so that its no longer modal
            if (user != null)
            {
                curUser = user;
                MessageBox.Show(String.Format("Welcome to Accendo, {0} {1}!",curUser.Title.TrimEnd(),curUser.SName), "Login Successfull");
				this.trvLoggedIn.Header = String.Format("Logged In: {0} {1} {2}",curUser.Title.TrimEnd(),curUser.Name,curUser.SName);
            }
            else
            {
                isGuest = true;
                MessageBox.Show("Welcome to Accendo! Please consider registering on the system.", "Welcome Guest");
				this.trvLoggedIn.Header = "Logged In: Guest";
            }
			
			if (this.tabStarted.IsVisible)
            {
                Storyboard spOpen = (Storyboard)FindResource("GSOpen");
                spOpen.Begin(this);
                GSopen = true;
            }
            //D's Code

            setRestrictions();
            PopulateProfile();
            getMyPublishedROS();
            tabProfile.DataContext = curUser;
            //End of D's Code
        }
Beispiel #10
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;
        }
Beispiel #11
0
        public static void loadDataSetR(RegisteredUser User)
        {


            String SQL = "Select SysID, ResearcherID From Researcher";
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = "SELECT Researcher.SysID, ResearcherID, SupervisorID, AssistantSupervisorID, Name AS [Researcher Name], Title, SName, Username, Password, ContactNum, DateOfBirth, Email, Gender, Type FROM Researcher INNER JOIN RegisteredUser ON Researcher.SysID = RegisteredUser.SysID;";
                }
            loadDataset(SQL);

        }
Beispiel #12
0
        public ResearchOutput(String Title, DocumentViewer doc, XpsDocument xps, RegisteredUser author, String ContentPath)
        {

            DocumentDraft = true;
            isXPS = true;
            Doc = doc;
            this.xps = xps;
            this.title = Title;
            getAuthorDetails(author);
            ExceptionStack = new Stack<InputException>();
            this.contentPath = ContentPath;
        }
Beispiel #13
0
 public void SendRejectNoti(RegisteredUser user)
 {
     Notification cur = new Notification(4, user.SysID.ToString());
     cur.sendApproveRejectNotification(this);
 }
Beispiel #14
0
 public ResearchOutput(String Title, RichTextBox rtb, RegisteredUser author)
 {
     DocumentDraft = true;
     this.title = Title;
     Draft = new FlowDocument();
     rtbDraft = rtb;
     this.Unlock();
     getAuthorDetails(author);
     ExceptionStack = new Stack<InputException>();
 }
Beispiel #15
0
 private void getAuthorDetails(RegisteredUser author)
 {
     if (author == null)
         return;
     authorID = int.Parse(author.SysID);
     authorName = author.Name + " " + author.SName;
     authorTitle = author.Title;
     authorEmail = author.Email;
     authorNumber = author.ContactNum.ToString();
 }
Beispiel #16
0
        public static void loadStrictDataSet(List<String> Filters, List<String> Criterion, String Date1, String Date2, RegisteredUser User)
        {
            if ((Filters == null) || (Criterion == null) || (Filters.Count != Criterion.Count))
            {
                loadDataSet(User);
                return;
            }


            String SQL = String.Format("SELECT R.OutputID, R.Title, (U.Name + ' ' + U.SName) AS AuthorName, R.Subject, R.AdditionalInfo, D.PublicationDate, R.Author2, R.Author3, R.Author4, R.PageBegin, R.PageEnd, " +
                "(R.PageEnd - R.PageBegin + 1) AS PagesClaimed FROM ResearchOutput As R INNER JOIN RegisteredUser AS U ON R.AuthorID = U.SysID INNER JOIN " +
                    "(SELECT JA.OutputID AS ID, J.PublicationDate AS PublicationDate FROM Journal AS J INNER JOIN JournalArticle AS JA ON JA.JournalISSN = J.ISSN " +
                        "UNION " +
                     "SELECT OutputID AS ID, PublicationDate FROM ConferencePaper " +
                        "UNION " +
                    "SELECT OutputID AS ID, PublishDate AS PublicationDate FROM Book) AS D ON D.ID = R.OutputID " + "WHERE ");
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = "SELECT R.OutputID, R.Title, (U.Name + ' ' + U.SName) AS AuthorName, R.Subject, R.AdditionalInfo, D.PublicationDate, R.ActiveStatus, R.RejectReason, R.Author2, R.Author3, R.Author4, R.PageBegin, R.PageEnd, " +
                 "(R.PageEnd - R.PageBegin + 1) AS PagesClaimed FROM ResearchOutput As R INNER JOIN RegisteredUser AS U ON R.AuthorID = U.SysID INNER JOIN " +
                     "(SELECT JA.OutputID AS ID, J.PublicationDate AS PublicationDate FROM Journal AS J INNER JOIN JournalArticle AS JA ON JA.JournalISSN = J.ISSN " +
                         "UNION " +
                      "SELECT OutputID AS ID, PublicationDate FROM ConferencePaper " +
                         "UNION " +
                     "SELECT OutputID AS ID, PublishDate AS PublicationDate FROM Book) AS D ON D.ID = R.OutputID WHERE ";
                }

            SQL += String.Format("(D.PublicationDate BETWEEN '{0}' AND '{1}') AND (", Date1, Date2);

            for (int x = 0; x < Filters.Count; x++)
                if (!Filters[x].TrimEnd().Equals(""))
                    SQL += String.Format("({1} = '{0}') OR", Criterion[x], Filters[x]);

            int length = SQL.Length;
            SQL = SQL.Substring(0,length-3);

            if (User != null)
            {
                if (!(User is SystemAdministrator) && !(User is AdministrativeAssistant))
                    SQL += ") AND (R.ActiveStatus = 'True');";
                else SQL += ");";
            }
            else SQL += ") AND (R.ActiveStatus = 'True');";
            loadDataset(SQL);
        }
Beispiel #17
0
        public static void loadDataSet(RegisteredUser User)
        {


            String SQL = "SELECT ISBN, Name, StartDate, EndDate, Venue, City, Country, ContactPerson, ContactEmail, "
            + "ContactNumber  FROM Conference WHERE ActiveStatus = 'True';";
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = "SELECT * FROM Conference;";
                }
            loadDataset(SQL);

        }
Beispiel #18
0
        public static void loadStrictDataSetR(String Filter, String Criteria, RegisteredUser User)
        {

            String SQL = String.Format("Select SysID, ResearcherID From Researcher {1} = '{0}';", Criteria, Filter);
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = String.Format("SELECT Researcher.SysID, ResearcherID, SupervisorID, AssistantSupervisorID, Name AS [Researcher Name], Title, SName, Username, Password, ContactNum, DateOfBirth, Email, Gender, Type FROM Researcher INNER JOIN RegisteredUser ON Researcher.SysID = RegisteredUser.SysID WHERE {1} = '{0}';", Criteria, Filter);
                }
            loadDataset(SQL);
        }
Beispiel #19
0
        public static void loadStrictDataSet(String Filter, String Criteria, RegisteredUser User)
        {

            String SQL = String.Format("SELECT ISBN, Name, StartDate, EndDate, Venue, City, Country, ContactPerson, ContactEmail, "
            + "ContactNumber  FROM Conference WHERE (ActiveStatus = 'True') AND ({1} = '{0}');", Criteria, Filter);
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = String.Format("SELECT * FROM Conference WHERE {1} = '{0}';", Criteria, Filter);
                }
            loadDataset(SQL);
        }
Beispiel #20
0
        public RegisteredUser getuser(String sysID)
        {
            String sql = "Select * From RegisteredUser Where SysID ='" + sysID + "'";
            ArrayList cur = RISReader.GetFirstRow(sql);
            RegisteredUser NEWO = new RegisteredUser();

            return NEWO;
        }
Beispiel #21
0
        public static void loadStrictDataSet(String Filter, String Criteria, RegisteredUser User)
        {

            String SQL = String.Format("SELECT ISSN, Title, Volume, Number, EditorName, Publisher, Organisation, Email, PublicationDate, "
            + "SCI, SSCI, AHI, IBSS, SAJ FROM Journal WHERE (ActiveStatus = 'True') AND ({1} = '{0}');", Criteria, Filter);
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = String.Format("SELECT * FROM Journal WHERE {1} = '{0}';", Criteria, Filter);
                }
            loadDataset(SQL);
        }
Beispiel #22
0
        public static void loadDataSet(RegisteredUser User)
        {


            String SQL = "Select SysID, Name, Title, SName, Username, Password, ContactNum, PhotoAddress, DateOfBirth, Email, Gender, Type From RegisteredUser";
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = "SELECT * FROM RegisteredUser;";
                }
            loadDataset(SQL);

        }
Beispiel #23
0
 private void mitLogout_Click(object sender, RoutedEventArgs e)
 {
     clearOutputs();
     try
     {
         System.Windows.Documents.FlowDocument doc = (System.Windows.Documents.FlowDocument)FindResource("ExampleArticleFlo");
         rtbDocument.Document = doc;
     }
     catch { }
     curUser = null;
     CreateLogin();
 }
Beispiel #24
0
        private void setUserDataSource()
        {
            this.DataContext = curUser;

            if (curUser == null)
                return;

            for (int x = 0; x < cmbxTitle.Items.Count; x++)
            {

                if (((ComboBoxItem)cmbxTitle.Items[x]).Content.ToString().Equals(curUser.Title.Trim()))
                {
                    cmbxTitle.SelectedIndex = x;
                }

            }

            for (int x = 0; x < cmbxDep.Items.Count; x++)
            {

                if ((cmbxDep.Items[x]).Equals(curUser.getDept().Trim()))  /**/
                {
                    cmbxDep.SelectedIndex = x;
                }

            }
            for (int x = 0; x < cmbxToU.Items.Count; x++)
            {

                if (((ComboBoxItem)cmbxToU.Items[x]).Content.ToString().Equals(curUser.Type.Trim()))
                {
                    cmbxToU.SelectedIndex = x;

                }

            }
            ComboBoxItem cb = new ComboBoxItem();
            cb = (ComboBoxItem)cmbxToU.Items.CurrentItem;
            if (cb.Content.ToString() == "Administrative Assistant")
            {
                txtStID.Text = ((AdministrativeAssistant)curUser).StaffID.ToString();

            }
            else
                if (cb.Content.ToString() == "Independent Researcher")
                {
                    txtStID.Text = ((IndependentResearcher)curUser).StaffID.ToString();
                }
                else
                    if (cb.Content.ToString() == "Lecturer")
                    {
                        txtStID.Text = ((Lecturer)curUser).StaffID.ToString();
                    }
                    else
                        if (cb.Content.ToString() == "Researcher")
                        {
                            txtRID.Text = ((Researcher)curUser).ResearcherID.ToString();
                        }

                        else
                            if (cb.Content.ToString() == "Student")
                            {

                                txtStID.Text = ((Student)curUser).StudentNo.ToString();
                            }
                            else
                                if (cb.Content.ToString() == "Supervisor")
                                {
                                    txtStID.Text = ((Supervisor)curUser).StaffID.ToString();
                                }
                                else
                                    if (cb.Content.ToString() == "System Administrator")
                                    {
                                        txtStID.Text = ((SystemAdministrator)curUser).StaffID.ToString();
                                        txtPos.Text = ((SystemAdministrator)curUser).Position;

                                    }
            if (curUser.Gender == "Male")
                rbGenM.IsChecked = true;
            else
                rbGenF.IsChecked = true;

            if (curUser.ActiveStatus == true)
                rbActY.IsChecked = true;
            else
                rbActN.IsChecked = true;
            if (curUser.checkfunding(curUser.sysID) == true)
            {
                rbFunY.IsChecked = true;

            }
            else
            {
                rbFunN.IsChecked = true;
            }

        }





        private void btnSelect_Click(object sender, RoutedEventArgs e)
        {
            setUserDataSource();
        }
        private void btnAgDel_Click(object sender, RoutedEventArgs e)
        {
            /* if (Checknull(txtAgID) == false)
             {
                 MessageBox.Show("Please ENTER the AgencyID of the funding agency you wish to remove.");
             }
             else*/
            {
                if (!curUser.isExceptionFree())
                    throw new Exception("Cannot Delete while there are errors on the form");

                RegisteredUser RU = new RegisteredUser();
                curUser.Delete(int.Parse(txtSysID.Text));
                //RU.Delete(int.Parse(txtSysID.Text));
                MessageBox.Show("Registered User Removed", "~Removed~");
                InitializeGrid();
                txtUN.Text = "";
                pBPass.Text = "";
                pBConf.Text = "";
                txtName.Text = "";
                txtSname.Text = "";
                txtCNo.Text = "";
                txtEmail.Text = "";
                txtStID.Text = "";
                txtPos.Text = "";
                txtRID.Text = "";
                cmbxTitle.SelectedIndex = -1;
                cmbxDep.SelectedIndex = -1;
                //cmbxToU.SelectedIndex = -1;


            }
        }
Beispiel #25
0
        //Imported Documents
        public JournalArticle(String Title, DocumentViewer doc, XpsDocument xps, RegisteredUser author, String contentPath)
            :base(Title, doc, xps, author, contentPath)
        {

        }
Beispiel #26
0
 //Draft Documents
 public ConferencePaper(String title, RichTextBox rtb, RegisteredUser author)
     : base(title, rtb, author)
 {
     newDoc();
     publicationDate = DateTime.Today;
 }
Beispiel #27
0
        public static void loadStrictDataSet(String Filter, String Criteria, RegisteredUser User)
        {

            String SQL = String.Format("Select SysID, Name, Title, SName, Username, Password, ContactNum, PhotoAddress, DateOfBirth, Email, Gender, Type From RegisteredUser {1} = '{0}';", Criteria, Filter);
            if (User != null)
                if ((User is SystemAdministrator) || (User is AdministrativeAssistant))
                {
                    SQL = String.Format("SELECT * FROM RegisteredUser WHERE {1} = '{0}';", Criteria, Filter);
                }
            loadDataset(SQL);
        }
Beispiel #28
0
 //Imported Documents
 public ConferencePaper(String Title, DocumentViewer doc, XpsDocument xps, RegisteredUser author, String contentPath)
     :base(Title, doc, xps , author, contentPath)
 {
     publicationDate = DateTime.Today;
 }
Beispiel #29
0
        private void btnAgAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                {
                    RegisteredUser NewOne = new RegisteredUser();
                    Char G;
                    String photo = @"\\openbox\WRR301\Team03\RISDB\Images\" + curUser.SysID.ToString() + ".jpg";
                    if (rbGenM.IsChecked == true)
                    {
                        G = '1';
                    }
                    else
                    {
                        G = '0';
                    }
                    String depcode = NewOne.getDcode(cmbxDep.Text);
                    NewOne.AddUser(txtName.Text, cmbxTitle.Text, txtSname.Text, txtUN.Text, pBPass.Text, txtCNo.Text, depcode, photo, dpDoB.Text, txtEmail.Text, G, cmbxToU.Text);

                    if (cmbxToU.Text == "Administrative Assistant")
                    {
                        AdministrativeAssistant AA = new AdministrativeAssistant();
                        String sysID = AA.getID(txtUN.Text);
                        AA.AddUser(sysID, txtStID.Text);
                    }
                    else
                        if (cmbxToU.Text == "Independent Researcher")
                        {
                            IndependentResearcher IR = new IndependentResearcher();
                            String sysID = IR.getID(txtUN.Text);
                            IR.AddUser(sysID, txtStID.Text);
                        }
                        else
                            if (cmbxToU.Text == "Lecturer")
                            {
                                Lecturer LT = new Lecturer();
                                String sysID = LT.getID(txtUN.Text);
                                LT.AddUser(sysID, txtStID.Text);
                            }
                            else
                                if (cmbxToU.Text == "Researcher")
                                {
                                    Researcher RS = new Researcher();
                                    String sysID = RS.getID(txtUN.Text);
                                    RS.AddUser(sysID, txtRID.Text);
                                }
                                else
                                    if (cmbxToU.Text == "Student")
                                    {
                                        Student SD = new Student();
                                        String sysID = SD.getID(txtUN.Text);
                                        SD.AddUser(sysID, txtStID.Text);
                                    }
                                    else
                                        if (cmbxToU.Text == "Supervisor")
                                        {
                                            Supervisor SP = new Supervisor();
                                            String sysID = SP.getID(txtUN.Text);
                                            SP.AddUser(sysID, txtStID.Text);
                                        }
                                        else
                                            if (cmbxToU.Text == "System Administrator")
                                            {
                                                SystemAdministrator SA = new SystemAdministrator();
                                                String sysID = SA.getID(txtUN.Text);
                                                SA.AddUser(sysID, txtStID.Text, txtPos.Text);
                                            }

                    MessageBox.Show("Registered User Added", "~Added~");

                    InitializeGrid();
                    txtUN.Text = "";
                    pBPass.Text = "";
                    pBConf.Text = "";

                    cmbxTitle.SelectedIndex = -1;
                    cmbxDep.SelectedIndex = -1;
                    //cmbxToU.SelectedIndex = -1;

                    txtName.Text = "";
                    txtSname.Text = "";
                    txtCNo.Text = "";
                    txtEmail.Text = "";
                    txtStID.Text = "";
                    txtPos.Text = "";
                    txtRID.Text = "";

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #30
0
 public RegisteredUser GetUserbUN(String un)
 {
     try
     {
         String sql = String.Format("SELECT * FROM RegisteredUser WHERE Username = '******';", un);
         ArrayList user = RISReader.GetFirstRow(sql);
         RegisteredUser temp = new RegisteredUser();
         RegisteredUser cur = temp.getUser(user[13].ToString()); // type is the 13th value [Ed]
         cur.PopulateValues(user);
         return cur;
     }
     catch (ConnException e)
     {
         MessageBox.Show("System databases are offline. Contact a systems admin for support", "Fill RegisteredUser Failed");
     }
     catch (CmdException e)
     {
         MessageBox.Show("SQL Command Error.", "Fill RegisteredUser Failed");
     }
     catch (Exception e)
     {
         MessageBox.Show("Unnexpected Error: " + e.Message.ToString(), "Fill RegisteredUser Failed");
     }
     return null;
 }