当前位置: 首页>>代码示例>>C#>>正文


C# Course类代码示例

本文整理汇总了C#中Course的典型用法代码示例。如果您正苦于以下问题:C# Course类的具体用法?C# Course怎么用?C# Course使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Course类属于命名空间,在下文中一共展示了Course类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: imgBtnSave_Click

    //添加考试科目事件
    protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            Course course = new Course();               //创建考试科目对象
            //start:胡媛媛修改,去掉考试科目输入框两边的空格,加trim(),2010-4-29
            course.Name = txtName.Text.Trim();                 //设置考试科目对象属性

            //程军添加,添加考试科目,名称不能相同。2010-4-25
            DataBase db = new DataBase();
            string mySql = "select * from Course where Name ='" + txtName.Text.Trim() + "'";
            //end:胡媛媛修改,去掉考试科目输入框两边的空格,加trim(),2010-4-29
            if (db.GetRecord(mySql))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('课程章节重复!')</script>");
                this.txtName.Focus();
            }
            else
            {
               if (course.InsertByProc())                  //调用添加考试科目方法添加考试科目
              {
                  lblMessage.Text = "成功添加该章节科目!";
              }
              else
              {
                  lblMessage.Text = "添加该章节失败!";
              }
            }

            //程军添加,添加考试科目,名称不能相同。2010-4-25
        }
    }
开发者ID:dalinhuang,项目名称:my-project-step,代码行数:33,代码来源:admin_CourseAdd.aspx.cs

示例2: Main

        /* 02. Write a console application that uses the data.*/
        /// <summary>
        /// Mains this instanse.
        /// </summary>
        public static void Main()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<StudentSystemContext, Configuration>());
            using (var db = new StudentSystemContext())
            {
                var pesho = new Student { Name = "Pesho", Number = 666 };
                db.Students.Add(pesho);
                db.SaveChanges();

                var dbCourse = new Course
                {
                    Name = "Database Course",
                    Description = "Basic Database operations",
                    Materials = "http://telerikacademy.com/Courses/Courses/Details/98"
                };
                db.Courses.Add(dbCourse);
                db.SaveChanges();

                var course = db.Courses.First(c => c.Name == dbCourse.Name);
                var student = db.Students.First(s => s.Number == pesho.Number);

                var hw = new Homework
                {
                    Content = "Empty Homework",
                    TimeSent = DateTime.Now,
                    CourseId = course.CourseId,
                    StudentId = student.StudentID
                };
                db.Homeworks.Add(hw);
                db.SaveChanges();
            }

            ListStudents();
        }
开发者ID:nkolarov,项目名称:telerik-academy,代码行数:38,代码来源:StudentSystemDemo.cs

示例3: EnsureCourseNumberCanNotAcceptValuesLessNonPositiveValues

        public void EnsureCourseNumberCanNotAcceptValuesLessNonPositiveValues()
        {
            int number = -1;
            string name = "C#";

            Course course = new Course(name, number);
        }
开发者ID:ValMomchilova,项目名称:TelerikAcademyHomeWorks,代码行数:7,代码来源:UnitTestCourse.cs

示例4: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            //do insert or update
            using (DefaultConnectionEF db = new DefaultConnectionEF())
            {
                Course objC = new Course();

                if (!String.IsNullOrEmpty(Request.QueryString["CourseID"]))
                {
                    Int32 CourseID = Convert.ToInt32(Request.QueryString["CourseID"]);
                    objC = (from c in db.Courses
                            where c.CourseID == CourseID
                            select c).FirstOrDefault();
                }

                //populate the course from the input form
                objC.Title = txtTitle.Text;
                objC.Credits = Convert.ToInt32(txtCredits.Text);
                objC.DepartmentID = Convert.ToInt32(ddlDepartment.SelectedValue);

                if (String.IsNullOrEmpty(Request.QueryString["CourseID"]))
                {
                    //add
                    db.Courses.Add(objC);
                }

                //save and redirect
                db.SaveChanges();
                Response.Redirect("courses.aspx");
            }
        }
开发者ID:ConnorX,项目名称:lab4,代码行数:31,代码来源:course.aspx.cs

