コード例 #1
0
        public override void DataBind()
        {
            grdMain.ClassName = ClassName;
            grdMain.ViewName  = ViewName;
            grdMain.PlaceName = PlaceName;

            if (!String.IsNullOrEmpty(ProfileName))
            {
                grdMain.ProfileName = ProfileName;
            }

            grdMain.ShowCheckboxes = ShowCheckBoxes;
            grdMain.PageSize       = -1;
            grdMain.DataBind();

            ctrlGridEventUpdater.ClassName = ClassName;
            ctrlGridEventUpdater.ViewName  = ViewName;
            ctrlGridEventUpdater.PlaceName = PlaceName;
            ctrlGridEventUpdater.GridId    = grdMain.GridClientContainerId;

            MainMetaToolbar.ClassName = ClassName;
            MainMetaToolbar.ViewName  = ViewName;
            MainMetaToolbar.PlaceName = PlaceName;
            MainMetaToolbar.DataBind();
        }
コード例 #2
0
        public override void DataBind()
        {
            CHelper.AddToContext(_httpContextClassNameKey, ClassName);
            CHelper.AddToContext(_httpContextFilterFieldNameKey, FilterFieldName);
            CHelper.AddToContext(_httpContextFilterFieldValueKey, Request["ObjectId"]);

            if (String.IsNullOrEmpty(ProfileName))
            {
                MetaClass         mc   = Mediachase.Ibn.Core.MetaDataWrapper.GetMetaClassByName(ClassName);
                ListViewProfile[] list = ListViewProfile.GetSystemProfiles(ClassName, PlaceName);
                if (list.Length == 0)
                {
                    list = ListViewProfile.GetSystemProfiles(ClassName, "EntityList");
                    if (list.Length == 0)
                    {
                        list = ListViewProfile.GetSystemProfiles(ClassName, String.Empty);
                        if (list.Length == 0)
                        {
                            ListViewProfile lvp = new ListViewProfile();
                            lvp.Id       = Guid.NewGuid().ToString();
                            lvp.IsPublic = true;
                            lvp.IsSystem = true;
                            lvp.Name     = CHelper.GetResFileString(mc.FriendlyName);
                            lvp.ColumnsUI.Add(new ColumnProperties(mc.TitleFieldName, "150px", String.Empty));
                            lvp.FieldSet.Add(mc.TitleFieldName);
                            lvp.Filters = new FilterElementCollection();
                            ListViewProfile.SaveSystemProfile(ClassName, PlaceName, Mediachase.Ibn.Data.Services.Security.CurrentUserId, lvp);
                            list = ListViewProfile.GetSystemProfiles(ClassName, String.Empty);
                        }
                    }
                }
                ProfileName = list[0].Id;
            }
            grdMain.ClassName      = ClassName;
            grdMain.ViewName       = ViewName;
            grdMain.PlaceName      = PlaceName;
            grdMain.ProfileName    = ProfileName;
            grdMain.ShowCheckboxes = ShowCheckBoxes;
            FilterElementCollection fec = new FilterElementCollection();

            fec.Add(FilterElement.EqualElement(FilterFieldName, Request["ObjectId"]));
            grdMain.AddFilters = fec;
            grdMain.DataBind();

            ctrlGridEventUpdater.ClassName = ClassName;
            ctrlGridEventUpdater.ViewName  = ViewName;
            ctrlGridEventUpdater.PlaceName = PlaceName;
            ctrlGridEventUpdater.GridId    = grdMain.GridClientContainerId;

            MainMetaToolbar.ClassName = ClassName;
            MainMetaToolbar.ViewName  = ViewName;
            MainMetaToolbar.PlaceName = PlaceName;
            MainMetaToolbar.DataBind();
        }
