Пример #1
0
        protected virtual IEnumerable activity()
        {
            List <object>    args      = new List <object>();
            EPActivityFilter filterRow = Filter.Current;

            if (filterRow == null)
            {
                return(null);
            }

            PXSelectBase <EPActivityApprove> cmd;

            cmd = new PXSelectJoin <EPActivityApprove
                                    , LeftJoin <EPEarningType, On <EPEarningType.typeCD, Equal <EPActivityApprove.earningTypeID> >
                                                , LeftJoin <CRCase, On <CRCase.noteID, Equal <EPActivityApprove.refNoteID> >
                                                            , LeftJoin <Contract, On <CRCase.contractID, Equal <Contract.contractID> > >
                                                            >
                                                >
                                    , Where <EPActivityApprove.owner, Equal <Current <EPActivityFilter.ownerID> >
                                             , And <EPActivityApprove.isCorrected, Equal <False>
                                                    , And <EPActivityApprove.trackTime, Equal <True>
                                                           , And <EPActivityApprove.classID, NotEqual <CRActivityClass.emailRouting>
                                                                  , And <EPActivityApprove.classID, NotEqual <CRActivityClass.task>
                                                                         , And <EPActivityApprove.classID, NotEqual <CRActivityClass.events> >
                                                                         >
                                                                  >
                                                           >
                                                    >
                                             >
                                    , OrderBy <Desc <EPActivityApprove.startDate> >
                                    >(this);

            if (filterRow.FromDate != null)
            {
                cmd.WhereAnd <Where <EPActivityApprove.startDate, GreaterEqual <Required <EPActivityFilter.fromDate> > > >();
                args.Add(filterRow.FromDate);
            }

            if (filterRow.TillDate != null)
            {
                cmd.WhereAnd <Where <EPActivityApprove.startDate, Less <Required <EPActivityFilter.tillDate> > > >();
                args.Add(filterRow.TillDate.Value.AddDays(1));
            }

            if (filterRow.ProjectID != null)
            {
                cmd.WhereAnd <Where <EPActivityApprove.projectID, Equal <Current <EPActivityFilter.projectID> > > >();
            }

            if (filterRow.ProjectTaskID != null)
            {
                cmd.WhereAnd <Where <EPActivityApprove.projectTaskID, Equal <Current <EPActivityFilter.projectTaskID> > > >();
            }

            if (filterRow.IncludeReject == true)
            {
                cmd.WhereOr <Where <EPActivityApprove.uistatus, Equal <CR.ActivityStatusListAttribute.rejected> > >();
            }

            return(cmd.Select(args.ToArray()));
        }