示例5: StudentLeavingCourseShouldNotThrowException

 public void StudentLeavingCourseShouldNotThrowException()
 {
     Student student = new Student("Humpty Dumpty", 10000);
     Course course = new Course("Unit Testing");
     student.AttendCourse(course);
     student.LeaveCourse(course);
 }
开发者ID:studware,项目名称:Ange-Git,代码行数:7,代码来源:StudentTests.cs

示例6: btnAdd_Click

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        //Student s = new Student();
        //s.EnrolStudent((int)(gvCourse.SelectedValue), int.Parse(ddlNewStudents.SelectedValue), DateTime.Today.Year.ToString());
        //lblMessage.Text = "Student added";
        //gvClass.DataBind();
        //displayStudent();

        Course objCourse = new Course();

        //get information for enrolling student

        int studentID = int.Parse(ddlNewStudents.SelectedValue);

        int courseID = (int)gvCourse.SelectedValue;

        string year = DateTime.Now.Year.ToString();

        int numRowsAffected = objCourse.EnrolStudent(studentID, courseID, year);

        //display confirmation message
        if (numRowsAffected > 0)
        {
            lblMessage.Text = "New student added";
            lblMessage.CssClass = "confirmation";

        }
        else
        {
            lblMessage.Text = "Faild to add new student";
            lblMessage.CssClass = "error";
        }
    }
开发者ID:juehan,项目名称:PlayingWithOthers,代码行数:33,代码来源:EnrolStudent.aspx.cs

示例7: School_AddCourseTest

 public void School_AddCourseTest()
 {
     Course java = new Course("Java");
     School myTestSchool = new School();
     myTestSchool.AddCourse(java);
     Assert.AreEqual(java.CourseName, myTestSchool.Courses[0].CourseName);
 }
开发者ID:nzhul,项目名称:TelerikAcademy,代码行数:7,代码来源:School.Tests.cs

示例8: CheckIfCourseNameIsChangedAfterCourseCreation

        public void CheckIfCourseNameIsChangedAfterCourseCreation()
        {
            Course course = new Course("math");
            course.Name = "financial math";

            Assert.AreEqual("financial math", course.Name, string.Format("Expected output after course name change financial math. Received {0}", course.Name));
        }
开发者ID:huuuskyyy,项目名称:Javascript-Homeworks,代码行数:7,代码来源:CourseTests.cs

示例9: CourseShouldThrowAnApplicationExceptionWhenTheSameStudentIsAddedMoreThanOnce

 public void CourseShouldThrowAnApplicationExceptionWhenTheSameStudentIsAddedMoreThanOnce()
 {
     Course testCourse = new Course("Test");
     Student testStudent = new Student("a");
     testCourse.AddStudent(testStudent);
     testCourse.AddStudent(testStudent);
 }
开发者ID:SimoPrG,项目名称:TelerikAcademyHomeworks,代码行数:7,代码来源:CourseTest.cs

示例10: AddLOsToCourse

        public ActionResult AddLOsToCourse(Course course)
        {
            string stringOfLoIds = Request["selectedIds"];
            if (!stringOfLoIds.IsEmpty())
            {
                List<string> listOfLoIds = stringOfLoIds.Split(',').ToList();
                foreach (var id in listOfLoIds)
                {
                    var id1 = id;
                    var lo = _dbContext.LOs.Find(x => x.Id == ObjectId.Parse(id1)).SingleAsync().Result;
                    if (lo != null)
                    {
                        course.Duration += lo.Duration;
                        course.AddLo(lo.Id);
                    }
                }
            }

            ModelState.Clear();
            if (course.Id != ObjectId.Empty)
            {
                _logger.Trace("LO or LOs added to course during course editing");
                return View("EditCourse", course);
            }
            else
            {
                _logger.Trace("LO or LOs added to course during manual course creating");
                return View("ManualCourseCreating", course);
            }
        }
开发者ID:wadim1611,项目名称:222CourseBuildingsSystemMVCandWCF,代码行数:30,代码来源:HomeController.cs

