Пример #1
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            string text2;
            WorkFlowActStrategyName name = (WorkFlowActStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type != StrategyType.Other)
            {
                return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
            }
            switch (name)
            {
            case WorkFlowActStrategyName.ProcedureCodeIn:
                return(string.Format(" ProcedureCode in ({0})", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.Status:
            case WorkFlowActStrategyName.CaseStatus:
            case WorkFlowActStrategyName.CopyState:
            case WorkFlowActStrategyName.FromUserCode:
            case WorkFlowActStrategyName.CurrentTaskCode:
                return(text);

            case WorkFlowActStrategyName.ActUserCode:
                return(string.Format(" ActCode in (select a.actcode from workflowact a,workflowactuser b where a.actcode=b.actcode and (a.actusercode='{0}' or b.usercode='{0}'))", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.InActUser:
                return(string.Format(" exists ( select 1 from WorkFlowActUser where WorkFlowActUser.ActCode=V_WorkFlowAct.ActCode and WorkFlowActUser.UserCode='{0}' ) ", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.IsCaseActUser:
                return(string.Format(" CaseCode in (select CaseCode from V_WorkFlowAct where ActUserCode='{0}') and Copy=0 ", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.SendActUser:
                return(string.Format(" FromUserCode ='{0}' and Status='Begin'", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.StatusBegin:
                return(string.Format(" (Status='{0}' or (CopyFromActCode!='' and Status!='End'))", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.IsNotActUser:
                return(string.Format(" CaseCode not in (select CaseCode from V_WorkFlowAct where ActUserCode='{0}') and Copy=0 ", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.ActMeetOrder:
                return(string.Format(" ActCode not in (select ActCode from V_WorkFlowAct where copy='0' and TaskActorID != '' and substring(ActUnitCode,1,2) = 'no')", new object[0]));

            case WorkFlowActStrategyName.ProjectCode:
                return(string.Format(" CaseCode in (select workflowcasecode from workflowprocedureproperty a, workflowcaseproperty b where a.workflowprocedurepropertycode=b.workflowprocedurepropertycode and procedurepropertyname='项目代码' and workflowprocedurepropertyvalue='{0}')", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.Title:
                return(string.Format(" CaseCode in (select workflowcasecode from workflowprocedureproperty a, workflowcaseproperty b where a.workflowprocedurepropertycode=b.workflowprocedurepropertycode and procedurepropertyname='主题' and workflowprocedurepropertyvalue like '%{0}%')", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.CurrentTaskName:
                return(string.Format(" ToTaskName like '%{0}%'", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.SignDate:
                return(string.Format(" (SignDate>'{0}' and SignDate<'{1}')", strategy.GetParameter(0), strategy.GetParameter(1)));

            case WorkFlowActStrategyName.FinishDate:
                return(string.Format(" (FinishDate>'{0}' and FinishDate<'{1}')", strategy.GetParameter(0), strategy.GetParameter(1)));

            case WorkFlowActStrategyName.FromDate:
                return(string.Format(" (FromDate>'{0}' and FromDate<'{1}')", strategy.GetParameter(0), strategy.GetParameter(1)));

            case WorkFlowActStrategyName.StatusBeginAndDealWith:
                return(string.Format(" (Status='Begin' or (CopyFromActCode!='' and Status!='End') or Status='DealWith') ", new object[0]));

            case WorkFlowActStrategyName.FlowNumber:
                return(string.Format(" ( CaseCode like '%{0}%' or CaseCode in (select workflowcasecode from workflowprocedureproperty a, workflowcaseproperty b where a.workflowprocedurepropertycode=b.workflowprocedurepropertycode and procedurepropertyname='流水号' and workflowprocedurepropertyvalue like '%{0}%'))", strategy.GetParameter(0)));

            case WorkFlowActStrategyName.AccessRange:
                text2 = ConfigurationSettings.AppSettings["FlowProjectGroup"];
                if (text2 != "1")
                {
                    text = " (( ProcedureCode in (select ProcedureCode from workflowprocedure where " + AccessRanggeQuery.BuildAccessRangeStringNoGroupCode(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), SystemClassDescription.GetItemTableName("WorkFlowProcedure"), SystemClassDescription.GetItemKeyColumnName("WorkFlowProcedure"), SystemClassDescription.GetItemTypeColumnName("WorkFlowProcedure"), SystemClassDescription.GetItemCreateUserColumnName("WorkFlowProcedure")) + "))";
                    break;
                }
                text = " (( ProcedureCode in (select ProcedureCode from workflowprocedure where " + AccessRanggeQuery.BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), SystemClassDescription.GetItemTableName("WorkFlowProcedure"), SystemClassDescription.GetItemKeyColumnName("WorkFlowProcedure"), SystemClassDescription.GetItemTypeColumnName("WorkFlowProcedure"), SystemClassDescription.GetItemCreateUserColumnName("WorkFlowProcedure")) + "))";
                break;

            default:
                return(text);
            }
            if (strategy.GetParameter(3) != "")
            {
                text = text + string.Format(" or (CaseCode in (select CaseCode from V_WorkFlowAct where ActUserCode='{0}') and Copy=0 )", strategy.GetParameter(3));
            }
            if (text2 == "1")
            {
                string codes = AccessRanggeQuery.BuildStationCodeString(strategy.GetParameter(2));
                text = text + this.BuildAccessTypeString(strategy.GetParameter(0), strategy.GetParameter(1), codes, SystemClassDescription.GetItemCreateUserColumnName("WorkFlowProcedure"));
            }
            return(text + ") ");
        }
Пример #2
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            CostBudgetBackupDtlStrategyName name = (CostBudgetBackupDtlStrategyName)strategy.Name;
            string text2 = "";
            string text3 = "";

            if (strategy.Type != StrategyType.Other)
            {
                return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
            }
            CostBudgetBackupDtlStrategyName name2 = name;

            if (name2 != CostBudgetBackupDtlStrategyName.False)
            {
                if (name2 != CostBudgetBackupDtlStrategyName.CostCodeIn)
                {
                    if (name2 != CostBudgetBackupDtlStrategyName.GroupCodeEx)
                    {
                        return(text3);
                    }
                    string systemGroupCode = strategy.GetParameter(0);
                    string parameter       = strategy.GetParameter(1);
                    if (parameter == null)
                    {
                        return(text3);
                    }
                    if (parameter != "0")
                    {
                        if (parameter != "1")
                        {
                            if (parameter != "2")
                            {
                                return(text3);
                            }
                            return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));
                        }
                    }
                    else
                    {
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));
                    }
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));
                }
                text2 = StrategyConvert.BuildInStr(strategy.GetParameter(0));
                if (text2 != "")
                {
                    text3 = string.Format(" CostCode in ({0}) ", text2);
                }
                return(text3);
            }
            return("1=2");
        }
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            WorkFlowProcedureStrategyName name = (WorkFlowProcedureStrategyName)strategy.Name;

            if (strategy.Type == StrategyType.Other)
            {
                //switch (name)
                //{
                //    case WorkFlowProcedureStrategyName.AccessRange:
                //        return "";
                //}
                return(AccessRanggeQuery.BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), SystemClassDescription.GetItemTableName("WorkFlowProcedure"), SystemClassDescription.GetItemKeyColumnName("WorkFlowProcedure"), SystemClassDescription.GetItemTypeColumnName("WorkFlowProcedure"), SystemClassDescription.GetItemCreateUserColumnName("WorkFlowProcedure")));
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Пример #4
0
 public static string BuildAccessRangeString(string UserCode, string StationCodes)
 {
     return(AccessRanggeQuery.BuildAccessRangeString("141101", UserCode, StationCodes, SystemClassDescription.GetItemTableName("MaterialCost"), SystemClassDescription.GetItemKeyColumnName("MaterialCost"), SystemClassDescription.GetItemTypeColumnName("MaterialCost"), SystemClassDescription.GetItemCreateUserColumnName("MaterialCost")));
 }
Пример #5
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            SupplierStrategyName name = (SupplierStrategyName)strategy.Name;
            string text  = "";
            string text2 = "";

            if (strategy.Type != StrategyType.Other)
            {
                return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
            }
            switch (name)
            {
            case SupplierStrategyName.SupplierTypeCodeEx:
            {
                string systemGroupCode = strategy.GetParameter(0);
                switch (strategy.GetParameter(1))
                {
                case "0":
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("Supplier")));

                case "1":
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("Supplier")));

                case "2":
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("Supplier")));
                }
                return(text);
            }

            case SupplierStrategyName.AccessRange:
                return(AccessRanggeQuery.BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), SystemClassDescription.GetItemTableName("Supplier"), SystemClassDescription.GetItemKeyColumnName("Supplier"), SystemClassDescription.GetItemTypeColumnName("Supplier"), SystemClassDescription.GetItemCreateUserColumnName("Supplier")));

            case SupplierStrategyName.CheckName:
            {
                string parameter = strategy.GetParameter(0);
                string text4     = strategy.GetParameter(1);
                string text5     = strategy.GetParameter(2);
                if (parameter == "")
                {
                    if (text5 != "")
                    {
                        return(string.Format(" ( SupplierName='{0}'  or  Abbreviation = '{1}' ) ", text4, text5, parameter));
                    }
                    return(string.Format(" ( SupplierName='{0}'   ) ", text4, text5, parameter));
                }
                if (text5 == "")
                {
                    return(string.Format(" ( SupplierCode<>'{2}' )  and ( SupplierName='{0}'   ) ", text4, text5, parameter));
                }
                return(string.Format(" ( SupplierCode<>'{2}' )  and ( SupplierName='{0}'  or  Abbreviation = '{1}' ) ", text4, text5, parameter));
            }

            case SupplierStrategyName.False:
                return("1=2");

            case SupplierStrategyName.IsExistsContract:
                if (strategy.GetParameter(0) != "1")
                {
                    return(" not exists (select * from Contract where Contract.SupplierCode = Supplier.SupplierCode)");
                }
                return(" exists (select * from Contract where Contract.SupplierCode = Supplier.SupplierCode)");

            case SupplierStrategyName.Grade:
                text2 = strategy.GetParameter(0);
                return(string.Format("exists (select * from SupplierSurveyOpinion o where o.SupplierCode = Supplier.SupplierCode and o.SupplierSurveyOpinionCode = (select min(SupplierSurveyOpinionCode) from SupplierSurveyOpinion o2 where o2.SupplierCode = o.SupplierCode) and o.Grade like '{0}')", text2));
            }
            return(text);
        }
