protected Report _stdReport = new Report();//REPORT OBJECT TO BE SENT TO TE REPORT HANDLER. 

        public Problem_Setting_Screen_add(User student)
        {
            _student = student;
            InitializeComponent();
            //display student
            lblUserNameDisplay.Text = "Student: " + student.ScreenName;

            //read from assignment list
            handledAssigList = _handler.ReadFile();
            PopulateDdList();

        }
        public Admin_Control(User Admin)
        {
            AdminName = Admin.GetFullName;
            InitializeComponent();
            lblWelcomAdmin.Text = "Welcome " + AdminName;
            this.WindowState = FormWindowState.Maximized;

            MyCheckBox cb = new MyCheckBox();
            this.Controls.Add(cb);

            //populate dropdownList
            updateDdlist();
            lblLastAdminLogin.Text = "Last Login: " + Admin.LastLoginDate.ToString();
        }
        public Problem_Select_Screen(User student)
        {
            _student = student;
            string today;
            today = DateTime.Now.ToString(Properties.Settings.Default.dateFormat); 

            this.WindowState = FormWindowState.Maximized;
            InitializeComponent();
            this.ControlBox = false;
            GetUserReport(student);
            PopulateJungleList();

                lblLastLoginDate.Text = "Last Login: "******"Last Login: ") lblLastLoginDate.Text = today; 

        }
Пример #4
0
        /// <summary>
        /// Jonathan Sanborn
        /// 
        /// Copy construct from a User object
        /// </summary>
        /// <param name="mmControl">The Controller Object</param>
        /// <param name="user">The User to copy</param>
        public Student(MMControl mmControl, User user)
            : base()
        {
            init();
            this.ID = user.ID;
            this.UserType = user.UserType;
            this.FirstName = user.FirstName;
            this.LastName = user.LastName;
            this.ScreenName = user.ScreenName;
            this.LoginRecords = user.LoginRecords;
            this.Password = user.Password;

            getAssignments(mmControl);
        }
Пример #5
0
 /// <summary>
 /// Jonathan Sanborn
 /// Get the user with the passed in id or null if the user
 /// does not exists
 /// </summary>
 /// <param name="id">The id of the user</param>
 /// <returns>The user with the id</returns>
 public User GetUserByID(string id)
 {
     string fileName = Path.Combine(filePath, Properties.Settings.Default.usersFilename);
     User user = null;
     try
     {
         XDocument userFile = OpenFile(fileName, MMFileType.User);
         if (userFile != null)
         {
             XElement elem = userFile.Descendants("User").First(s => s.Element("ID").Value == id );
             user = new User(elem);
         }
     }
     catch (FileNotFoundException ex)
     {
         System.Diagnostics.Debug.Write(ex.Message);
     }
     return user;
 }
 //personalise label for the student we are currently working on. 
 public AddNewProblemSet(User student)
 {
     _Student = student;
     InitializeComponent();
     lblUserNameDisplay.Text = "Student Name: " + _Student.ScreenName;
 }
Пример #7
0
  /// <summary>
  /// 22 March 2014
  /// Jonathan Sanborn & Harvey Mercado
  /// Copy constructor take the passed in user and copies the defining values 
  /// into a new instance of the Admin
  /// </summary>
  /// <param name="user">The user to with the set values to copy from.</param>
 public Admin(User user) : base()
 {
     init();
     
     this.ID = user.ID;
     this.UserType = user.UserType;
     this.FirstName = user.FirstName;
     this.LastName = user.LastName;
     this.ScreenName = user.ScreenName;
     this.Password = user.Password;
     this.LoginRecords = user.LoginRecords;
 }
        //we need to set a date for whent he last time the user had login to the Math Monkeys
        public void updateLoginDate(User student, string fileName)
        {
            string today;
            today = DateTime.Now.ToString(Properties.Settings.Default.dateFormat);

            if (File.Exists(fileName) == true) // Checks if file exists
            {
                xmlDocument = XDocument.Load(fileName);
                var query = from item in xmlDocument.Descendants("User")
                            where (item.Element("Name").Value == student.ScreenName &&
                            item.Element("UniqueID").Value == student.ID.ToString())
                            select item;
                foreach (XElement itemE in query)
                {
                    //System.Diagnostics.Debug.Write("An item was selected");
                    itemE.SetElementValue("LoginDate", today);
                }
                xmlDocument.Save(fileName);
            }
        }
 //read in report to ReportList 
 public void GetUserReport(User student)
 {
     //Report handler "ReadFile" could be implemented by taking the user as a parameter
     _fileNameReport = (student.ScreenName + student.ID + ".xml").Replace(" ", "");
     ReportList = StudentReport.ReadFile(_fileNameReport);
 }
        //ViewReport reads into xml file and display the report for selected student 
        public void ViewReport(User student)
        {
            try
            {
                //dtgAdministrator.Rows.Clear();
                dtgAdministrator.Columns.Clear();
                string fileName = (student.ScreenName + student.ID.ToString() + ".xml").Replace(" ", "");
                try
                {
                    XmlDataDocument xmldata = new XmlDataDocument();
                    xmldata.DataSet.ReadXml(fileName);
                    dtgAdministrator.DataSource = xmldata.DataSet;
                    dtgAdministrator.DataMember = "Report";

                }
                catch
                {
                    MessageBox.Show("Error Opening file");
                }
            }
            catch (ArgumentException)
            {
                MessageBox.Show("Error displaying");
            }

        }
