protected override void OnActivated()
        {
            base.OnActivated();
            string propertyName = "ModifiedOn";
            bool   demoFlag     = true;

            //Dennis: This code applies a client side sorting.
            if (demoFlag)
            {
                IModelColumn columnInfo = ((IModelList <IModelColumn>)View.Model.Columns)[propertyName];
                if (columnInfo != null)
                {
                    columnInfo.SortIndex = 0;
                    columnInfo.SortOrder = ColumnSortOrder.Descending;
                }
            }
            else
            {
                //Dennis: This code is used for the server side sorting.
                if (((IModelList <IModelSortProperty>)View.Model.Sorting)[propertyName] == null)
                {
                    IModelSortProperty sortProperty = View.Model.Sorting.AddNode <IModelSortProperty>(propertyName);
                    sortProperty.Direction    = SortingDirection.Descending;
                    sortProperty.PropertyName = propertyName;
                }
            }
        }
コード例 #2
0
        // Override to do something when a Controller is activated and its View is assigned.
        protected override void OnActivated()
        {
            base.OnActivated();
            //For instance, you can customize the current View and its editors (http://documentation.devexpress.com/#Xaf/CustomDocument2729) or manage the Controller's Actions visibility and availability (http://documentation.devexpress.com/#Xaf/CustomDocument2728).


            string propertyName = "FechaDoc";
            bool   demoFlag     = true;

            //Dennis: This code applies a client side sorting.
            if (demoFlag)
            {
                IModelColumn columnInfo = ((IModelList <IModelColumn>)((ListView)View).Model.Columns)[propertyName];
                if (columnInfo != null)
                {
                    columnInfo.SortIndex = 0;
                    columnInfo.SortOrder = ColumnSortOrder.Descending;
                }
            }
            else
            {
                //Dennis: This code is used for the server side sorting.
                if (((IModelList <IModelSortProperty>)((ListView)View).Model.Sorting)[propertyName] == null)
                {
                    IModelSortProperty sortProperty = ((ListView)View).Model.Sorting.AddNode <IModelSortProperty>(propertyName);
                    sortProperty.Direction    = SortingDirection.Descending;
                    sortProperty.PropertyName = propertyName;
                }
            }

            /*
             * if (!((Employee)SecuritySystem.CurrentUser).IsAdministrator)
             * {
             *  lv.CollectionSource.Criteria["AssignedTo"] = CriteriaOperator.Parse("AssignedTo.Oid = ?", SecuritySystem.CurrentUserId);
             * }*/

            UpdateAction();


            bool puede = SecuritySystem.CurrentUserName == "root";

            simpleActionRprtCntbl.Enabled.SetItemValue("SecurityAllowance", puede);
            simpleActionRprtCntbl.Active.SetItemValue("Visible", puede);

            /*
             * puede = false;
             * simpleActionGetXml.Enabled.SetItemValue("SecurityAllowance", puede);
             * simpleActionGetXml.Active.SetItemValue("Visible", puede);*/
        }