Пример #6
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            PaymentStrategyName name = (PaymentStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case PaymentStrategyName.WBSCode:
                {
                    string costCode    = strategy.GetParameter(0);
                    string cBSFullCode = CBSDAO.GetCBSFullCode(costCode);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNodeIncludeSelf));

                    case "1":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubLeafNode));

                    case "2":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNotLeafNode));

                    case "4":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.OnlySelfNode));
                    }
                    return(text);
                }

                case PaymentStrategyName.AccessRange:
                    return(BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1)));

                case PaymentStrategyName.GroupCode:
                case PaymentStrategyName.PaymentTitle:
                case PaymentStrategyName.PaymentNameEx:
                    return(text);

                case PaymentStrategyName.GroupCodeEx:
                {
                    string systemGroupCode = strategy.GetParameter(0);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("Payment")));

                    case "1":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("Payment")));

                    case "2":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("Payment")));
                    }
                    return(text);
                }

                case PaymentStrategyName.NotPayout:
                    return("isnull(Money, 0) - isnull(TotalPayoutMoney, 0) >= 0.01");

                case PaymentStrategyName.BatchPayment:
                    return("Payer = '成本批量请款'");

                case PaymentStrategyName.NotBatchPayment:
                    return("isnull(Payer, '') <> '成本批量请款'");
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Пример #7
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            MaterialCostStrategyName name = (MaterialCostStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case MaterialCostStrategyName.GroupCodeEx:
                {
                    string systemGroupCode = strategy.GetParameter(0);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("MaterialCost")));

                    case "1":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("MaterialCost")));

                    case "2":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("MaterialCost")));
                    }
                    return(text);
                }

                case MaterialCostStrategyName.AccessRange:
                    return(BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1)));

                case MaterialCostStrategyName.False:
                    return("1=2");
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Пример #8
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            CostBudgetMonthStrategyName name = (CostBudgetMonthStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                CostBudgetMonthStrategyName name2 = name;
                if (name2 != CostBudgetMonthStrategyName.False)
                {
                    if (name2 != CostBudgetMonthStrategyName.GroupCodeEx)
                    {
                        return(text);
                    }
                }
                else
                {
                    return("1=2");
                }
                string systemGroupCode = strategy.GetParameter(0);
                string parameter       = strategy.GetParameter(1);
                if (parameter == null)
                {
                    return(text);
                }
                if (parameter != "0")
                {
                    if (parameter != "1")
                    {
                        if (parameter != "2")
                        {
                            return(text);
                        }
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));
                    }
                }
                else
                {
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));
                }
                return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Пример #9
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            PayoutStrategyName name   = (PayoutStrategyName)strategy.Name;
            string             format = "";

            if (strategy.Type != StrategyType.Other)
            {
                return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
            }
            switch (name)
            {
            case PayoutStrategyName.ContractCode:
                format = "exists (select 1 from V_PayoutItem i where i.PayoutCode = {0}.PayoutCode and i.ContractCode = '{1}')";
                return(string.Format(format, "Payout", strategy.GetParameter(0)));

            case PayoutStrategyName.ContractID:
                format = "exists (select 1 from V_PayoutItem i where i.PayoutCode = {0}.PayoutCode and i.ContractID like '%{1}%')";
                return(string.Format(format, "Payout", strategy.GetParameter(0)));

            case PayoutStrategyName.ContractName:
                format = "exists (select 1 from V_PayoutItem i where i.PayoutCode = {0}.PayoutCode and i.ContractName like '%{1}%')";
                return(string.Format(format, "Payout", strategy.GetParameter(0)));

            case PayoutStrategyName.PaymentCode:
                format = "exists (select 1 from V_PayoutItem i where i.PayoutCode = {0}.PayoutCode and i.PaymentCode = '{1}')";
                return(string.Format(format, "Payout", strategy.GetParameter(0)));

            case PayoutStrategyName.PaymentID:
                format = "exists (select 1 from V_PayoutItem i where i.PayoutCode = {0}.PayoutCode and i.PaymentID = '{1}')";
                return(string.Format(format, "Payout", strategy.GetParameter(0)));

            case PayoutStrategyName.VoucherCode:
            case PayoutStrategyName.IsApportioned:
                return(format);

            case PayoutStrategyName.VoucherID:
                format = "exists (select 1 from Voucher v where v.VoucherCode = {0}.VoucherCode and v.VoucherID = '{1}')";
                return(string.Format(format, "Payout", strategy.GetParameter(0)));

            case PayoutStrategyName.AccessRange:
                return(AccessRanggeQuery.BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), SystemClassDescription.GetItemTableName("Payout"), SystemClassDescription.GetItemKeyColumnName("Payout"), SystemClassDescription.GetItemTypeColumnName("Payout"), SystemClassDescription.GetItemCreateUserColumnName("Payout")));

            case PayoutStrategyName.GroupCodeEx:
            {
                string systemGroupCode = strategy.GetParameter(0);
                switch (strategy.GetParameter(1))
                {
                case "0":
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("Payout")));

                case "1":
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("Payout")));

                case "2":
                    return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("Payout")));
                }
                return(format);
            }

            case PayoutStrategyName.AlloType:
            {
                string parameter = strategy.GetParameter(0);
                string text5     = strategy.GetParameter(1);
                switch (parameter)
                {
                case "P":
                    return(" payoutCode in ( select payoutCode from payoutItem where alloType='P' ) ");

                case "U":
                    return(string.Format(" payoutCode in ( select payoutItem.payoutCode from payoutItem,payoutItemBuilding where payoutItem.PayoutItemCode=PayoutItemBuilding.PayoutItemCode and alloType='U' and PBSUnitCode='{0}'  ) ", text5));
                }
                return(string.Format(" payoutCode in ( select payoutItem.payoutCode from payoutItem,payoutItemBuilding where payoutItem.PayoutItemCode=PayoutItemBuilding.PayoutItemCode and alloType='B' and BuildingCode='{0}'  ) ", text5));
            }

            case PayoutStrategyName.PayoutCodeIN:
                return(string.Format(" payoutcode in ({0}) ", strategy.GetParameter(0)));

            case PayoutStrategyName.IsContract:
                format = "exists (select 1 from PayoutItem i, PaymentItem mi, Payment m where i.PaymentItemCode = mi.PaymentItemCode and mi.PaymentCode = m.PaymentCode and i.PayoutCode = {0}.PayoutCode and m.IsContract = {1})";
                return(string.Format(format, "Payout", strategy.GetParameter(0)));

            case PayoutStrategyName.SubjectCodeStart:
                return(string.Format(" SubjectCode >= '{0}'", strategy.GetParameter(0)));

            case PayoutStrategyName.GreatRootCash:
                return(string.Format("rootCash>={0}", strategy.GetParameter(0)));

            case PayoutStrategyName.SmallRootCash:
                return(string.Format("rootCash<={0}", strategy.GetParameter(0)));

            case PayoutStrategyName.SubjectCodeEnd:
                return(string.Format(" SubjectCode <= '{0}'", strategy.GetParameter(0)));

            case PayoutStrategyName.BatchPayment:
                return("Payer = '成本批量请款'");

            case PayoutStrategyName.NotBatchPayment:
                return("isnull(Payer, '') <> '成本批量请款'");
            }
            return(format);
        }