Пример #11
0
 /// <summary>
 ///  22 March 2014
 /// Jonathan Sanborn & Harvey Mercado
 /// returns a bool of if the user is valid
 /// 
 /// 21 April 2014
 /// Jeff Bunce
 /// Refactored.  Keeping this as a function because
 /// other methods of authentication can be easily
 /// swapped out in lieu of password authentication.
 /// </summary>
 /// <param name="user">The user to authenticate</param>
 /// <param name="password">the password for the user</param>
 /// <returns>if the user is valid</returns>
 private bool AuthenticateUser(User user, string password)
 {
     return (user.Password == password);
 }
Пример #12
0
 /// <summary>
 /// 
 /// 22 March 2014
 ///Jonathan Sanborn & Harvey Mercado
 ///Updates the currently selected user
 /// </summary>
 /// <param name="sender">The object that raised the event</param>
 /// <param name="e">The event arguments</param>
 internal void LoginSelectionChanged(object sender, EventArgs e)
 {
     ComboBox changed = sender as ComboBox;
     currentUser = (User)changed.SelectedValue;
 }
        //Update file will be called after a student have completed a fiel certain fields wil be updated. 
        public void UpdateReport(User student, double grade, Report report) //  Jungle jungle,  //Adds just a student for now with  uniqueID=count and some userName
        {
            //System.Diagnostics.Debug.Write("Grade is handler " + grade);
            string today;
            today = DateTime.Now.ToString(Properties.Settings.Default.dateFormat);
            _fileName = (student.ScreenName + student.ID + ".xml").Replace(" ", "");

            if (File.Exists(_fileName) == true) // Checks if file exists
            {
                System.Diagnostics.Debug.Write("File Name " + report.AssignmentName);
                xmlDocument = XDocument.Load(_fileName);
                var query = from item in xmlDocument.Descendants("Report")
                            where (item.Element("AssignmentName").Value == report.AssignmentName &&
                            item.Element("AssignmentComplete").Value == "false")
                            select item;
                foreach (XElement itemE in query)
                {
                    //System.Diagnostics.Debug.Write("An item was selected");
                    //itemE.SetElementValue("JungleName", jungle.JungleName);
                    itemE.SetElementValue("AssignmentComplete", true);
                    itemE.SetElementValue("DateComplete", today);
                    itemE.SetElementValue("Grade", Math.Round(grade, 2));
                }
                xmlDocument.Save(_fileName);
            }
            else
            {
                System.Diagnostics.Debug.Write("File Is not Existent for Use: " + student.ScreenName + student.ID);
            }

        }
 //When the program start ther will be not xml file existen therefore we create one with a default administrator
 public void WriteReport(User student, string AssName, int Goal)
 {
     string today;
     today = DateTime.Now.ToString(Properties.Settings.Default.dateFormat);
     DateTime? dt = null;
     _fileName = (student.ScreenName + student.ID.ToString() + ".xml").Replace(" ", "");
     if (File.Exists(_fileName) == true)
     {
         if (fileIsOpen = OpenFile(_fileName))
         {
             //make sure that count should be zero        
             //as the first time we create a program we make a admin a default user
             var newReportNode = new XElement("Report",
                            new XElement("AssignmentName", AssName),
                            new XElement("JungleName", ""),
                            new XElement("AssignmentComplete", false),
                            new XElement("DateAssg", today),
                            new XElement("DateComplete", dt),
                            new XElement("Goal", Goal),
                            new XElement("Grade", 0)
                            );
             xmlDocument.Element("Reports").Add(newReportNode);
             xmlDocument.Save(_fileName);
             RepNumber++;
         }
     }
     //need an alternative
 }