public override string BuildSingleStrategyString(Strategy strategy)
        {
            PBSAttrItemStrategyName name = (PBSAttrItemStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case PBSAttrItemStrategyName.PBSAttrItemCodeIn:
                    return(string.Format(" PBSAttrItemCode in ( {0} )", strategy.GetParameter(0)));

                case PBSAttrItemStrategyName.AttrSetItemCodeEq:
                case PBSAttrItemStrategyName.MasterTypeEq:
                case PBSAttrItemStrategyName.MasterCodeEq:
                case PBSAttrItemStrategyName.StageEq:
                    return(text);

                case PBSAttrItemStrategyName.AttrSetItemCodeIn:
                    return(string.Format(" AttrSetItemCode in ( {0} )", strategy.GetParameter(0)));

                case PBSAttrItemStrategyName.MasterTypeIn:
                    return(string.Format(" MasterType in ( {0} )", strategy.GetParameter(0)));

                case PBSAttrItemStrategyName.MasterCodeIn:
                    return(string.Format(" MasterCode in ( {0} )", strategy.GetParameter(0)));

                case PBSAttrItemStrategyName.StageIn:
                    return(string.Format(" Stage in ( {0} )", strategy.GetParameter(0)));

                case PBSAttrItemStrategyName.FloatValueEq:
                    return(string.Format(" FloatValue = '{0}'", strategy.GetParameter(0)));
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #2
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            SystemGroupStrategyName name = (SystemGroupStrategyName)strategy.Name;

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case SystemGroupStrategyName.AllChild:
                    return(string.Format("FullID like '{0}-%'", strategy.GetParameter(0).Trim()));

                case SystemGroupStrategyName.IncludeAllChild:
                    return(string.Format("(FullID = '{0}' or FullID like '{0}-%')", strategy.GetParameter(0).Trim()));

                case SystemGroupStrategyName.ProjectName:
                    return(string.Format("(FullID like (select fullid from systemgroup where groupname='{0}' and classcode ='{1}' and deep =1) + '%')", strategy.GetParameter(0).Trim(), strategy.GetParameter(1).Trim()));

                case SystemGroupStrategyName.False:
                    return("1=2");
                }
                return("");
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
        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));
        }
