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


C# Student.getName方法代码示例

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


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

示例1: validateStudent

 public void validateStudent(Student s)
 {
     if (this.nameIsEmpty(s.getName()))
         throw new MyException("Name cannot be empty!\n");
     if (this.studentExists(s.getID()))
         throw new MyException("Student id already exists!\n");
 }
开发者ID:csergiu,项目名称:Labs,代码行数:7,代码来源:Validator.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(HttpContext.Current.User.Identity.IsAuthenticated))
        {

            FormsAuthentication.SignOut();
            Session.Clear();
            Response.Redirect("~/Default");
        }
        //\ authenticates user
        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {

            //\ gets userName and UserID
            String userName = HttpContext.Current.User.Identity.Name;
            String userId = Membership.GetUser(userName).ProviderUserKey.ToString();

            //\ Create student object
            Student student = new Student(userId);
            studentName = student.getName(); //\ returns student's name
            lblStudentName.Text = studentName; //\ sets student's name to label
            completeCourses = student.getTakenCourses(); //\ returns a list of completed courses
            remainingCourses = student.getNeededCourses();

            completeCourses.Sort();
            remainingCourses.Sort();

            //\ adds taken courses to listbox
            foreach (String s in completeCourses)
            {
                completeListBox.Items.Add(s);
            }
            //\ adds taken courses to listbox
            foreach (String s in remainingCourses)
            {
                remainingListBox.Items.Add(s);
            }

            //\ Calculates % of all courses complete
            compCourses = student.getCountComplete();
            totalCourses = student.getCountAll();
           // System.Diagnostics.Debug.Write("compCount = " + compCourses + "  all count = " + totalCourses);

            if (totalCourses < 1)
            {
                myProg = 0;
            }
            else
            {
                myProg = (compCourses * 100) / totalCourses; //\ status bar updater
            }

            //\ sets labels
            lblCourseComplete.Text = compCourses.ToString();
            lblCourseRemaining.Text = (totalCourses - compCourses).ToString();
            int allCredits = 108;
            int takenCredits = 0;

            foreach(String s in completeCourses)
            {
                //System.Diagnostics.Debug.Write("course = " + s);
                Course course = new Course(s);
                takenCredits += course.getCreditValue();
                //System.Diagnostics.Debug.Write("takenCredits = " + takenCredits.ToString());
            }
            lblCreditComplete.Text = takenCredits.ToString();
            lblCreditRemaining.Text = (allCredits - takenCredits).ToString();

        }
        else
        {
            Response.Redirect("NotLoggedIn.aspx");
            Server.Transfer("NotLoggedIn.aspx");
        }
    }
开发者ID:CaSimpson,项目名称:CourseHunterV2,代码行数:75,代码来源:Progress.aspx.cs


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