Пример #10
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            CostBudgetSetStrategyName name = (CostBudgetSetStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case CostBudgetSetStrategyName.GroupCodeEx:
                {
                    string systemGroupCode = strategy.GetParameter(0);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));

                    case "1":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));

                    case "2":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("CostBudgetSet")));
                    }
                    return(text);
                }

                case CostBudgetSetStrategyName.AccessRange:
                    return(BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1)));

                case CostBudgetSetStrategyName.False:
                    return("1=2");

                case CostBudgetSetStrategyName.NoTarget:
                    return("not Exists(select * from CostBudget b where isnull(b.TargetFlag, 0) = 1 and b.CostBudgetSetCode = CostBudgetSet.CostBudgetSetCode)");

                case CostBudgetSetStrategyName.NoBudget:
                    return("not Exists(select * from CostBudget b where isnull(b.TargetFlag, 0) = 0 and b.CostBudgetSetCode = CostBudgetSet.CostBudgetSetCode)");
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Пример #11
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            DocumentStrategyName name = (DocumentStrategyName)strategy.Name;
            string text      = "";
            string parameter = "";
            string text3     = "";

            if (strategy.Type != StrategyType.Other)
            {
                return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
            }
            switch (name)
            {
            case DocumentStrategyName.DocumentTypeCode:
                return(string.Format(" exists ( select * from DocumentConfig where DocumentTypeCode='{0}' and DocumentCode = Document.DocumentCode ) ", strategy.GetParameter(0)));

            case DocumentStrategyName.DocumentTypeCodeFull:
                return(string.Format(" exists ( select * from DocumentConfig c, DocumentType t where c.DocumentTypeCode = t.DocumentTypeCode and t.FullCode like (select FullCode + '%' from DocumentType where DocumentTypeCode = '{0}') and c.DocumentCode = Document.DocumentCode ) ", strategy.GetParameter(0)));

            case DocumentStrategyName.Code:
                switch (strategy.GetParameterCount())
                {
                case 1:
                    return(string.Format(" exists ( select * from DocumentConfig where Code='{0}' and DocumentCode = Document.DocumentCode ) ", strategy.GetParameter(0)));

                case 2:
                    return(string.Format(" exists ( select * from DocumentConfig where DocumentTypeCode='{0}' and Code='{1}' and DocumentCode = Document.DocumentCode ) ", strategy.GetParameter(0), strategy.GetParameter(1)));
                }
                return(text);

            case DocumentStrategyName.RelationKey:
                parameter = strategy.GetParameter(0);
                text3     = strategy.GetParameter(1);
                switch (parameter)
                {
                case "000001":
                    return(string.Format(" exists ( select * from DocumentConfig where DocumentTypeCode='{0}' and Code in (select ContractCode from Contract where ContractID = '{1}' or ContractName like '%{1}%') and DocumentCode = Document.DocumentCode ) ", parameter, text3));

                case "000006":
                    return(string.Format(" exists ( select * from DocumentConfig where DocumentTypeCode='{0}' and Code in (select DocumentCode from Document where DocumentCode = '{1}' or Title like '%{1}%') and DocumentCode = Document.DocumentCode ) ", parameter, text3));
                }
                return(string.Format(" exists ( select * from DocumentConfig where DocumentTypeCode='{0}' and Code='{1}' and DocumentCode = Document.DocumentCode ) ", parameter, text3));

            case DocumentStrategyName.GroupCode:
                return(text);

            case DocumentStrategyName.GroupFullID:
                return(string.Format(" (GroupFullID = '{0}' or GroupFullID like '{0}-%')", strategy.GetParameter(0)));

            case DocumentStrategyName.GroupFullIDs:
            {
                text = "";
                text = text + " (";
                string[] textArray = strategy.GetParameter(0).Split(new char[] { ","[0] });
                int      num       = 0;
                foreach (string text4 in textArray)
                {
                    if (text4 != "")
                    {
                        num++;
                        if (num > 1)
                        {
                            text = text + " or";
                        }
                        text = text + string.Format(" (GroupFullID = '{0}' or GroupFullID like '{0}-%')", text4);
                    }
                }
                return(text + ")");
            }

            case DocumentStrategyName.AccessRange:
                return("(isnull(GroupCode, '') = '' or " + AccessRanggeQuery.BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), SystemClassDescription.GetItemTableName("Document"), SystemClassDescription.GetItemKeyColumnName("Document"), SystemClassDescription.GetItemTypeColumnName("Document"), SystemClassDescription.GetItemCreateUserColumnName("Document")) + ")");
            }
            return(text);
        }