コード例 #3
0
        public override void DataBind()
        {
            CHelper.AddToContext(_httpContextBridgeClassNameKey, BridgeClassName);
            CHelper.AddToContext(_httpContextClassNameKey, ClassName);
            CHelper.AddToContext(_httpContextFilter1FieldNameKey, Filter1FieldName);
            CHelper.AddToContext(_httpContextFilter1FieldValueKey, ObjectId);
            CHelper.AddToContext(_httpContextFilter2FieldNameKey, Filter2FieldName);

            MetaClass mc = Mediachase.Ibn.Core.MetaDataWrapper.GetMetaClassByName(ClassName);

            grdMain.ClassName      = ClassName;
            grdMain.ViewName       = ViewName;
            grdMain.PlaceName      = PlaceName;
            grdMain.ProfileName    = ProfileName;
            grdMain.ShowCheckboxes = (ObjectId > 0);

            MetaClass bridgeClass       = Mediachase.Ibn.Core.MetaDataWrapper.GetMetaClassByName(BridgeClassName);
            string    pkName            = SqlContext.Current.Database.Tables[mc.DataSource.PrimaryTable].PrimaryKey.Name;
            string    bridgeTableName   = bridgeClass.DataSource.PrimaryTable;
            FilterElementCollection fec = new FilterElementCollection();
            FilterElement           fe;

            if (ObjectId < 0)                   // default profile
            {
                fe = new FilterElement(pkName, FilterElementType.In,
                                       String.Format("(SELECT [{0}] FROM cls_Principal WHERE Card = 'User' AND Activity = 3 AND [{0}] NOT IN (SELECT [{0}] FROM [{1}]))",
                                                     Filter2FieldName, bridgeTableName));
            }
            else
            {
                fe = new FilterElement(pkName, FilterElementType.In,
                                       String.Format("(SELECT [{0}] FROM [{1}] WHERE [{2}]={3})",
                                                     Filter2FieldName, bridgeTableName, Filter1FieldName, ObjectId));
            }
            fec.Add(fe);
            grdMain.AddFilters = fec;
            grdMain.DataBind();

            ctrlGridEventUpdater.ClassName = ClassName;
            ctrlGridEventUpdater.ViewName  = ViewName;
            ctrlGridEventUpdater.PlaceName = PlaceName;
            ctrlGridEventUpdater.GridId    = grdMain.GridClientContainerId;

            MainMetaToolbar.ClassName = ClassName;
            MainMetaToolbar.ViewName  = ViewName;
            MainMetaToolbar.PlaceName = PlaceName;
            MainMetaToolbar.DataBind();
        }
コード例 #4
0
ファイル: LeftMenuItems.ascx.cs プロジェクト: alex765022/IBN
        public override void DataBind()
        {
            grdMain.ClassName = ClassName;
            grdMain.ViewName  = ViewName;
            grdMain.PlaceName = PlaceName;
            pc[grdMain.GetPropertyKey(MCGrid.PageSizePropertyKey)] = "-1";

            ctrlGridEventUpdater.ClassName = ClassName;
            ctrlGridEventUpdater.ViewName  = ViewName;
            ctrlGridEventUpdater.PlaceName = PlaceName;
            ctrlGridEventUpdater.GridId    = grdMain.GridClientContainerId;

            MainMetaToolbar.ClassName = ClassName;
            MainMetaToolbar.ViewName  = ViewName;
            MainMetaToolbar.PlaceName = PlaceName;
            MainMetaToolbar.DataBind();

            BindDataGrid(true);
        }
コード例 #5
0
        public override void DataBind()
        {
            grdMain.ClassName = ClassName;
            grdMain.ViewName  = ViewName;
            grdMain.PlaceName = PlaceName;
            //grdMain.ShowPaging = false;
            //grdMain.PageSize = -1;
            //grdMain.DataBind();

            ctrlGridEventUpdater.ClassName = ClassName;
            ctrlGridEventUpdater.ViewName  = ViewName;
            ctrlGridEventUpdater.PlaceName = PlaceName;
            ctrlGridEventUpdater.GridId    = grdMain.GridClientContainerId;

            MainMetaToolbar.ClassName = ClassName;
            MainMetaToolbar.ViewName  = ViewName;
            MainMetaToolbar.PlaceName = PlaceName;
            MainMetaToolbar.DataBind();

            BindDataGrid(true);
        }
