protected override void LoadItem(EduProgramInfo item) { var ep = GetItemWithDependencies(ItemKey.Value); base.LoadItem(ep); textCode.Text = ep.Code; textTitle.Text = ep.Title; textGeneration.Text = ep.Generation; datetimeStartDate.SelectedDate = ep.StartDate; datetimeEndDate.SelectedDate = ep.EndDate; comboEduLevel.SelectByValue(ep.EduLevelID); urlHomePage.Url = ep.HomePage; formEditDivisions.SetData(ep.Divisions, ep.EduProgramID); auditControl.Bind(ep, PortalId, LocalizeString("Unknown"));; formEditDocuments.SetData(ep.Documents, ep.EduProgramID); // setup link for adding new edu. program profile linkAddEduProgramProfile.NavigateUrl = EditUrl("eduprogram_id", ep.EduProgramID.ToString(), "EditEduProgramProfile"); gridEduProgramProfiles.DataSource = ep.EduProgramProfiles .Select(epp => new EduProgramProfileEditModel(epp, ViewModelContext)) .OrderBy(epp => epp.ProfileCode) .ThenBy(epp => epp.ProfileTitle); gridEduProgramProfiles.DataBind(); buttonDelete.Visible = SecurityContext.CanDelete(ep); linkAddEduProgramProfile.Visible = SecurityContext.CanAdd(typeof(EduProgramProfileInfo)); panelAddDefaultProfile.Visible = false; }
public override void Delete(DivisionInfo entity) { if (SecurityContext.CanDelete(entity)) { if (entity.DivisionTermID != null) { TaxonomyExtensions.DeleteTerm(entity.DivisionTermID.Value); } ModelContext.Remove(entity); } }
protected override bool CanDeleteItem(TEntity item) { return(SecurityContext.CanDelete(item)); }