/// <summary> /// 註冊資料項目,並且一併處理權限問題。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="panel"></param> public static void RegisterDetailContent <T>(this NLDPanel panel) where T : FISCA.Presentation.DetailContent, new() { AccessControlAttribute access = Attribute.GetCustomAttribute(typeof(T), typeof(AccessControlAttribute)) as AccessControlAttribute; if (access != null) { if (!ACL.ContainsKey(typeof(T))) //指定的型別沒有被註冊過才進行註冊。 { ACL.Add(typeof(T), access); Catalog cg = GetCatalog(access.Path); if (!FeatureCodes.Contains(access.Code)) //重覆的代碼也不進行註冊。 { FeatureCodes.Add(access.Code); cg.Add(new DetailItemFeature(typeof(T))); } } if (!UserAcl.Current[access.Code].Viewable) { return; } } DetailBulider <T> builder = new DetailBulider <T>(); builder.ContentBulided += new EventHandler <ContentBulidedEventArgs <T> >(builder_ContentBulided); panel.AddDetailBulider(builder); }
private static void dc_SaveButtonVisibleChanged(object sender, EventArgs e) { if (VisibleChanging) { return; } DetailContent content = sender as DetailContent; AccessControlAttribute ac = ACL[sender.GetType()]; if (!UserAcl.Current[sender.GetType()].Editable) { VisibleChanging = true; content.SaveButtonVisible = false; VisibleChanging = false; } }