示例#1
0
        public bool AppendExpression(ref SQLExpression exp, PXGraph graph, BqlCommandInfo info, BqlCommand.Selection selection)
        {
            bool status = true;

            SQLExpression userID = null;

            status &= BqlCommand.AppendExpression <UserID>(ref userID, graph, info, selection, ref _operand);

            if (graph == null)
            {
                return(status);
            }

            exp.VerifyComparisonExpression();

            SimpleTable epEmployee = new SimpleTable <EPEmployee>(EMPLOYEERALIAS);

            exp.SetOper(SQLExpression.Operation.IN);

            exp = exp.LExpr().In(new Query()
                                 .Select <EPWingman.employeeID>().From <EPWingman>()
                                 .InnerJoin(epEmployee)
                                 .On(new Column <EPEmployee.bAccountID>(epEmployee).Equal(new Column(typeof(EPWingman.wingmanID)))
                                     .And(new Column <EPEmployee.userID>(epEmployee).Equal(userID)))
                                 .Where(PX.Data.SQLTree.Constant.SQLConstant(1)
                                        .Equal(PX.Data.SQLTree.Constant.SQLConstant(1))));

            return(status);
        }
示例#2
0
        public bool AppendExpression(ref SQLExpression exp, PXGraph graph, BqlCommandInfo info, BqlCommand.Selection selection)
        {
            bool status = true;

            SQLExpression userID1 = null;

            status &= BqlCommand.AppendExpression <UserID>(ref userID1, graph, info, selection, ref _operand);
            SQLExpression userID2 = null;

            status &= BqlCommand.AppendExpression <UserID>(ref userID2, graph, info, selection, ref _operand);

            if (graph == null || !info.BuildExpression)
            {
                return(status);
            }

            exp = exp.In(new Query()
                         .Select <EPApproval.refNoteID>()
                         .From <EPApproval>()
                         .Where(typeof(EPApproval.ownerID).EQ(userID1)
                                .Or(typeof(EPApproval.workgroupID)
                                    .In(new Query()
                                        .Select <EPCompanyTreeH.workGroupID>()
                                        .From <EPCompanyTreeH>()
                                        .Join <EPCompanyTreeMember>()
                                        .On(typeof(EPCompanyTreeH.parentWGID).EQ(typeof(EPCompanyTreeMember.workGroupID))
                                            .And(typeof(EPCompanyTreeH.parentWGID).NE(typeof(EPCompanyTreeH.workGroupID)))
                                            .And(typeof(EPCompanyTreeMember.active).EQ(true))
                                            .And(typeof(EPCompanyTreeMember.userID).EQ(userID2)))
                                        .Where(new SQLConst(1)
                                               .EQ(new SQLConst(1)))))));
            return(status);
        }