Esempio n. 1
0
        internal Message AddNewCourse(CourseName courseName)
        {
            Message msg    = new Message();
            Course  course = new Course()
            {
                courseName = courseName.courseName
            };

            try
            {
                if (query.courseExistsOnName(context, courseName.courseName))
                {
                    msg.status  = false;
                    msg.message = "Course already exists";
                }
                else
                {
                    query.AddNewCourseByNameId(context, course);
                    msg.status = true;
                }
            }
            catch (Exception e)
            {
                msg.status  = false;
                msg.message = $"Internal error: {e}";
            }

            return(msg);
        }
Esempio n. 2
0
        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            result.Append(Id.ToString());
            result.Append("|");
            result.Append(CourseCode.ToString());
            result.Append("|");
            result.Append(CourseName.ToString());
            result.Append("|");
            result.Append(Ects.ToString());
            result.Append("|");
            result.Append(CourseType.ToString());
            result.Append("|");
            result.Append(Zzu.ToString());
            result.Append("|");
            result.Append(SemesterNumber.ToString());
            result.Append("|");
            result.Append(StudyPlanID.ToString());
            result.Append("|");
            result.Append(CoursesGroupID.ToString());
            result.Append("|");
            result.Append(IsCoursesGroup.ToString());
            return(result.ToString());
        }
Esempio n. 3
0
        public void AddStudentToCourse(Student student, CourseName course)
        {
            switch (course)
            {
            case CourseName.programming:
                if (GetCountOfStudents(CourseName.programming) < 30)
                {
                    programmingList.Add(student);
                }
                break;

            case CourseName.math:
                if (GetCountOfStudents(CourseName.math) < 30)
                {
                    mathList.Add(student);
                }
                break;

            case CourseName.algorithms:
                if (GetCountOfStudents(CourseName.algorithms) < 30)
                {
                    algorithms.Add(student);
                }
                break;
            }
        }
Esempio n. 4
0
        public void Invoke(CourseId id, CourseName name, CourseDuration duration)
        {
            Course course = Course.Create(id, name, duration);

            this.Repository.Save(course);
            this.Bus.Publish(course.PullDomainEvent());
        }