コード例 #6
0
        public override void DataBind()
        {
            CHelper.AddToContext(_httpContextBridgeClassNameKey, BridgeClassName);
            CHelper.AddToContext(_httpContextClassNameKey, ClassName);
            CHelper.AddToContext(_httpContextFilter1FieldNameKey, Filter1FieldName);
            CHelper.AddToContext(_httpContextFilter1FieldValueKey, Request["ObjectId"]);
            CHelper.AddToContext(_httpContextFilter2FieldNameKey, Filter2FieldName);

            MetaClass mc = Mediachase.Ibn.Core.MetaDataWrapper.GetMetaClassByName(ClassName);

            if (String.IsNullOrEmpty(ProfileName))
            {
                ListViewProfile[] list = ListViewProfile.GetSystemProfiles(ClassName, PlaceName);
                if (list.Length == 0)
                {
                    list = ListViewProfile.GetSystemProfiles(ClassName, "EntityList");
                    if (list.Length == 0)
                    {
                        list = ListViewProfile.GetSystemProfiles(ClassName, String.Empty);
                        if (list.Length == 0)
                        {
                            ListViewProfile lvp = new ListViewProfile();
                            lvp.Id       = Guid.NewGuid().ToString();
                            lvp.IsPublic = true;
                            lvp.IsSystem = true;
                            lvp.Name     = CHelper.GetResFileString(mc.FriendlyName);
                            lvp.ColumnsUI.Add(new ColumnProperties(mc.TitleFieldName, "150px", String.Empty));
                            lvp.FieldSet.Add(mc.TitleFieldName);
                            lvp.Filters = new FilterElementCollection();
                            ListViewProfile.SaveSystemProfile(ClassName, PlaceName, Mediachase.Ibn.Data.Services.Security.CurrentUserId, lvp);
                            list = ListViewProfile.GetSystemProfiles(ClassName, String.Empty);
                        }
                    }
                }
                ProfileName = list[0].Id;
            }
            grdMain.ClassName      = ClassName;
            grdMain.ViewName       = ViewName;
            grdMain.PlaceName      = PlaceName;
            grdMain.ProfileName    = ProfileName;
            grdMain.ShowCheckboxes = ShowCheckBoxes;

            MetaClass bridgeClass       = Mediachase.Ibn.Core.MetaDataWrapper.GetMetaClassByName(BridgeClassName);
            string    pkName            = SqlContext.Current.Database.Tables[mc.DataSource.PrimaryTable].PrimaryKey.Name;
            string    bridgeTableName   = bridgeClass.DataSource.PrimaryTable;
            FilterElementCollection fec = new FilterElementCollection();
            FilterElement           fe  = new FilterElement(pkName, FilterElementType.In,
                                                            String.Format("(SELECT [{0}] FROM [{1}] WHERE [{2}]='{3}')",
                                                                          Filter2FieldName, bridgeTableName, Filter1FieldName, Request["ObjectId"]));

            //FilterElement fe = new FilterElement(String.Empty, FilterElementType.Custom,
            //    String.Format("[t01].[{0}] IN (SELECT [{1}] FROM [{2}] WHERE [{3}]='{4}')",
            //                pkName, Filter2FieldName, bridgeTableName, Filter1FieldName, Request["ObjectId"]));
            fec.Add(fe);
            grdMain.AddFilters = fec;
            grdMain.DataBind();

            ctrlGridEventUpdater.ClassName = ClassName;
            ctrlGridEventUpdater.ViewName  = ViewName;
            ctrlGridEventUpdater.PlaceName = PlaceName;
            ctrlGridEventUpdater.GridId    = grdMain.GridClientContainerId;

            MainMetaToolbar.ClassName = ClassName;
            MainMetaToolbar.ViewName  = ViewName;
            MainMetaToolbar.PlaceName = PlaceName;
            MainMetaToolbar.DataBind();
        }