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


C# Student.getCourseName方法代码示例

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


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

示例1: Page_Load

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

            FormsAuthentication.SignOut();
            Session.Clear();
            Response.Redirect("~/Default");
        }

        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {

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

            student = new Student(userId);

            strTakenList = student.getTakenCourses();
            takenList = student.getTakenInt();
            strAllList = student.getAllCourses();
            allList = student.getCourseName(strAllList);

            //\ creates need list and Creates resultbuilder object
            needList = student.getNeededInt();
            ResultsBuilder rs = new ResultsBuilder(needList, takenList);
            //\ finds possible courses and inits possible list
            rs.findPossible();
            possibleList = rs.getPossible();
            rs.findRecommended();
            //recIntList = rs.getRecommended();
            int[][] recArray =   rs.getRecommended();

            String currentCourseName;

            //\ gets course name for possible courses
            SqlConnection conGetName = new SqlConnection(myDatabase);

            SqlCommand cmdGetName = new SqlCommand("getCourseName", conGetName);
            cmdGetName.CommandType = CommandType.StoredProcedure;

            foreach (int c in possibleList)
            {

                cmdGetName.Parameters.AddWithValue("@courseID", c);
                conGetName.Open();
                currentCourseName = Convert.ToString(cmdGetName.ExecuteScalar());
                formattedList.Add(currentCourseName);
                cmdGetName.Parameters.Clear();
                conGetName.Close();
            }

            //\ gets course name for recommended courses
            SqlConnection conGetRec = new SqlConnection(myDatabase);

            SqlCommand cmdGetRec = new SqlCommand("getCourseName", conGetRec);
            cmdGetRec.CommandType = CommandType.StoredProcedure;

            for (int i = 0; i < 5; i++)
            {

                cmdGetRec.Parameters.AddWithValue("@courseID", recArray[i][0]);
                conGetRec.Open();
                currentCourseName = Convert.ToString(cmdGetRec.ExecuteScalar());
                recList[i] = currentCourseName;
                cmdGetRec.Parameters.Clear();
                conGetRec.Close();
            }

            rec1.Text = " 1.  " + recList[0];
            rec2.Text = " 2.  " + recList[1];
            rec3.Text = " 3.  " + recList[2];
            rec4.Text = " 4.  " + recList[3];
            rec5.Text = " 5.  " + recList[4];

            formattedList.Sort();

            foreach (String i in formattedList)
            {
               allPosListBox.Items.Add(i.ToString());
            }

            foreach (String i in formattedList)
            {
                //allPosListBox.Items.Add(i);
            }

        }
        else
        {
            Response.Redirect("NotLoggedIn.aspx");
            Server.Transfer("NotLoggedIn.aspx");
        }
    }
开发者ID:CaSimpson,项目名称:CourseHunterV2,代码行数:95,代码来源:Results.aspx.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");
        }
        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {

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

            student = new Student(userId);
            comment = new Comment(userId);

            allCourses = student.getAllCourses();
            allCourses.Sort();

            foreach(String s in allCourses)
            {
                courseDropBox.Items.Add(s);
            }

            //\sets currentcourse to whats selected in dropbox on load
            strCurrentCourse = courseDropBox.SelectedValue;
            currentCourse = student.getCourseName(strCurrentCourse);

        }
        else
        {
            Response.Redirect("NotLoggedIn.aspx");
            Server.Transfer("NotLoggedIn.aspx");
        }

            if (!IsPostBack)
        {
            BindComment();
        }
    }
开发者ID:CaSimpson,项目名称:CourseHunterV2,代码行数:43,代码来源:RateMyCourse.aspx.cs

示例3: Page_Load


