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


C# Student类代码示例

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


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

示例1: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            Student student1 = new Student();

            student1.getbyid("D12312312");
            MessageBox.Show(student1.name);
        }
开发者ID:jasonhuber,项目名称:CIS339FallA,代码行数:7,代码来源:Form1.cs

示例2: GetStudent

 public Student GetStudent(string id)
 {
     string sql = "select * from Student where id='{0}'".FormatWith(id);
     SqlDataReader dr = SqlHelper.ExecuteReader(ConStr, CommandType.Text, sql);
     if (dr.HasRows == false) return null;
     dr.Read();
     var stu = new Student(
         dr["Name"].ToString(),
         dr["Id"].ToString(),
         dr["Major"].ToString(),
         dr["Degree"].ToString());
     dr.Close();
     dr.Dispose();
     //访问数据库,获取选课信息
     var attends = new List<Section>();
     string sql1 = @"select * from AttendSection where StudentNumber ='{0}'".FormatWith(id);
     DataTable attendSec = SqlHelper.ExecuteDataset(ConStr, CommandType.Text, sql1).Tables[0];
     var secDAO = new SectionDAO();
     foreach (DataRow r in attendSec.Rows)
     {
         attends.Add(secDAO.GetSection(r["SectionNumber"].ConvertToIntBaseZero()));
     }
     stu.Attends = attends;
     return stu;
 }
开发者ID:starryni9ht,项目名称:SRSOO,代码行数:25,代码来源:StudentDAO.cs

示例3: Main

        static void Main()
        {
            var student1 = new Student("John", "Atanasov", "421586353");

            var studentEqual = new Student("John", "Atanasov", "421586353");
            Console.WriteLine("Different objects with the same properties are equal: {0}",student1.Equals(studentEqual));
            Console.WriteLine();

            Student student1DeepCopy = student1.Clone();
            Console.WriteLine("The copy and the original are the same: {0}", student1.Equals(student1DeepCopy));
            Console.WriteLine("The copy reference the original -> " + ReferenceEquals(student1, student1DeepCopy));
            Console.WriteLine();

            var student2 = new Student("John", "Atanasov", "421586353");
            var student3 = new Student("Peter", "Nikolov", "245124749");
            CompareStudents(student1, student2);
            CompareStudents(student1, student3);
            CompareStudents(student2, student3);
            Console.WriteLine();

            Console.WriteLine(student1.ToString());
            Console.WriteLine();

            student1.MiddleName = "Ivanov";
            student1.MobilePhone = "0885123456";
            student1.Faculty = Faculty.Bachelor;
            student1.University = University.SU;
            Console.WriteLine(student1.ToString());
            Console.WriteLine();
        }
开发者ID:cvet-,项目名称:Telerik_Academy,代码行数:30,代码来源:Program.cs