示例11: Main

        private static void Main()
        {
            try
            {
                Student pesho = new Student("Pesho Georgiev");
                Student gosho = new Student("Gosho Ivanov");
                Student misho = new Student("Misho Cekov");
                Student sasho = new Student("Sasho Kostov");

                Course telerikAcademy = new Course("Telerik Academy");
                Course webProgramming = new Course("Web Programming");

                webProgramming.AddStudent(sasho);

                telerikAcademy.AddStudent(pesho);
                telerikAcademy.AddStudent(gosho);
                telerikAcademy.AddStudent(misho);

                telerikAcademy.RemoveStudent(gosho);
                Console.WriteLine(gosho.ToString() + " was removed from course.");

                Console.WriteLine("Courses:");
                Console.WriteLine(telerikAcademy);

                School freeSchool = new School("School of Computer Sciences");
                freeSchool.AddCourse(webProgramming);
                freeSchool.AddCourse(telerikAcademy);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:niki-funky,项目名称:Telerik_Academy,代码行数:33,代码来源:Demo.cs

示例12: Main

        public static void Main()
        {
            var streamReader = new StreamReader("../../students.txt");
            var multiDiuctionary = new OrderedMultiDictionary<Course, Student>(true);

            using (streamReader)
            {
                string line = streamReader.ReadLine();
                while (line != null)
                {
                    string[] parameters = line.Split(new char[] { ' ', '|' }, StringSplitOptions.RemoveEmptyEntries);

                    string courseName = parameters[2];
                    var course = new Course(courseName);

                    string firstName = parameters[0];
                    string lastName = parameters[1];
                    var student = new Student(firstName, lastName);

                    multiDiuctionary.Add(course, student);

                    line = streamReader.ReadLine();
                }
            }

            PrintCourses(multiDiuctionary);
        }
开发者ID:antonpopov,项目名称:Data-Structures-and-Algorithms,代码行数:27,代码来源:Startup.cs

示例13: SchoolShouldAddCourseCorrectly

 public void SchoolShouldAddCourseCorrectly()
 {
     var school = new School("Telerik Academy");
     var course = new Course("C#");
     school.AddCourse(course);
     Assert.AreSame(course, school.Courses.First());
 }
开发者ID:MarinaGeorgieva,项目名称:TelerikAcademy,代码行数:7,代码来源:SchoolTests.cs

示例14: btnAdd_Click

 void btnAdd_Click(object sender, EventArgs e)
 {
     foreach (Control item in this.Controls)
     {
         TextBox tb = null;
         if (item is TextBox)
         {
             tb = item as TextBox;
             if (string.IsNullOrEmpty(tb.Text.Trim()))
             {
                 ShowMessage(tb.Tag + "不能为空");
                 return;
             }
         }
     }
     int credit = 0;
     bool b = Int32.TryParse(this.tbCcredit.Text.Trim(), out credit);
     if (!b)
     {
         ShowMessage("学分只能为数字,请重新输入!");
         return;
     }
     CourseMgrDataContext c = new CourseMgrDataContext();
     Course course = new Course();
     course.Cname = this.tbCname.Text.Trim();
     course.Cmajorname = this.tbCmajorname.Text.Trim();
     course.Cinfo = this.tbCinfo.Text.Trim();
     course.Cteacher = this.tbCteacher.Text.Trim();
     course.Ctime = this.tbCtime.Text.Trim();
     course.Ccredit = credit;
     c.Course.InsertOnSubmit(course);
     c.SubmitChanges();
     ShowMessage("添加新课程成功");
     this.DialogResult = DialogResult.OK;
 }
开发者ID:penzz,项目名称:CourseMgr,代码行数:35,代码来源:AddCourse.cs

示例15: VerifyCompletion

    //**************************************
    //    
    public bool VerifyCompletion(Course c)
    {
        bool outcome = false;

        // Step through all TranscriptEntries, looking for one
        // which reflects a Section of the Course of interest.

        foreach ( TranscriptEntry te in TranscriptEntries ) {
          Section s = te.Section;

          if ( s.IsSectionOf(c) ) {
        // Ensure that the grade was high enough.

        if ( TranscriptEntry.PassingGrade(te.Grade) ) {
          outcome = true;

          // We've found one, so we can afford to
          // terminate the loop now.

          break;
        }
          }
        }

        return outcome;
    }
开发者ID:chic1225,项目名称:assignments,代码行数:28,代码来源:Transcript.cs


注:本文中的Course类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。