public void BindData(MetaField field) { string sReferencedClass = field.Attributes[McDataTypeAttribute.ReferenceMetaClassName].ToString(); ViewState["ReferencedClass"] = sReferencedClass; if (sReferencedClass == TimeTrackingEntry.GetAssignedMetaClass().Name || sReferencedClass == TimeTrackingBlock.GetAssignedMetaClass().Name || sReferencedClass == TimeTrackingBlockType.GetAssignedMetaClass().Name || sReferencedClass == TimeTrackingBlockTypeInstance.GetAssignedMetaClass().Name || sReferencedClass == Principal.GetAssignedMetaClass().Name || Mediachase.IBN.Business.Security.CurrentUser == null) { tblEntity.Visible = false; string url = ResolveClientUrl(String.Format("~/Apps/MetaUI/Pages/Public/SelectItem.aspx?class={0}&btn={1}", sReferencedClass, Page.ClientScript.GetPostBackEventReference(btnRefresh, "xxx"))); ibSelect.OnClientClick = String.Format("OpenPopUpWindow(\"{0}\", 640, 480, 1); return false;", url); } else { ReferenceUpdatePanel.Visible = false; refObjects.ObjectTypes = sReferencedClass; if (Request["ContainerFieldName"] != null && field.Name == Request["ContainerFieldName"] && Request["ContainerId"] != null) { this.Value = PrimaryKeyId.Parse(Request["ContainerId"]); } } }
public override bool CheckVisibility(object dataItem) { if (dataItem is MetaClass) { //hide list templates and timetracking classes (not entity objects) MetaClass mc = (MetaClass)dataItem; if (ListManager.MetaClassIsList(mc)) { ListInfo li = ListManager.GetListInfoByMetaClassName(mc.Name); if (li != null && li.IsTemplate) { return(false); } } else if (mc.Name == TimeTrackingEntry.GetAssignedMetaClass().Name || mc.Name == TimeTrackingBlock.GetAssignedMetaClass().Name || mc.Name == TimeTrackingBlockType.GetAssignedMetaClass().Name || mc.Name == TimeTrackingBlockTypeInstance.GetAssignedMetaClass().Name) { return(false); } } return(base.CheckVisibility(dataItem)); }