Пример #12
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            ContractStrategyName name = (ContractStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case ContractStrategyName.TypeEx:
                {
                    string systemGroupCode = strategy.GetParameter(0);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("Contract")));

                    case "1":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("Contract")));

                    case "2":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("Contract")));
                    }
                    return(text);
                }

                case ContractStrategyName.Status:
                case ContractStrategyName.TotalMoney:
                case ContractStrategyName.SupplierCode:
                case ContractStrategyName.ContractPerson:
                case ContractStrategyName.ContractDate:
                case ContractStrategyName.CheckDate:
                case ContractStrategyName.ContractLabel:
                case ContractStrategyName.UnitCode:
                    return(text);

                case ContractStrategyName.OriginalContract:
                    return("ContractLabel = ContractCode");

                case ContractStrategyName.NotOriginalContract:
                    return("ContractLabel <> ContractCode");

                case ContractStrategyName.WBSCode:
                    return(string.Format(" ContractCode in ( select ContractCode from TaskContract where WBSCode='{0}' ) ", strategy.GetParameter(0)));

                case ContractStrategyName.AccessRange:
                    return(AccessRanggeQuery.BuildContractAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), SystemClassDescription.GetItemTableName("Contract"), SystemClassDescription.GetItemKeyColumnName("Contract"), SystemClassDescription.GetItemTypeColumnName("Contract"), SystemClassDescription.GetItemCreateUserColumnName("Contract")));

                case ContractStrategyName.CostBudgetSetCode:
                    return(string.Format("exists(select 1 from ContractCost left join CBS on CBS.FullCode like '%'+ContractCost.CostCode+'%' where ContractCost.CostBudgetSetCode = '{0}'and ContractCost.ContractCode = Contract.ContractCode)", strategy.GetParameter(0).Trim()));

                case ContractStrategyName.CostCode:
                    return(string.Format("exists(select 1 from ContractCost left join CBS on CBS.FullCode like '%'+ContractCost.CostCode+'%' where ContractCost.CostCode = '{0}'and ContractCost.ContractCode = Contract.ContractCode)", strategy.GetParameter(0).Trim()));

                case ContractStrategyName.FullCode:
                    return(string.Format("exists(select 1 from ContractCost left join CBS on CBS.FullCode like '%'+ContractCost.CostCode+'%' where CBS.FullCode like '{0}'and ContractCost.ContractCode = Contract.ContractCode)", strategy.GetParameter(0).Trim()));

                case ContractStrategyName.SupplierName:
                    return(string.Format("SupplierCode in (select SupplierCode from Supplier where Supplier.SupplierName like '%{0}%')", strategy.GetParameter(0).Trim()));
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }