/// <summary> /// Handles Init event for a control. /// </summary> /// <param name="e">Event args.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); // parse QueryString var itemId = ParseHelper.ParseToNullable <int> (Request.QueryString ["division_id"]); // FIXME: Possible circular dependency as list can still contain childrens of current division parentDivisionSelector.DataSource = new DivisionQuery(ModelContext).ListExcept(itemId).OrderBy(d => d.Title); parentDivisionSelector.DataBind(); // init working hours WorkingHoursLogic.Init(this, comboWorkingHours); // bind positions var positions = new FlatQuery <PositionInfo> (ModelContext).ListOrderBy(p => p.Title); comboHeadPosition.DataSource = positions.Select(p => new { p.PositionID, Title = UniversityFormatHelper.FormatTitleWithShortTitle(p.Title, p.ShortTitle) }); comboHeadPosition.DataBind(); comboHeadPosition.InsertDefaultItem(LocalizeString("NotSelected.Text")); }
public void OnInit(PortalModuleBase module, IEnumerable <PositionInfo> positions, IEnumerable <DivisionInfo> divisions) { Module = module; comboPositions.DataSource = positions.Select(p => new { p.PositionID, Title = UniversityFormatHelper.FormatTitleWithShortTitle(p.Title, p.ShortTitle) }); comboPositions.DataBind(); divisionSelector.DataSource = divisions; divisionSelector.DataBind(); }