示例4: Main

        static void Main(string[] args)
        {
            Console.WriteLine(GeometryCalculations.TriangleArea(3, 4, 5));

            Console.WriteLine(NumericConversions.DigitToString(5));

            Console.WriteLine(ArithmethicCalculations.FindMaxValue(5, -1, 3, 2, 14, 2, 3));

            ConsoleMethods.PrintNumberWithPrecision(1.3, 2);
            ConsoleMethods.PrintNumberAsPercentWithPrecision(0.75, 0);
            ConsoleMethods.PrintObjectAsPaddedString(2.30, 8);

            Console.WriteLine(GeometryCalculations.DistanceBetweenTwoPoints(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + GeometryCalculations.IsHorizontal(3, -1, 3, 2.5));
            Console.WriteLine("Vertical? " + GeometryCalculations.IsVertical(3, -1, 3, 2.5));

            Student peter = new Student() { FirstName = "Peter", LastName = "Ivanov" };
            peter.OtherInfo = "From Sofia, born at 17.03.1992";

            Student stella = new Student() { FirstName = "Stella", LastName = "Markova" };
            stella.OtherInfo = "From Vidin, gamer, high results, born at 03.11.1993";

            Console.WriteLine("{0} older than {1} -> {2}",
                peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
开发者ID:niki-funky,项目名称:Telerik_Academy,代码行数:25,代码来源:Demo.cs

示例5: Main

        static void Main(string[] args)
        {
            Instructor EnglishInstructor = new Instructor("John", "English");

            Instructor MathInstructor = new Instructor("Mike", "Math");

            Student Student1 = new Student("Jane", EnglishInstructor);

            Student Student2 = new Student("Joe", EnglishInstructor);

            Student Student3 = new Student("Melissa", MathInstructor);

            Student Student4 = new Student("Matt", MathInstructor);

            EnglishInstructor.SetStudentGrade(Student1, 95);
            EnglishInstructor.SetStudentGrade(Student2, 85);
            MathInstructor.SetStudentGrade(Student3, 90);
            MathInstructor.SetStudentGrade(Student4, 92);

            System.Console.WriteLine("    Student Information    ");
            System.Console.WriteLine(" ");
            Student1.Print();
            Student2.Print();
            Student3.Print();
            Student4.Print();
            System.Console.ReadKey();
        }
开发者ID:kcbwilson,项目名称:IT-1050,代码行数:27,代码来源:Program.cs

示例6: Main

    static void Main(string[] args)
    {
        //Define a class Student, which contains data about a student – first, middle and last name,
        //SSN, permanent address, mobile phone e-mail, course, specialty, university, faculty. Use
        //an enumeration for the specialties, universities and faculties. Override the standard methods,
        //inherited by  System.Object: Equals(), ToString(), GetHashCode() and operators == and !=.
        //Add implementations of the ICloneable interface. The Clone() method should deeply copy all
        //object's fields into a new object of type Student.
        //Implement the  IComparable<Student> interface to compare students by names (as first criteria,
        //in lexicographic order) and by social security number (as second criteria, in increasing order).

        //Making student and test override ToString method
        Student peter = new Student("Peter", "Ivanov", "Petrov", 12764397, "Sofia,Mladost1,Al. Malinov str.", 0889888888,
            "[email protected]", 2, Universities.SofiaUniversity, Faculties.HistoryFaculty, Specialties.History);
        Console.WriteLine(peter);
        Console.WriteLine();

        //Make second student who is deep clone of the first one and test this
        Student ivo = peter.Clone();
        Console.WriteLine(ivo);
        ivo.FirstName = "Joro";
        Console.WriteLine(ivo.FirstName);
        Console.WriteLine(peter.FirstName);
        Console.WriteLine();

        //Testing override method CompareTo
        Console.WriteLine(peter.CompareTo(ivo));
        ivo.FirstName = "Peter";
        Console.WriteLine(peter.CompareTo(ivo));
    }
开发者ID:Jarolim,项目名称:TelerikAcademy-1,代码行数:30,代码来源:Program.cs

示例7: AddStudentToCourseOffering

 /// <summary>
 /// Adds the student to a course offering.
 /// </summary>
 /// <param name="student">The student.</param>
 /// <param name="courseOfferingId">The course offering identifier.</param>
 public void AddStudentToCourseOffering(Student student, int courseOfferingId)
 {
     using (_courseOfferingRepository)
     {
         _courseOfferingRepository.InsertStudentIntoCourseOffering(student, courseOfferingId);
     }
 }
开发者ID:davericher,项目名称:cst8256,代码行数:12,代码来源:CourseService.cs

示例8: 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

示例9: Main

        static void Main(string[] args)
        {
            Instructor John = new Instructor("John", "English");
            Instructor Mike = new Instructor("MIKE", "Math");

            Student Jane = new Student("Jane", John);
            Student Joe = new Student("Joe", John);

            Student Melissa = new Student("Melissa", Mike);
            Student Matt = new Student("Matt", Mike);

            John.SetStudentGrade(Jane, 95);
            John.SetStudentGrade(Joe, 85);
            Mike.SetStudentGrade(Melissa, 90);
            Mike.SetStudentGrade(Matt, 92);

            Jane.PrintStudentInfo();
            Joe.PrintStudentInfo();
            Melissa.PrintStudentInfo();
            Matt.PrintStudentInfo();

            System.Console.WriteLine();
            System.Console.ReadKey();


        }
开发者ID:Madhunayak,项目名称:IT1050,代码行数:26,代码来源:Program.cs

示例10: Main

        static void Main(string[] args)
        {
            //Create Instructor 
            Instructor John = new Instructor("John", "English");
            Instructor Mike = new Instructor("Mike", "Math");

            //Create Students
            Student Jane = new Student("Jane", John);
            Student Joe = new Student("Joe", John);
            Student Melissa = new Student("Melissa", Mike);
            Student Matt = new Student("Matt", Mike);

            //Instructor Set Student Grade
            John.StudentGrade(Jane, 95);
            John.StudentGrade(Joe, 85);
            Mike.StudentGrade(Melissa, 90);
            Mike.StudentGrade(Matt, 92);

            //Print Instructor Information
            John.PrintInstructorInfo();
            Mike.PrintInstructorInfo();

            //Print Student Information
            Jane.PrintStudentInfo();
            Joe.PrintStudentInfo();
            Melissa.PrintStudentInfo();
            Matt.PrintStudentInfo();

            System.Console.ReadKey();

        }
开发者ID:jeanne27king,项目名称:IT1050,代码行数:31,代码来源:Program.cs

示例11: create

        public static Student create(string matricId, string password, string name = "student")
        {
            using (var context = new EventContainer())
            {

                var existedStudent = (from s in context.Students.Include("OwnedEvents").Include("RegisteredEvents")
                                      where s.MatricId == matricId
                                      select s).FirstOrDefault();

                if (existedStudent != null)
                {
                    // a student with this matriculation number exists
                    return existedStudent;
                }

                var newStudent = new Student
                {
                    MatricId = matricId,
                    Password = password,
                    Name = name,
                };
                context.Students.Add(newStudent);
                context.SaveChanges();
                return newStudent;
            }
        }
开发者ID:sagittaros,项目名称:EventManagerModel,代码行数:26,代码来源:StudentModel.cs

示例12: Main

        static void Main(string[] args)
        {
            //Create 3 test students
            Student firstStudent = new Student("Gosho", "Ivanov", "Peshov", "11122", "Gosho Street", "02423423", "[email protected]", 1,
                Universities.HarvardUniversity, Faculties.FacultyOfComputerScience ,Specialties.ComputerGraphics);
            Student secondStudent = new Student("Ivan", "Georgiev", "Alexandrov", "15624", "Pesho Street", "09415743", "[email protected]", 2,
                Universities.MassachusettsInstituteofTechnology, Faculties.FacultyOfComputerScience, Specialties.ArtificialIntelligence);
            Student thirdStudent = new Student("Gosho", "Ivanov", "Peshov", "10021", "Ivan Street", "931234", "[email protected]", 1,
                Universities.SofiaUniversity, Faculties.FacultyOfComputerScience, Specialties.ComputerProgramming);

            //Clone a student from the first
            Student clonedStundent = firstStudent.Clone() as Student;

            Console.WriteLine(firstStudent.ToString());
            Console.WriteLine(secondStudent.ToString());
            Console.WriteLine(thirdStudent.ToString());
            Console.WriteLine("First student == Second Student ?:{0}", firstStudent == secondStudent);
            Console.WriteLine("First student != Third Student ?:{0}", firstStudent != thirdStudent);
            Console.WriteLine("First student Equals Cloned Student ?:{0}", firstStudent.Equals(clonedStundent));
            Console.WriteLine("First student compared to Second Student (in ints): {0}", firstStudent.CompareTo(secondStudent));
            Console.WriteLine("First student compared to Third Student (in ints): {0}", firstStudent.CompareTo(thirdStudent));
            Console.WriteLine("First student compared to Cloned Student (in ints): {0}", firstStudent.CompareTo(clonedStundent));

            //Before change
            Console.WriteLine("Is first student number equal to cloned first student number ? {0}", firstStudent.MobilePhone == clonedStundent.MobilePhone);
            //The first student changes his number
            firstStudent.MobilePhone = "088888888";

            //Compare the cloned first student to the changed one
            Console.WriteLine("Is first student number equal to cloned first student number ? {0}", firstStudent.MobilePhone == clonedStundent.MobilePhone);
        }
开发者ID:NikolayGenov,项目名称:TelerikAcademy,代码行数:31,代码来源:TestClass.cs

示例13: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            //connect
            using (DefaultConnection db = new DefaultConnection())
            {
                //creating new student
                Student stu = new Student();
                Int32 StudentID = 0;
                //check for a url
                if (!String.IsNullOrEmpty(Request.QueryString["StudentID"]))
                {
                    //get the id
                     StudentID = Convert.ToInt32(Request.QueryString["StudentID"]);

                    //look up student
                    stu = (from s in db.Students
                           where s.StudentID == StudentID
                           select s).FirstOrDefault();
                }

                //properties for new students
                stu.LastName = txtLast.Text;
                stu.FirstMidName = txtFirst.Text;
                stu.EnrollmentDate = Convert.ToDateTime(txtEnroll.Text);
                if (StudentID == 0)
                {
                    db.Students.Add(stu);
                }

                //save new students
                db.SaveChanges();
                //send back to student page
                Response.Redirect("Students.aspx");
            }
        }
开发者ID:vatcheati,项目名称:comp2084-lab2,代码行数:35,代码来源:student-details.aspx.cs

示例14: CanHandleQueriesOnDictionaries

        public void CanHandleQueriesOnDictionaries()
        {
            using(var store = NewDocumentStore())
            {
                using (var session = store.OpenSession())
                {
                    //now the student:
                    var student = new Student
                    {
                        Attributes = new Dictionary<string, string>
                        {
                            {"NIC", "studentsNICnumberGoesHere"}
                        }
                    };
                    session.Store(student);
                    session.SaveChanges();
                }


                //Testing query on attribute
                using (var session = store.OpenSession())
                {
                    var result = from student in session.Query<Student>()
                                 where student.Attributes["NIC"] == "studentsNICnumberGoesHere"
                                 select student;

                    var test = result.ToList();

                    Assert.NotEmpty(test);
                }
            }
            
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:33,代码来源:LinqOnDictionary.cs

示例15: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text = "";
        Label1.Visible = true;
        Label2.Visible = true;
        Label3.Visible = true;
        Label4.Visible = true;
        string  BannerID= (Request.QueryString["bannerid"] == null) ? "0" : Convert.ToString(Request.QueryString["bannerid"]);

        Session["BannerID"] = BannerID;
        Student std = new Student();
        std = std.GetStudentByStudentBannerID(BannerID);
        if (std != null)
        {
            lblBannerID.Text = std.StudentID;
            lblFirstName.Text = std.FirstName;
            lblLastName.Text = std.LastName;
            lblMiddleName.Text = std.MiddleName;
            lblTerm.Text = std.ProgramEnrollment;
            lblProgram.Text = std.MajorProgramEnrollment;
        }
        else if (std == null || BannerID=="0")
        {
            Label1.Visible = false ;
            Label2.Visible = false ;
            Label3.Visible = false ;
            Label4.Visible = false ;
            lblError.Text = "Error Occured During Registration Process. Please Try again...";
        }
    }
开发者ID:mominbd,项目名称:testing,代码行数:30,代码来源:FinishRegistration.aspx.cs


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