//.........这里部分代码省略.........
            art101DropBox.Items.Add("AFAM U204");
            art101DropBox.Items.Add("ARTH U101");
            art101DropBox.Items.Add("ARTH U105");
            art101DropBox.Items.Add("ARTH U106");
            art101DropBox.Items.Add("MUSC U110");
            art101DropBox.Items.Add("MUSC U140");
            art101DropBox.Items.Add("THEA U161");
            art101DropBox.Items.Add("THEA U170");

            his101DropBox.Items.Add("HIST U101");
            his101DropBox.Items.Add("HIST U102");
            his101DropBox.Items.Add("HIST U105");
            his101DropBox.Items.Add("HIST U106");

            hum101DropBox.Items.Add("AMST U101");
            hum101DropBox.Items.Add("AMST U102");
            hum101DropBox.Items.Add("ENGL U250");
            hum101DropBox.Items.Add("ENGL U252");
            hum101DropBox.Items.Add("ENGL U275");
            hum101DropBox.Items.Add("ENGL U279");
            hum101DropBox.Items.Add("ENGL U280");
            hum101DropBox.Items.Add("ENGL U283");
            hum101DropBox.Items.Add("ENGL U289");
            hum101DropBox.Items.Add("ENGL U290");
            hum101DropBox.Items.Add("ENGL U291");
            hum101DropBox.Items.Add("FILM U240");
            hum101DropBox.Items.Add("PHIL U102");
            hum101DropBox.Items.Add("PHIL U211");
            hum101DropBox.Items.Add("RELG U103");
            hum101DropBox.Items.Add("AFAM U204");
            hum101DropBox.Items.Add("ARTH U101");
            hum101DropBox.Items.Add("ARTH U105");
            hum101DropBox.Items.Add("ARTH U106");
            hum101DropBox.Items.Add("MUSC U110");
            hum101DropBox.Items.Add("MUSC U140");
            hum101DropBox.Items.Add("THEA U161");
            hum101DropBox.Items.Add("THEA U170");

            for101DropBox.Items.Add("SPAN U101");
            for101DropBox.Items.Add("CHIN U101");
            for101DropBox.Items.Add("FREN U101");
            for101DropBox.Items.Add("GERM U101");
            for101DropBox.Items.Add("ASLG U101");

            soc101DropBox.Items.Add("AFAM U201");
            soc101DropBox.Items.Add("ANTH U102");
            soc101DropBox.Items.Add("ECON U221");
            soc101DropBox.Items.Add("ECON U222");
            soc101DropBox.Items.Add("GEOG U101");
            soc101DropBox.Items.Add("GEOG U103");
            soc101DropBox.Items.Add("POLI U101");
            soc101DropBox.Items.Add("POLI U200");
            soc101DropBox.Items.Add("POLI U320");
            soc101DropBox.Items.Add("PSYC U101");
            soc101DropBox.Items.Add("SOCY U101");
            soc101DropBox.Items.Add("WGST U101");

            soc102DropBox.Items.Add("AFAM U201");
            soc102DropBox.Items.Add("ANTH U102");
            soc102DropBox.Items.Add("ECON U221");
            soc102DropBox.Items.Add("ECON U222");
            soc102DropBox.Items.Add("GEOG U101");
            soc102DropBox.Items.Add("GEOG U103");
            soc102DropBox.Items.Add("POLI U101");
            soc102DropBox.Items.Add("POLI U200");
            soc102DropBox.Items.Add("POLI U320");
            soc102DropBox.Items.Add("PSYC U101");
            soc102DropBox.Items.Add("SOCY U101");
            soc102DropBox.Items.Add("WGST U101");

            Course c = new Course();                    //\ creates course object

            //\ these lists hold string and int lists for electives
            List<int> intElectives = new List<int>();
            List<String> strElectives = new List<String>();

            //\ this gets value for lists
            intElectives = c.getElectives();
            strElectives = student.getCourseName(intElectives);

            //\ this adds the list of electives to the listboxes in ui
            foreach (String s in strElectives)
            {
                e1DropBox.Items.Add(s);
                e2DropBox.Items.Add(s);
                e3DropBox.Items.Add(s);
                e4DropBox.Items.Add(s);
            }

            //\ sets courses as complete or incomplete
            setTakenCourses();

        }
        //\ if user not logged in ~ show notLoggedIn page
        else
        {
            Response.Redirect("NotLoggedIn.aspx");
            Server.Transfer("NotLoggedIn.aspx");
        }
    }
开发者ID:CaSimpson,项目名称:CourseHunterV2,代码行数:101,代码来源:AddRemoveCourse.aspx.cs


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