Example #4
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            WorkFlowHistoryStrategyName name = (WorkFlowHistoryStrategyName)strategy.Name;

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case WorkFlowHistoryStrategyName.ActUserCode:
                    return(string.Format(" CaseCode in (select a.CaseCode from workflowact a,workflowcase b where a.casecode=b.casecode and ActUserCode='{0}')", strategy.GetParameter(0)));

                case WorkFlowHistoryStrategyName.ProcedureNameAndApplicationCodein:
                    return(string.Format(" ProcedureName+ApplicationCode in ({0})", strategy.GetParameter(0)));

                case WorkFlowHistoryStrategyName.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 WorkFlowHistoryStrategyName.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 WorkFlowHistoryStrategyName.CreateDate:
                    return(string.Format(" (CreateDate>'{0}' and CreateDate<'{1}')", strategy.GetParameter(0), strategy.GetParameter(1)));

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

                case WorkFlowHistoryStrategyName.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 WorkFlowHistoryStrategyName.ProcedureCodeIn:
                    return(string.Format(" ProcedureCode in ({0})", strategy.GetParameter(0)));
                }
                return("");
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #5
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            StyleListStrategyName name = (StyleListStrategyName)strategy.Name;

            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #6
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            CBSStrategyName name = (CBSStrategyName)strategy.Name;
            string          text = "";

            if (strategy.Type != StrategyType.Other)
            {
                return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
            }
            switch (name)
            {
            case CBSStrategyName.UserAccess:
                return(string.Format(" CostCode in ( select CostCode from CBSPerson where UserCode='{0}' ) ", strategy.GetParameter(0)));

            case CBSStrategyName.CostCodeStr:
            case CBSStrategyName.SortID:
                return(text);

            case CBSStrategyName.AllSubNodeIncludeSelf:
                return(BuildTreeNodeSearchString(strategy.GetParameter(0), TreeNodeSearchType.AllSubNodeIncludeSelf));

            case CBSStrategyName.AllSubNodeNotIncludeSelf:
                return(BuildTreeNodeSearchString(strategy.GetParameter(0), TreeNodeSearchType.AllSubNodeNotIncludeSelf));

            case CBSStrategyName.FirstChildNode:
                return(BuildTreeNodeSearchString(strategy.GetParameter(0), TreeNodeSearchType.FirstChildNode));

            case CBSStrategyName.AllSubLeafNode:
                return(BuildTreeNodeSearchString(strategy.GetParameter(0), TreeNodeSearchType.AllSubLeafNode));

            case CBSStrategyName.AllSubNotLeafNode:
                return(BuildTreeNodeSearchString(strategy.GetParameter(0), TreeNodeSearchType.AllSubNotLeafNode));

            case CBSStrategyName.AccessRange:
            {
                string parameter = strategy.GetParameter(1);
                string text3     = strategy.GetParameter(2);
                string text4     = "";
                foreach (string text5 in text3.Split(new char[] { ',' }))
                {
                    if (text4 != "")
                    {
                        text4 = text4 + ",";
                    }
                    text4 = text4 + "'" + text5 + "'";
                }
                string text6 = "";
                if (text4.Length == 0)
                {
                    text6 = string.Format(" ( AccessRangeType=0 and relationCode = '{0}' )   ", parameter);
                }
                else
                {
                    text6 = string.Format(" (( AccessRangeType=0 and relationCode = '{0}' ) or ( AccessRangeType=1 and relationCode in ( {1} ) ))  ", parameter, text4);
                }
                QueryAgent agent       = new QueryAgent();
                string     queryString = string.Format("select distinct( cbs.FullCode ) from cbs,accessRange where operationCode = '{0}' and cbs.costCode = accessRange.ResourceCode and ( {1} )", strategy.GetParameter(0), text6);
                DataSet    set         = agent.ExecSqlForDataSet(queryString);
                agent.Dispose();
                if (set.Tables[0].Rows.Count > 0)
                {
                    text = "";
                    foreach (DataRow row in set.Tables[0].Rows)
                    {
                        string text8 = row["FullCode"].ToString();
                        if (text != "")
                        {
                            text = text + " or ";
                        }
                        text = text + string.Format("( FullCode like '{0}%' )", text8);
                    }
                    text = "( " + text + ")";
                }
                else
                {
                    text = " 1=1 ";
                }
                set.Dispose();
                return(text);
            }
            }
            return(text);
        }
