public override string BuildSingleStrategyString(Strategy strategy) { BudgetStrategyName name = (BudgetStrategyName)strategy.Name; if (strategy.Type == StrategyType.Other) { switch (name) { case BudgetStrategyName.AccessRange: return(""); } return(AccessRanggeQuery.BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1), strategy.GetParameter(2), "Budget", "BudgetCode", "MakePerson")); } return(StandardStrategyStringBuilder.BuildStrategyString(strategy)); }
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); }
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)); }