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


C# Student.RoleIDs方法代码示例

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


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

示例1: DesiredRoles

        public ActionResult DesiredRoles(string studentCode, string gender, string grade)
        {
            Student stu = new Student(studentCode, Musical.CurrentMusical().musicalID);

            List<int> studentRoles = stu.RoleIDs(Musical.CurrentMusical().musicalID);
            List<MusicalRole> musicalRoles = MusicalRole.AvailableRoles(Musical.CurrentMusical().musicalID, gender, grade);
            List<RoleCheckbox> checkBoxes = new List<RoleCheckbox>();

            foreach (MusicalRole role in musicalRoles)
            {
                RoleCheckbox chk = new RoleCheckbox() { RoleID = role.roleID, RoleName = role.name, IsChecked = false };
                checkBoxes.Add(chk);
            }

            //foreach (RoleCheckbox chk in checkBoxes.Where(r => studentRoles.Contains(r.RoleID)))
            foreach (RoleCheckbox chk in checkBoxes.Where(r => studentRoles.Contains(r.RoleID)))
            {
                chk.IsChecked = true;
            }

            DesiredRolesViewModel m = new DesiredRolesViewModel();

            m.DesiredRoles = checkBoxes.ToArray();

            return View("_DesiredRoles", m);
        }
开发者ID:jpatchak,项目名称:BayviewMusical,代码行数:26,代码来源:StudentController.cs

示例2: EditStudent

        public ActionResult EditStudent(string musicalID, string studentID)
        {
            AdminEditstudentViewModel m = new AdminEditstudentViewModel();

            Student stu = new Student(Int32.Parse(studentID));
            m.Code = stu.code;
            m.Email = stu.email;
            m.FirstName = stu.firstName;
            m.LastName = stu.lastName;
            m.StudentID = stu.studentID;
            m.MusicalID = Int32.Parse(musicalID);
            m.Gender = stu.gender;
            m.Grade = stu.grade;

            StudentDateTime sdt = new StudentDateTime(Int32.Parse(studentID));
            m.DateID = sdt.DateID;
            m.TimeID = sdt.TimeID;
            m.RoleID = stu.RoleIDs(m.MusicalID).Select(r => r).FirstOrDefault();

            m.RoleList = MusicalRole.AllRoles(Int32.Parse(musicalID)).Select(r => new SelectListItem()
            {
                Text = r.name,
                Value = r.roleID.ToString()
            });

            m.DateList = AuditionDate.MusicalDates(Int32.Parse(musicalID)).Select(r => new SelectListItem()
            {
                Text=((DateTime)r.date).ToString("MM/dd/yyyy"),
                Value = r.dateID.ToString()
            });

            if (m.DateID == 0)
                m.DateID = m.DateList.Select(r => Int32.Parse(r.Value)).FirstOrDefault();

            m.TimeList = AuditionTime.TimeSlots(m.DateID).Select(t => new SelectListItem()
            {
                Text = t.timeDescription,
                Value = t.timeID.ToString()
            });

            return View(m);
        }
开发者ID:jpatchak,项目名称:BayviewMusical,代码行数:42,代码来源:AdminController.cs


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