Esempio n. 5
0
 public override int GetHashCode()
 {
     unchecked {
         const int randomPrime = 397;
         int       hashCode    = Id.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (FullDocumentFileName != null ? FullDocumentFileName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (FreeSnippetFileName != null ? FreeSnippetFileName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (OriginalFileName != null ? OriginalFileName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Degree != null ? Degree.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (CourseName != null ? CourseName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (CourseCode != null ? CourseCode.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Year != null ? Year.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ UniversityId.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ UploadedBy.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ UploadedAt.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (DeletedAt != null ? DeletedAt.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ IsFree.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (IsApproved != null ? IsApproved.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Hash != null ? Hash.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (MinHashSignature != null ? MinHashSignature.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ CategoryId.GetHashCode();
         return(hashCode);
     }
 }
        public void Invoke(CreateCourseCommand command)
        {
            CourseId       id       = new CourseId(command.Id);
            CourseName     name     = new CourseName(command.Name);
            CourseDuration duration = new CourseDuration(command.Duration);

            this.Creator.Invoke(id, name, duration);
        }
        public async Task Create(CourseId id, CourseName name, CourseDuration duration)
        {
            var course = Course.Create(id, name, duration);

            await _repository.Save(course);

            await _eventBus.Publish(course.PullDomainEvents());
        }
        public async Task Handle(CreateCourseCommand command)
        {
            var id       = new CourseId(command.Id);
            var name     = new CourseName(command.Name);
            var duration = new CourseDuration(command.Duration);

            await _creator.Create(id, name, duration);
        }
Esempio n. 9
0
        public ResultEntity alertCourseName(int?courseNameID, String courseName)
        {
            CourseName   temp         = new CourseName(courseNameID, courseName);
            ResultEntity resultEntity = new ResultEntity();

            resultEntity.setState(courseService.alertCourseName(temp));
            resultEntity.setMessage(resultEntity.getState() == 1 ? "修改成功!" : resultEntity.getState() == 0 ? "该课程名已经存在!" : "无该课程信息!");
            return(resultEntity);
        }
Esempio n. 10
0
 /// <summary>
 /// get the course name text
 /// </summary>
 /// <returns>text</returns>
 public string GetCourseName()
 {
     CourseName.Wait(2);
     if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
     {
         CourseName.Text = FakeText;
     }
     return(CourseName.Text);
 }
Esempio n. 11
0
        public void AddStudentToCourse_AddingNewStudent_CountOfStudentsMustIncrement(CourseName courseName)
        {
            //Arrange
            Course c = new Course();

            //Act
            c.AddStudentToCourse(new Student("Pesho"), courseName);
            int result = c.GetCountOfStudents(courseName);

            //Assert
            Assert.AreEqual(1, result);
        }
Esempio n. 12
0
        public async Task Invoke(CreateCourseRequest request)
        {
            var id       = new CourseId(request.Id);
            var name     = new CourseName(request.Name);
            var duration = new CourseDuration(request.Duration);

            Course course = Course.Create(id, name, duration);

            await this._repository.Save(course);

            await this._eventBus.Publish(course.PullDomainEvents());
        }
        protected void GVSubInner_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                hidCollCourseDetails.Value = CollName.ToString() + CourseName.ToString();

                ((LinkButton)e.Row.Cells[4].FindControl("lnkStudList")).Text = "View Student List";
                ((LinkButton)e.Row.Cells[4].FindControl("lnkStudList")).Attributes.Add("onclick", "return openNewWindow(" + ((GridView)sender).DataKeys[e.Row.RowIndex]["pk_Pp_PpHead_CrPrCh_ID"].ToString() + "," + ((GridView)sender).DataKeys[e.Row.RowIndex]["pk_TchLrnMth_ID"].ToString() + "," + ((GridView)sender).DataKeys[e.Row.RowIndex]["pk_AssMth_ID"].ToString() + "," + ((GridView)sender).DataKeys[e.Row.RowIndex]["pk_AssType_ID"].ToString() + "," + ((GridView)sender).DataKeys[e.Row.RowIndex]["pk_Inst_ID"].ToString() + ");");

                ((LinkButton)e.Row.Cells[4].FindControl("lnkStudList")).ToolTip   = "Click here to view the list of student(s).";
                ((LinkButton)e.Row.Cells[4].FindControl("lnkStudList")).ForeColor = System.Drawing.Color.Blue;
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="courseName">Course name</param>
        /// <param name="credit">Course credit</param>
        /// <param name="classification">Course classification</param>
        /// <param name="examType">Exam type</param>
        /// <param name="time">Exam time</param>
        /// <param name="location">Exam location</param>
        /// <param name="seat">Exam seat</param>
        public ExamArrangement(string courseName, string credit, string classification,
                               string examType, string time, string location, string seat)
        {
            CourseName     = Convert.ToString(courseName).Trim();
            Credit         = Convert.ToString(credit).Trim();
            Classification = Convert.ToString(classification).Trim();
            ExamType       = Convert.ToString(examType).Trim();
            Time           = Convert.ToString(time).Trim();
            Location       = Convert.ToString(location).Trim();
            Seat           = Convert.ToString(seat).Trim();
            BeginTime      = null;
            EndTime        = null;

            // throw [...] in the course name
            if (CourseName.Contains("]"))
            {
                CourseName = CourseName.Substring(CourseName.IndexOf("]") + 1);
            }

            // calculate begin time and end time.
            if (Time.Contains("(") && Time.Contains(")") && Time.Contains("-"))
            {
                string[] datePart = Time.Substring(0, Time.IndexOf("(")).Split('-');
                string[] timePart = Time.Substring(Time.IndexOf(")") + 1).Split('-');
                if (timePart.Count() == 2)
                {
                    string[] begin = timePart[0].Split(':');
                    string[] end   = timePart[1].Split(':');
                    BeginTime = new DateTime(
                        Convert.ToInt32(datePart[0]),
                        Convert.ToInt32(datePart[1]),
                        Convert.ToInt32(datePart[2]),
                        Convert.ToInt32(begin[0]),
                        Convert.ToInt32(begin[1]),
                        0
                        );
                    EndTime = new DateTime(
                        Convert.ToInt32(datePart[0]),
                        Convert.ToInt32(datePart[1]),
                        Convert.ToInt32(datePart[2]),
                        Convert.ToInt32(end[0]),
                        Convert.ToInt32(end[1]),
                        0
                        );
                }
            }
        }
Esempio n. 15
0
        public void RemoveStudentFromCourse(Student student, CourseName course)
        {
            switch (course)
            {
            case CourseName.programming:
                programmingList.Remove(student);
                break;

            case CourseName.math:
                mathList.Remove(student);
                break;

            case CourseName.algorithms:
                algorithms.Remove(student);
                break;
            }
        }
Esempio n. 16
0
        protected void DropDownListBind()
        {
            SqlConnection con  = DataOperate.CreateCon();
            SqlCommand    cmd1 = new SqlCommand();

            cmd1.Connection = con;
            string teacher = Session["userName"].ToString();

            cmd1.CommandText = "select * from CourseInfo where teacher ='" + teacher + "'";
            SqlDataReader reader1 = null;

            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            reader1 = cmd1.ExecuteReader();
            CourseName.DataSource     = reader1;
            CourseName.DataTextField  = "courseName";
            CourseName.DataValueField = "courseId";
            CourseName.DataBind();
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
            SqlCommand cmd2 = new SqlCommand();

            cmd2.Connection  = con;
            cmd2.CommandText = "select * from VideoInfo where CourseId ='" + CourseName.SelectedValue + "'";
            SqlDataReader reader2 = null;

            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            reader2 = cmd2.ExecuteReader();
            VideoName.DataSource     = reader2;
            VideoName.DataTextField  = "videoName";
            VideoName.DataValueField = "videoId";
            VideoName.DataBind();
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
        }
 public ActionResult AddNewCourse(CourseName course)
 {
     try
     {
         var msg = courseService.AddNewCourse(course);
         if (msg.status)
         {
             return(Ok());
         }
         else
         {
             return(BadRequest(msg.message));
         }
     }
     catch (Exception e)
     {
         return(StatusCode(500, e));
     }
 }
Esempio n. 18
0
        public int GetCountOfStudents(CourseName course)
        {
            int count = 0;

            switch (course)
            {
            case CourseName.programming:
                count = programmingList.Count;
                break;

            case CourseName.math:
                count = mathList.Count;
                break;

            case CourseName.algorithms:
                count = algorithms.Count;
                break;
            }

            return(count);
        }
Esempio n. 19
0
 public override string ToString()
 {
     if (CourseName == null)
     {
         return(String.Format("<Name:{0} Teacher:{1} Loc:{2} Week:{3}  | 0 - 0 | >"
                              , "NULL"
                              , "NULL"
                              , "NULL"
                              , "NULL"));
     }
     else
     {
         return(String.Format("<Name:{0} Teacher:{1} Loc:{2} Week:{3}  |{4}-{5}| >"
                              , CourseName.PadLeft(10)
                              , CourseTeacher.PadLeft(5)
                              , CourseLoc.PadLeft(5)
                              , CourseDur
                              , CourseTime.WeekDay
                              , CourseTime.DayTime));
     }
 }
Esempio n. 20
0
        public ResultEntity addCourseName(String courseName)
        {
            ResultEntity resultEntity = new ResultEntity();

            if (courseName != null)
            {
                resultEntity.setData(courseService.addCourseName(courseName));
                resultEntity.setState(resultEntity.getData() != null ? 1 : 0);
                resultEntity.setMessage(resultEntity.getState() == 1 ? "添加课程成功!" : "该课程已经存在!");
                if (resultEntity.getState() == 1)
                {
                    CourseName temp = (CourseName)resultEntity.getData();
                    courseService.addCourseRelation(temp.courseNameID, 0);
                }
            }
            else
            {
                resultEntity.setState(-1);
                resultEntity.setMessage("课程名不能为空!");
            }
            return(resultEntity);
        }
Esempio n. 21
0
 public static int?update(CourseName courseName)
 {
     return(Global.db.Updateable(courseName).ExecuteCommand());
 }
 public static Course Create(CourseId id, CourseName name, CourseDuration duration)
 {
     return(new Course(id, name, duration));
 }
 public static CreateCourseRequest Create(CourseId id, CourseName name, CourseDuration duration)
 {
     return(new CreateCourseRequest(id.Value, name.Value, duration.Value));
 }
Esempio n. 24
0
        static void Main(string[] args)
        {
            ///////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////
            ///////////////////////////////////////////////////////////////////////////////////////
            //For storing the data in the database using one to one relationship
            using (var context = new RelationContext())
            {
                string name, email;
                int    SectionId;
                float  cgpa;
                Console.Write("Please enter Your name\nName:::");
                name = Console.ReadLine();
                Console.Write("Please enter Your Email\nEmail:::");
                email = Console.ReadLine();
                Console.Write("Please enter Your cgpa\nCGPA:::");
                cgpa = float.Parse(Console.ReadLine());
                Console.Write("Please enter Your Section ID\nA=1--B=2--C=3--D=4--E1=5--E2=6\nSection Id:::");
                SectionId = int.Parse(Console.ReadLine());
                var std = new Student()
                {
                    name      = name,
                    cgpa      = cgpa,
                    email     = email,
                    SectionId = SectionId
                };
                context.Students.Add(std);

                /*var sec1 = new Section()
                 * {
                 *  SecitonName = "E2"
                 * };
                 * context.Sections.Add(sec1);*/
                context.SaveChanges();

                string streetNo, city, Province, state;
                int    HouseNo;
                Console.Write("Please enter Your House Number\nHouse Number:::");
                HouseNo = int.Parse(Console.ReadLine());
                Console.Write("Please enter Your Street Number\nStreet Number:::");
                streetNo = Console.ReadLine();
                Console.Write("Please enter Your city\ncity:::");
                city = Console.ReadLine();
                Console.Write("Please enter Your Province\nProvince:::");
                Province = Console.ReadLine();
                Console.Write("Please enter Your State\nState:::");
                state = Console.ReadLine();

                var add = new Address()
                {
                    HouseNo   = HouseNo,
                    streetNO  = streetNo,
                    city      = city,
                    Province  = Province,
                    state     = state,
                    StudentId = std.Id
                };
                context.Adresses.Add(add);

                int      AddCourse = 1;
                string   CourseName;
                int      credits;
                Course   cours = new Course();
                StuCorse stucor;
                while (AddCourse == 1)
                {
                    Console.WriteLine("Please enter the Course Name you want to enroll in");
                    CourseName = Console.ReadLine();
                    if (CourseName.Contains("lab") || CourseName.Contains("Lab") || CourseName.Contains("LAB"))
                    {
                        credits = 1;
                    }
                    else
                    {
                        credits = 3;
                    }


                    /*var courses = from c in context.Courses
                     *            select c.Title.ToLower;*/
                    int PresentId = 0;
                    int length    = context.Courses.Count();
                    int counter   = 1;
                    foreach (var item in context.Courses)
                    {
                        if (CourseName.ToLower() == item.Title.ToLower())
                        {
                            PresentId = item.Id;
                            break;
                        }
                        if (counter == length)
                        {
                            cours = new Course()
                            {
                                Title       = CourseName.ToLower(),
                                creditHours = credits
                            };
                            context.Add(cours);
                        }
                        counter++;
                    }
                    context.SaveChanges();
                    if (PresentId == 0)
                    {
                        stucor = new StuCorse()
                        {
                            StudentId = std.Id,
                            CourseId  = cours.Id
                        };
                        context.SCTable.Add(stucor);
                        context.SaveChanges();
                    }
                    else
                    {
                        stucor = new StuCorse()
                        {
                            StudentId = std.Id,
                            CourseId  = PresentId
                        };
                        context.SCTable.Add(stucor);
                        context.SaveChanges();
                    }

                    AddCourse = 0;
                }
            }



            //for printing the data from the datbabase
            List <Student> StuList    = new List <Student>();
            List <Address> StuAddList = new List <Address>();

            /*using (var context = new RelationContext())
             * {
             *  int counter = 1;
             *  StuList= context.Students.ToList();
             *  StuAddList = context.Adresses.ToList();
             *  foreach (var item in StuList)
             *  {
             *      Console.WriteLine(counter+"\nPrinting the Student Details");
             *      counter++;
             *      Console.Write(item.cgpa + " " + item.email + " " + item.name+" ");
             *      var Addresses = from add in StuAddList
             *                     where add.StudentId == item.Id
             *                     select add;
             *      foreach (var add in Addresses)
             *      {
             *          Console.Write(add.HouseNo + " " + add.streetNO + " " + add.city + " " + add.Province + " " + add.state);
             *
             *      }
             *      Console.WriteLine();
             *      Console.WriteLine();
             *
             *
             *  }
             *
             * }*/



            /////////////////////////////////////////////////
            ///Code for simple database mani[pulation
            string title, body;
            int    id;
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //To add new post by getting the input from the user

            /*using(var context = new DbPosts())
             * {
             *
             *  Console.Write("Please enter the title and body of the post \nTitle:::");
             *  title=Console.ReadLine();
             *  Console.Write("Body:::");
             *  body = Console.ReadLine();
             *  var post = new Post()
             *  {
             *      title =title,
             *      body = body
             *  };
             *  context.Posts.Add(post);
             *  context.SaveChanges();
             * }*/
            List <Post> list = new List <Post>();

            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //To get the data from the database using LINQ Queries

            /*using (var context = new DbPosts())
             * {
             *  list = context.Posts.ToList();
             *  foreach (var l in list)
             *      Console.WriteLine("Title: " + l.title);
             * }*/


            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //To get the selected data from DBPost and pritnting it

            /*using (var context = new DbPosts())
             * {
             *  list = context.Posts.ToList();
             *  var TempPost = from Post in list
             *                 where Post.body.Contains("d")
             *                 select Post;
             *  int counter = 0;
             *  foreach (var post in TempPost)
             *  {
             *      counter++;
             *      Console.Write(post.title+" ");
             *      Console.WriteLine(post.body);
             *
             *  }
             *  Console.WriteLine("Total post found ::" + counter);
             * }*/



            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //TO update the data in the database

            /*using (var context = new DbPosts())
             * {
             *  var post = new Post()
             *  {
             *      title = "Hello from the updation",
             *      body = "Updated data"
             *  };
             *
             *
             *  var post1 =context.Posts.Single(p => p.id == 1);
             *  post1.title = post.title;
             *  post1.body = post.body;
             *  context.Update(post1);
             *  context.SaveChanges();
             * }*/



            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            ///TO Update the data using the input from the user

            /*using(var context = new DbPosts())
             * {
             *  list = context.Posts.ToList();
             *  Console.Write("Please enter the title and body of the post \nTitle:::");
             *  title = Console.ReadLine();
             *  Console.Write("Body:::");
             *  body = Console.ReadLine();
             *  Console.Write("Id of the post you want to update:::");
             *  id = int.Parse(Console.ReadLine());
             *  while (id < 1 || id > list.Count)
             *  {
             *      Console.Write("Please enter the valid ID:::");
             *      id = int.Parse(Console.ReadLine());
             *  }
             *  var PostToBeUpdated = context.Posts.Single(post => post.id == id);
             *  PostToBeUpdated.title = title;
             *  PostToBeUpdated.body = body;
             *  context.Update(PostToBeUpdated);
             *  context.SaveChanges();
             * }*/


            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            ///TO Delete the post from the Database

            /*using(var context = new DbPosts())
             * {
             *  var PostToBeDeleted = context.Posts.Single(post => post.id == 1);
             *  context.Remove(PostToBeDeleted);
             *  context.SaveChanges();
             * }
             */

            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////
            ///TO Delete the post from the Database by taking the id from the user

            /*using (var context = new DbPosts())
             * {
             *  Post PostToBeDeleted;
             *  Console.WriteLine("Enter the Id of the post you want to delete\nID::::");
             *  id = int.Parse(Console.ReadLine());
             *  try
             *  {
             *      PostToBeDeleted = context.Posts.Single(post => post.id == id);
             *      context.Remove(PostToBeDeleted);
             *      context.SaveChanges();
             *  }
             *  catch
             *  {
             *      Console.WriteLine("No such Id Found");
             *  }
             *
             * }*/
        }
 public static CourseCreatedDomainEvent Create(CourseId id, CourseName name, CourseDuration duration)
 {
     return(new CourseCreatedDomainEvent(id.Value, name.Value, duration.Value));
 }
Esempio n. 26
0
 public override int GetHashCode()
 {
     return(CourseName.GetHashCode() ^ CourseYear.GetHashCode());
 }
Esempio n. 27
0
 public static Course GetCourse(CourseName name)
 {
     return coursesList[name];
 }
Esempio n. 28
0
        /// <summary>
        /// Publisher for Individual Comment Letter.
        /// </summary>
        /// <param name="studentCommentId"></param>
        public CommentLetter(int studentCommentId, bool commandLine = false, String saveDir = "")
        {
            SaveDirectory = saveDir;
            using (WebhostEntities db = new WebhostEntities())
            {
                if (db.StudentComments.Where(com => com.id == studentCommentId).Count() <= 0)
                {
                    throw new CommentException(String.Format("No comment letter with id={0} exists.", studentCommentId));
                }

                StudentComment studentParagraph = db.StudentComments.Where(com => com.id == studentCommentId).Single();

                flagFileName = String.Format("{1}{0}_flag.txt", studentCommentId, commandLine?"":saveDir.Equals("")?"~/Temp/":saveDir + "\\");

                StudentHTML = CleanTags(studentParagraph.HTML, true);
                HeaderHTML  = CleanTags(studentParagraph.CommentHeader.HTML, true);
                StudentName = studentParagraph.Student.FirstName + " " + studentParagraph.Student.LastName;
                AdvisorName = studentParagraph.Student.Advisor.FirstName + " " + studentParagraph.Student.Advisor.LastName;
                CourseName  = studentParagraph.CommentHeader.Section.Course.Name;
                Authors     = new Dictionary <string, Signature>();
                foreach (Faculty teacher in studentParagraph.CommentHeader.Section.Teachers)
                {
                    Authors.Add(String.Format("{0} {1}", teacher.FirstName, teacher.LastName), new Signature(teacher.ID));
                }

                showExam  = !studentParagraph.CommentHeader.Section.Block.LongName.Contains("Sports");
                showFinal = studentParagraph.CommentHeader.TermIndex == studentParagraph.CommentHeader.Section.Terms.OrderBy(term => term.StartDate).ToList().Last().id;

                FinalGrade  = studentParagraph.FinalGrade.Name;
                ExamGrade   = studentParagraph.ExamGrade.Name;
                TermGrade   = studentParagraph.TermGrade.Name;
                EffortGrade = studentParagraph.EffortGrade.Name;

                TermName    = studentParagraph.CommentHeader.Term.Name;
                PublishDate = studentParagraph.CommentHeader.Term.CommentsDate;
                String fileName = String.Format("{0} - {1} {2}", StudentName, studentParagraph.CommentHeader.Section.Block.Name, CourseName.Replace("+", "p")).ToLower();

                fileName = fileName.Replace(" ", "_");
                fileName = fileName.Replace("\"", "");
                Regex disalowedChars = new Regex(@"(\.|:|&|#|@|\*|~|\?|<|>|\||\^|( ( )+)|/)");
                foreach (Match match in disalowedChars.Matches(fileName))
                {
                    fileName = fileName.Replace(match.Value, "");
                }

                fileName = String.Format("{0}{1}.pdf", commandLine?"C:\\Temp\\":saveDir.Equals("")?"~/Temp/":saveDir + "\\", fileName);

                Init(fileName, String.Format("{0} - {1} {2} {3} Comment Letter", StudentName, studentParagraph.CommentHeader.Section.Block.Name, CourseName, TermName), Authors.Keys.First());
            }
        }
Esempio n. 29
0
 public Course(CourseName name)
 {
     this._name = name.ToString();
 }
Esempio n. 30
0
        public void JoinCourse(Student student, CourseName course)
        {
            Course c = new Course();

            c.AddStudentToCourse(student, course);
        }
Esempio n. 31
0
 public static int?insert(CourseName courseName)
 {
     return(courseName.courseNameID != null?Global.db.Saveable(courseName).ExecuteCommand() : Global.db.Insertable(courseName).ExecuteCommand());
 }
Esempio n. 32
0
        public void LeaveCourse(Student student, CourseName course)
        {
            Course c = new Course();

            c.RemoveStudentFromCourse(student, course);
        }