コード例 #1
0
        //public List<AssignmentAttempt> GetAssignmentAttemptsByDateRange(DateTime startDate, DateTime endDate)
        //{
        //    var assignmentAttempts = from assignmentAttempt in GetAllAssignmentAttempts()
        //                             where assignmentAttempt.Date >= startDate
        //                                && assignmentAttempt.Date <= endDate
        //                             select assignmentAttempt;

        //    return new List<AssignmentAttempt>(assignmentAttempts);
        //}

        public void SaveNewAssignmentAttempt(AssignmentAttempt assignmentAttempt)
        {
            string fileName = Path.Combine(filePath, Properties.Settings.Default.assignmentAttempsFilename);

            try
            {
                XDocument assignmentAttemptFile = OpenFile(fileName, MMFileType.AssignmentAttempt);

                if (assignmentAttemptFile != null)
                {
                    assignmentAttemptFile.Element("AssignmentAttempts").Add(assignmentAttempt.GetXMLNode());
                    assignmentAttemptFile.Save(fileName);
                }
            }
            catch (FileNotFoundException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }
        }
コード例 #2
0
            public void UpdateAssignmentAttempt(AssignmentAttempt assignmentAttempt)
            {
                string fileName = Path.Combine(filePath, Properties.Settings.Default.assignmentAttempsFilename);

                try
                {
                    XDocument assignmentAttemptFile = OpenFile(fileName, MMFileType.AssignmentAttempt);

                    if (assignmentAttemptFile != null)
                    {
                        assignmentAttemptFile.Descendants("AssignmentAttempt").First(s => s.Element("ID").Value == assignmentAttempt.ID).ReplaceWith(assignmentAttempt.GetXMLNode());
                        assignmentAttemptFile.Save(fileName);
                    }

                }
                catch (FileNotFoundException ex)
                {
                    System.Diagnostics.Debug.Write(ex.Message);
                }
                catch (ArgumentNullException ex)
                {
                    System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateAssignmentAttempt failed null referance.\n" + ex.Message);
                }
                catch (InvalidOperationException ex)
                {
                    System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateAssignmentAttempt failed Invalid Operation.\n" + ex.Message);
                }   
            }
コード例 #3
0
            //public List<AssignmentAttempt> GetAssignmentAttemptsByDateRange(DateTime startDate, DateTime endDate)
            //{
            //    var assignmentAttempts = from assignmentAttempt in GetAllAssignmentAttempts()
            //                             where assignmentAttempt.Date >= startDate
            //                                && assignmentAttempt.Date <= endDate
            //                             select assignmentAttempt;

            //    return new List<AssignmentAttempt>(assignmentAttempts);
            //}

            public void SaveNewAssignmentAttempt(AssignmentAttempt assignmentAttempt)
            {
                string fileName = Path.Combine(filePath, Properties.Settings.Default.assignmentAttempsFilename);

                try
                {
                    XDocument assignmentAttemptFile = OpenFile(fileName, MMFileType.AssignmentAttempt);

                    if (assignmentAttemptFile != null)
                    {
                        assignmentAttemptFile.Element("AssignmentAttempts").Add(assignmentAttempt.GetXMLNode());
                        assignmentAttemptFile.Save(fileName);
                    }
                }
                catch (FileNotFoundException ex)
                {
                    System.Diagnostics.Debug.Write(ex.Message);
                }
            
            }
コード例 #4
0
        public void UpdateAssignmentAttempt(AssignmentAttempt assignmentAttempt)
        {
            string fileName = Path.Combine(filePath, Properties.Settings.Default.assignmentAttempsFilename);

            try
            {
                XDocument assignmentAttemptFile = OpenFile(fileName, MMFileType.AssignmentAttempt);

                if (assignmentAttemptFile != null)
                {
                    assignmentAttemptFile.Descendants("AssignmentAttempt").First(s => s.Element("ID").Value == assignmentAttempt.ID).ReplaceWith(assignmentAttempt.GetXMLNode());
                    assignmentAttemptFile.Save(fileName);
                }
            }
            catch (FileNotFoundException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }
            catch (ArgumentNullException ex)
            {
                System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateAssignmentAttempt failed null referance.\n" + ex.Message);
            }
            catch (InvalidOperationException ex)
            {
                System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateAssignmentAttempt failed Invalid Operation.\n" + ex.Message);
            }
        }