Ejemplo n.º 1
0
        public void BindData(string metaClassName)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("DisplayName", typeof(string)));
            dt.Columns.Add(new DataColumn("ClassName", typeof(string)));
            dt.Columns.Add(new DataColumn("IsForm", typeof(string)));

            string[] forms = MetaUIManager.GetMetaFormList(metaClassName);
            foreach (string name in forms)
            {
                AddRow(dt, metaClassName, name, true, false);
            }

            string[] views = MetaUIManager.GetMetaViewList(metaClassName);
            foreach (string name in views)
            {
                AddRow(dt, metaClassName, name, false, false);
            }

            grdMain.DataKeyField = "Name";
            grdMain.DataSource   = dt.DefaultView;
            grdMain.DataBind();
        }
Ejemplo n.º 2
0
        public void BindData(string metaClassName)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("DisplayName", typeof(string)));
            dt.Columns.Add(new DataColumn("ClassName", typeof(string)));
            dt.Columns.Add(new DataColumn("IsForm", typeof(string)));

            bool isBaseFormAdded        = false;
            bool isGeneralViewFormAdded = false;
            bool isShortViewFormAdded   = false;

            // ListApp Fix: we don't use ShortViewForm for lists
            bool isList = ListManager.MetaClassIsList(metaClassName);

            if (isList)
            {
                isShortViewFormAdded = true;
            }

            string[] forms = MetaUIManager.GetMetaFormList(metaClassName);
            foreach (string name in forms)
            {
                if ((name == FormController.CreateFormType || name == FormController.ShortViewFormType) && isList)
                {
                    continue;
                }
                AddRow(dt, metaClassName, name, String.Empty, true, false);

                if (name == FormController.BaseFormType)
                {
                    isBaseFormAdded = true;
                }
                if (name == FormController.GeneralViewFormType)
                {
                    isGeneralViewFormAdded = true;
                }
                if (name == FormController.ShortViewFormType)
                {
                    isShortViewFormAdded = true;
                }
            }

            // Edit Form
            if (!isBaseFormAdded)
            {
                AddRow(dt, metaClassName, FormController.BaseFormType, String.Empty, true, false);
            }

            // View Form
            if (!isGeneralViewFormAdded)
            {
                AddRow(dt, metaClassName, FormController.GeneralViewFormType, String.Empty, true, false);
            }

            // Short View Form
            if (!isShortViewFormAdded)
            {
                AddRow(dt, metaClassName, FormController.ShortViewFormType, String.Empty, true, false);
            }

            if (ListManager.IsHistoryActivated(metaClassName))
            {
                string[] formsHistory = MetaUIManager.GetMetaFormList(HistoryManager.GetHistoryMetaClassName(metaClassName));
                foreach (string name in formsHistory)
                {
                    if (name != FormController.GeneralViewHistoryFormType && isList)
                    {
                        continue;
                    }
                    AddRow(dt, HistoryManager.GetHistoryMetaClassName(metaClassName), name, String.Empty, true, true);
                }
            }

            ListViewProfile[] list = ListViewProfile.GetSystemProfiles(metaClassName, "EntityList");
            foreach (ListViewProfile lvp in list)
            {
                AddRow(dt, metaClassName, lvp.Id, lvp.Name, false, false);
            }
            //string[] views = MetaUIManager.GetMetaViewList(metaClassName);
            //foreach (string name in views)
            //    AddRow(dt, metaClassName, name, false, false);

            grdMain.DataKeyField = "Name";
            grdMain.DataSource   = dt.DefaultView;
            grdMain.DataBind();
        }