예제 #1
0
        public static TTable SelectSingle <TTable>(this BqlCommand command, PXGraph graph, bool isReadonly, IBqlTable[] currents, params object[] parameters)
            where TTable : IBqlTable
        {
            object   data   = command.CreateView(graph, mergeCache: !isReadonly).SelectSingleBound(currents, parameters);
            PXResult result = data as PXResult;

            return(result != null
                                ? (TTable)result[typeof(TTable)]
                                : (TTable)data);
        }
예제 #2
0
        public virtual IEnumerable items()
        {
            SchedulesFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <DRScheduleDetail> select = new PXSelectJoin <
                    DRScheduleDetail,
                    InnerJoin <DRSchedule,
                               On <DRSchedule.scheduleID, Equal <DRScheduleDetail.scheduleID> >,
                               InnerJoin <DRDeferredCode,
                                          On <DRDeferredCode.deferredCodeID, Equal <DRScheduleDetail.defCode> > > >,
                    Where <
                        DRDeferredCode.accountType, Equal <Current <DRDraftScheduleProc.SchedulesFilter.accountType> >,
                        And <DRScheduleDetail.status, Equal <DRScheduleStatus.DraftStatus>,
                             And <DRSchedule.isCustom, Equal <True> > > >,
                    OrderBy <
                        Asc <DRScheduleDetail.scheduleID,
                             Asc <DRScheduleDetail.componentID,
                                  Asc <DRScheduleDetail.detailLineNbr> > > > >
                                                             (this);

                BqlCommand command = select.View.BqlSelect;

                if (!string.IsNullOrEmpty(filter.DeferredCode))
                {
                    command = command.WhereAnd <Where <DRScheduleDetail.defCode, Equal <Current <SchedulesFilter.deferredCode> > > >();
                }

                if (filter.BranchID != null)
                {
                    command = command.WhereAnd <Where <DRScheduleDetail.branchID, Equal <Current <SchedulesFilter.branchID> > > >();
                }

                if (filter.AccountID != null)
                {
                    command = command.WhereAnd <Where <DRScheduleDetail.defAcctID, Equal <Current <SchedulesFilter.accountID> > > >();
                }

                if (filter.SubID != null)
                {
                    command = command.WhereAnd <Where <DRScheduleDetail.defSubID, Equal <Current <SchedulesFilter.subID> > > >();
                }

                if (filter.BAccountID != null)
                {
                    command = command.WhereAnd <Where <DRScheduleDetail.bAccountID, Equal <Current <SchedulesFilter.bAccountID> > > >();
                }

                if (filter.ComponentID != null)
                {
                    command = command.WhereAnd <Where <DRScheduleDetail.componentID, Equal <Current <SchedulesFilter.componentID> > > >();
                }

                return(command.CreateView(this, mergeCache: !select.View.IsReadOnly).SelectExternalWithPaging());
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
 public static bool Any(this BqlCommand command, PXGraph graph, bool isReadonly, IBqlTable[] currents, params object[] parameters)
 {
     return(command.CreateView(graph, mergeCache: !isReadonly).SelectSingleBound(currents, parameters) != null);
 }
예제 #4
0
 public static IEnumerable <TTable> Select <TTable>(this BqlCommand command, PXGraph graph, bool isReadonly, params object[] parameters)
     where TTable : IBqlTable
 {
     return(command.CreateView(graph, mergeCache: !isReadonly).SelectMulti(parameters).RowCast <TTable>());
 }