/// <summary> /// 根据ID得到部门名称 /// </summary> /// <param name="id">部门ID</param> /// <returns>部门名称</returns> public string GetSectionNameById(Guid id) { using (ISectionService sectionService = new SectionService()) { return(sectionService.GetAll().Where(p => p.Id == id).FirstOrDefault().Name); } }
/// <summary> /// 查询所有的职员 /// </summary> /// <returns></returns> public async Task <List <StaffSimpleInfoDto> > QueryAllStaff() { using (var staffInfoService = new StaffInfoService()) { List <StaffSimpleInfoDto> staffDtoList = new List <StaffSimpleInfoDto>(); var staffList = await staffInfoService.GetAllOrder().ToListAsync(); using (var sectionService = new SectionService()) { foreach (var staff in staffList) { string sectionName = sectionService.GetAll().Where(p => p.Id == staff.SectionId).FirstOrDefault().Name; staffDtoList.Add(new StaffSimpleInfoDto() { Id = staff.Id, Name = staff.Name, Tel = staff.Tel, Position = staff.Position, Status = staff.Status, Email = staff.Email, SectionName = sectionName }); } } return(staffDtoList); } }
public ActionResult SectionTrainers(string urlName) { var section = SectionService.GetAll().ByUrlName(urlName); if (section == null) { return(null); } var courseTCs = CourseVMService .GetCourseTCListForTotalSection(section.Section_ID); var groups = GroupService.GetGroupsForCourses(courseTCs) .Where(g => g.Teacher_TC != null).ToList(); var groupCountByTrainers = groups.GroupBy(x => x.Teacher_TC) .ToDictionary(x => x.Key, x => x.Count()); var trainers = groups .Select(x => x.Teacher) .Distinct(x => x.Employee_TC) .Select(x => new { Teacher = x, Count = groupCountByTrainers.GetValueOrDefault(x.Employee_TC) }) .Where(x => x.Teacher.FinalSiteVisible && x.Count > 0) .OrderByDescending(x => x.Count).Select(x => x.Teacher) .ToList(); return(View(ViewNames.Trainers, CommonVM.New(trainers, "Преподаватели направления: " + section.Name))); }
public void AddControlRecruiter2011(SimplePageVM model) { var sections = SectionService.GetAll(x => new[] { 370, 371 }.Contains(x.Section_ID)).ToList(); model.Controls.Add( new SimplePageVM.Control(Views.Page.Recruiter2011, sections)); }
/// <summary> /// 根据名称得到部门信息 /// </summary> /// <param name="name"></param> /// <returns></returns> public async Task <Guid> GetSectionIdByName(string name) { using (ISectionService sectionService = new SectionService()) { var staff = await sectionService.GetAll().Where(p => p.Name == name).FirstAsync(); return(staff.Id); } }
private int UpdateSections(ResponseUpdateView model, Func <string, string> comma) { var sections = SectionService.GetAll().Select(uw => new { courseTCs = "," + uw.NotAnnounce.Replace(" ", "") + ",", uw }) .Where(x => x.courseTCs.Contains(comma(model.FromCourseTC))).ToList(); foreach (var section in sections) { var newCourseTCs = section.courseTCs.Replace(comma(model.FromCourseTC), comma(model.ToCourseTC)); section.uw.NotAnnounce = newCourseTCs.Trim(','); } SectionService.SubmitChanges(); return(sections.Count); }
public ActionResult SectionRecommendations(int?id) { var model = new SectionRecVM { }; model.Sections = SectionService.GetAll(x => x.IsActive && !x.IsMain && !x.RelationsAsMenu).ToList(); if (id.HasValue) { var coefs = Section(id.Value); model.Coefs = GetCourses(coefs[0].ToList()); if (coefs.Count > 1) { model.ExcludeCoefs = GetCourses(coefs[1].ToList()).OrderBy(x => x.Coef).ToList(); } } return(View(model)); }
public ActionResult SectionResponses(string urlName) { var section = SectionService.GetAll().ByUrlName(urlName); if (section == null) { return(null); } var responses = SectionVMService .GetResponses(section.Section_ID) .Where(rr => rr.Type == RawQuestionnaireType.CourseComment) .OrderByDescending(r => r.UpdateDate) .Take(20).ToList(); var title = "Отзывы по направлению \"" + section.Name + "\""; return(View(ViewNames.Responses, CommonVM.New(responses, title))); }
public virtual MainPageVM Get() { var sections = SectionService.GetAll().IsActive().Where(s => s.ForMainPage) .ByWebOrder().ToList(); var professions = ProfessionService.GetAll().IsActive() .Where(p => p.ForMainPage).ToList() .OrderBy(x => StringUtils.IsBasicLetter(x.Name.First())).ThenBy(x => x.Name).ToList(); var vendors = VendorService.GetAll().IsActive() .Where(p => p.ForMainPage).ByWebOrder().ToList(); var products = ProductService.GetAll().IsActive() .Where(p => p.ForMainPage).ToList().OrderBy(x => x.Name).ToList(); var siteterms = SiteTermService.GetAll().IsActive() .Where(p => p.ForMainPage).ToList().OrderBy(x => x.Name).ToList(); VideoService.LoadWith(x => x.VideoCategory); var videos = VideoService.GetAll(x => x.CategoryId == VideoCategories.CoursePresentation) .OrderByDescending(x => x.UpdateDate).Take(3).ToList(); return (new MainPageVM { Professions = professions, Vendors = vendors, Sections = sections, Products = products, Banners = BannerService.GetBanner(CommonConst.SiteRoot + "/") .ShufflePriority(x => x.Priority), News = NewsService.GetAllForMain().ToList(), SiteTerms = siteterms, Videos = videos, Documents = CertTypeService .GetAll(c => CertTypes.ForMain.Contains(c.UrlName)).ToList(), About = SimplePageService.GetAll().BySysName(SimplePages.MainPage) }); }
public ActionResult Section(string urlName) { var section = SectionService.GetAll().ByUrlName(urlName); if (section == null) { return(null); } var tests = SiteObjectService.GetByRelationObject <Test>(section) .Where(x => x.CompanyId == null && x.Status == TestStatus.Active) .OrderByDescending(x => x.Id).ToList(); // if(urlName == "english" && // !tests.Select(x => x.Id).SequenceEqual(TestRecomendations.Tests.Select(x => x.Key))) { // Logger.Exception(new Exception("english section tests recomendations"), User); // } var model = new TestSectionVM { Section = section, Tests = tests, }; return(BaseView(PartialViewNames.Section, model)); }
public IEnumerable <SectionViewModel> AllSections() { return(SectionService.GetAll()); }
/// <summary> /// Get all sections from SLI for the current user session /// </summary> /// <returns>List of all sections the current user has access to</returns> public async Task<IEnumerable<Section>> GetSections() { var c = new SectionService(Session["access_token"].ToString()); var list = await c.GetAll(); return list; }