csharp filtrowanie po oddzialach #xaf

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp filtrowanie po oddzialach #xaf相关的知识,希望对你有一定的参考价值。

using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using Fleetman.Module.BusinessObjects.CRM;
using DevExpress.ExpressApp.Xpo;
using Fleetman.Module.BusinessObjects.RAC;
using DevExpress.ExpressApp.Editors;

namespace Fleetman.Module.Win.Controllers
{
    public  class WinAlternatingRowsController : ViewController
    {
        public WinAlternatingRowsController()
        {
            TargetViewType = ViewType.ListView;
            TargetObjectType = typeof(IOddzialy);
            TargetViewNesting = Nesting.Root;
        }
        protected override void OnActivated()
        {
            base.OnActivated();
            Pracownicy currentUser = ((XPObjectSpace)ObjectSpace).Session.GetObjectByKey<Pracownicy>(SecuritySystem.CurrentUserId);


            if (currentUser.DzialFirmy != null)
            {
                int lk = currentUser.ObslugiwaneOddzialy.Count;

                lk++;

                string[] arr = new string[lk];
                arr[0] = currentUser.DzialFirmy.NazwaOddzialu;
                if (currentUser.ObslugiwaneOddzialy != null && currentUser.ObslugiwaneOddzialy.Count > 0)

                {
                    int i = 1;
                    foreach (OddzialFirmy of in currentUser.ObslugiwaneOddzialy)
                    {
                        arr[i] = of.NazwaOddzialu;
                        i++;
                    }
                }

                currentUser.ObslugiwaneOddzialy.Add(currentUser.DzialFirmy);

                OddzialFirmy UserDepartment = ((XPObjectSpace)ObjectSpace).Session.GetObjectByKey<OddzialFirmy>(currentUser.DzialFirmy.Oid);
                if (UserDepartment != null && UserDepartment.Oid != 1)
                {
                    ((ListView)View).CollectionSource.BeginUpdateCriteria();


                    ((ListView)View).CollectionSource.Criteria["Oddzial"] = new InOperator("OddzialFirmy.NazwaOddzialu", arr);

                    ((ListView)View).CollectionSource.EndUpdateCriteria();
                }
                else
                {
                    ((ListView)View).CollectionSource.BeginUpdateCriteria();

                    ((ListView)View).CollectionSource.Criteria.Clear();
                    //  ((ListView)View).CollectionSource.Criteria["Oddzial"] = "";

                    ((ListView)View).CollectionSource.EndUpdateCriteria();

                }

            }
        }
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
        }
        protected override void OnDeactivated()
        {
            base.OnDeactivated();
        }

        private void InitializeComponent()
        {


        }


    }
}

以上是关于csharp filtrowanie po oddzialach #xaf的主要内容,如果未能解决你的问题,请参考以下文章

Delphi System单元-Odd- 判断是否是奇数

jquery中odd和even选择器的用法说明

jQuery :odd 和 :nth-child CSS3 不同

jquery odd选择器 语法

Odd Even Linked List

328. Odd Even Linked List