Example #1
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            CostPlanStrategyName name = (CostPlanStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case CostPlanStrategyName.ProjectCode:
                    return(string.Format(" CostCode in ( Select CostCode from CBS where ProjectCode = '{0}' )   ", strategy.GetParameter(0)));

                case CostPlanStrategyName.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);
                }
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #2
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            TaskBudgetStrategyName name = (TaskBudgetStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case TaskBudgetStrategyName.WBSCodeEx:
                {
                    string wbsCode = strategy.GetParameter(0);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(wbsCode, TreeNodeSearchType.AllSubNodeIncludeSelf));

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

                    case "2":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(wbsCode, TreeNodeSearchType.AllSubNotLeafNode));
                    }
                    return(text);
                }

                case TaskBudgetStrategyName.CostCode:
                    return(text);

                case TaskBudgetStrategyName.CostCodeEx:
                {
                    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);
                }
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #3
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            DynamicCostStrategyName name = (DynamicCostStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case DynamicCostStrategyName.CostCodeIncludeSubNodeAndLeaf:
                    return(text);
                }
                string costCode  = 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(CBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNotLeafNode));
                    }
                }
                else
                {
                    return(CBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNodeIncludeSelf));
                }
                return(CBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubLeafNode));
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Example #4
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 #5
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            V_CBSCostStrategyName name = (V_CBSCostStrategyName)strategy.Name;
            string text = "";

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

            case V_CBSCostStrategyName.ReviseBudgetCheckCode:
                return(text);

            case V_CBSCostStrategyName.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 V_CBSCostStrategyName.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);
        }