Example #7
0
        /// <summary>
        /// 生成SQL语句
        /// </summary>
        /// <param name="strategy"></param>
        /// <returns></returns>
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            UserStrategyName name = (UserStrategyName)strategy.Name;
            string           text = "";

            if (strategy.Type == StrategyType.Other)
            {
                string text2        = "";
                string unitFullCode = "";
                string text4        = "";
                string text5        = "";
                string parameter    = "";
                switch (name)
                {
                case UserStrategyName.UserCodes:
                    return(string.Format(" UserCode in ( {0} )", strategy.GetParameter(0)));

                case UserStrategyName.UsersAndStations:
                    parameter = strategy.GetParameter(0);
                    text5     = strategy.GetParameter(1);
                    return(string.Format(" (  ( UserCode in ( {0} ) ) or   exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and UserRole.StationCode in ( {1} )  ) ) ", parameter, text5));

                case UserStrategyName.UserID:
                case UserStrategyName.UserName:
                case UserStrategyName.PassWord:
                case UserStrategyName.OwnName:
                case UserStrategyName.Status:
                case UserStrategyName.Sex:
                case UserStrategyName.SortID:
                    return(text);

                case UserStrategyName.StationCode:
                {
                    string text7 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and UserRole.StationCode ='{0}'  )  ", text7));
                }

                case UserStrategyName.StationCodes:
                    text5 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and UserRole.StationCode in ( {0} )  )  ", text5));

                case UserStrategyName.NoStation:
                    return(" not exists (select * from UserRole where UserRole.UserCode = SystemUser.UserCode)");

                case UserStrategyName.RoleCode:
                    text4 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and Station.RoleCode='{0}' ) ) ", strategy.GetParameter(0)));

                case UserStrategyName.ProjectCode:
                    unitFullCode = OBSDAO.GetUnitFullCode(ProjectDAO.GetProjectUnitCode(strategy.GetParameter(0)));
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and exists (  select 1 from Unit where Station.UnitCode=Unit.UnitCode and Unit.FullCode like '{0}%' ) ) )  ", unitFullCode));

                case UserStrategyName.UnitCodeEx:
                    unitFullCode = OBSDAO.GetUnitFullCode(strategy.GetParameter(0));
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and exists (  select 1 from Unit where Station.UnitCode=Unit.UnitCode and Unit.FullCode like '{0}%' ) ) )  ", unitFullCode));

                case UserStrategyName.UnitCode:
                    text2 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and Station.UnitCode='{0}' ) )  ", text2));

                case UserStrategyName.WBSCode:
                    return(string.Format(" exists (select * from TaskPerson where TaskPerson.UserCode = [SystemUser].UserCode and TaskPerson.WBSCode ='{0}' and Type = 2 )", strategy.GetParameter(0)));

                case UserStrategyName.UserIdorUserName:
                    return(string.Format(" ( userid ='{0}' or username='******' )", Strategy.ReplaceSingleQuote(strategy.GetParameter(0))));
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #8
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            V_DesktopStrategyName name = (V_DesktopStrategyName)strategy.Name;

            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #9
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            PaymentItemStrategyName name = (PaymentItemStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case PaymentItemStrategyName.AllocateCodeKeyIn:
                    return(string.Format(" AllocateCode in ( {0} ) ", strategy.GetParameter(0)));

                case PaymentItemStrategyName.CostCodeIncludeSubNodeAndLeaf:
                {
                    string costCode = strategy.GetParameter(0);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(CBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNodeIncludeSelf));

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

                    case "2":
                        return(CBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNotLeafNode));
                    }
                    return(text);
                }

                case PaymentItemStrategyName.IsPayout:
                    switch (strategy.GetParameter(0))
                    {
                    case "0":
                        return(" isnull(TotalPayoutMoney, 0) = 0");

                    case "1":
                        return(" isnull(TotalPayoutMoney, 0) > 0 and isnull(TotalPayoutMoney, 0) < isnull(Money, 0)");

                    case "2":
                        return(" isnull(TotalPayoutMoney, 0) >= isnull(Money, 0)");

                    case "1,2":
                        return(" isnull(TotalPayoutMoney, 0) > 0");

                    case "0,1":
                        return(" isnull(TotalPayoutMoney, 0) < isnull(Money, 0)");
                    }
                    return(text);

                case PaymentItemStrategyName.ContractCostCashCode:
                case PaymentItemStrategyName.PBSType:
                case PaymentItemStrategyName.PBSCode:
                    return(text);

                case PaymentItemStrategyName.MaxIssue:
                    return(string.Format("Issue <= {0}", strategy.GetParameter(0).Trim()));

                case PaymentItemStrategyName.MinIssue:
                    return(string.Format("Issue >= {0}", strategy.GetParameter(0).Trim()));

                case PaymentItemStrategyName.SubjectCode:
                    return(string.Format("exists (select * from CBS c where c.CostCode = PaymentItem.CostCode and c.SubjectCode = '{0}')", strategy.GetParameter(0)));

                case PaymentItemStrategyName.SubjectCodeIncludeAllChild:
                    return(string.Format("exists (select * from CBS c where c.CostCode = PaymentItem.CostCode and c.SubjectCode like '{0}%')", strategy.GetParameter(0)));
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #10
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 + ") ");
        }
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            OADocumentClassStrategyName name = (OADocumentClassStrategyName)strategy.Name;

            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #12
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);
        }
Example #13
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));
        }
Example #14
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);
        }
Example #15
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);
        }
Example #16
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));
        }