public Operator defineOperator(string name, Types result_type, Types operand_types) { if (null == name) name = ".O"+m_code.operators.Count; Operator op = new Operator(name, result_type, operand_types); m_code.operators.Add(op); return op; }
private static void InsertBinaryOperationMethod(Core core, ProtoCore.AST.Node root, Operator op, PrimitiveType r, PrimitiveType op1, PrimitiveType op2, int retRank = 0, int op1rank = 0, int op2rank = 0) { ProtoCore.AST.AssociativeAST.FunctionDefinitionNode funcDefNode = new ProtoCore.AST.AssociativeAST.FunctionDefinitionNode(); funcDefNode.access = ProtoCore.DSASM.AccessSpecifier.kPublic; funcDefNode.IsAssocOperator = true; funcDefNode.IsBuiltIn = true; funcDefNode.Name = Op.GetOpFunction(op); funcDefNode.ReturnType = new ProtoCore.Type() { Name = core.TypeSystem.GetType((int)r), UID = (int)r, rank = retRank}; ProtoCore.AST.AssociativeAST.ArgumentSignatureNode args = new ProtoCore.AST.AssociativeAST.ArgumentSignatureNode(); args.AddArgument(new ProtoCore.AST.AssociativeAST.VarDeclNode() { memregion = ProtoCore.DSASM.MemoryRegion.kMemStack, access = ProtoCore.DSASM.AccessSpecifier.kPublic, NameNode = BuildAssocIdentifier(core, ProtoCore.DSASM.Constants.kLHS), ArgumentType = new ProtoCore.Type { Name = core.TypeSystem.GetType((int)op1), UID = (int)op1, rank = op1rank} }); args.AddArgument(new ProtoCore.AST.AssociativeAST.VarDeclNode() { memregion = ProtoCore.DSASM.MemoryRegion.kMemStack, access = ProtoCore.DSASM.AccessSpecifier.kPublic, NameNode = BuildAssocIdentifier(core, ProtoCore.DSASM.Constants.kRHS), ArgumentType = new ProtoCore.Type { Name = core.TypeSystem.GetType((int)op2), UID = (int)op2, rank = op2rank} }); funcDefNode.Signature = args; ProtoCore.AST.AssociativeAST.CodeBlockNode body = new ProtoCore.AST.AssociativeAST.CodeBlockNode(); ProtoCore.AST.AssociativeAST.IdentifierNode _return = BuildAssocIdentifier(core, ProtoCore.DSDefinitions.Keyword.Return, ProtoCore.PrimitiveType.kTypeReturn); ProtoCore.AST.AssociativeAST.IdentifierNode lhs = BuildAssocIdentifier(core, ProtoCore.DSASM.Constants.kLHS); ProtoCore.AST.AssociativeAST.IdentifierNode rhs = BuildAssocIdentifier(core, ProtoCore.DSASM.Constants.kRHS); body.Body.Add(new ProtoCore.AST.AssociativeAST.BinaryExpressionNode() { LeftNode = _return, Optr = ProtoCore.DSASM.Operator.assign, RightNode = new ProtoCore.AST.AssociativeAST.BinaryExpressionNode() { LeftNode = lhs, RightNode = rhs, Optr = op } }); funcDefNode.FunctionBody = body; (root as ProtoCore.AST.AssociativeAST.CodeBlockNode).Body.Add(funcDefNode); }
public CalculationAdded(Guid id, Guid calculationId, Operator @operator, double operand) { Id = id; CalculationId = calculationId; Operator = @operator; Operand = operand; }
public static Boolean Evaluate(Object state, ref Boolean error, Operator @operator, String text) { Combat.Character character = state as Combat.Character; if (character == null) { error = true; return false; } String authorname = character.BasePlayer.Profile.Author; if (authorname == null) { error = true; return false; } Boolean result = String.Equals(authorname, text, StringComparison.OrdinalIgnoreCase); switch (@operator) { case Operator.Equals: return result; case Operator.NotEquals: return !result; default: error = true; return false; } }
internal UnsafeAccessExpression(CsTokenList tokens, Operator operatorType, Expression value) : base(ExpressionType.UnsafeAccess, tokens) { this.operatorType = operatorType; this.value = value; base.AddExpression(value); }
public CreateRoleCommand(Operator user, RoleKey key, string name, string description) { Operator = user; Key = key; Name = name; Description = description; }
public Binary(SourceSpan span, Operator op, Expression left, Expression right) : base(span) { _op = op; _left = left; _right = right; }
public CustomVariable(ConfigNode node) { name = node.GetValue("name"); foreach (ConfigNode sourceVarNode in node.GetNodes("SOURCE_VARIABLE")) { SourceVariable sourceVar = new SourceVariable(sourceVarNode); sourceVariables.Add(sourceVar); } if(sourceVariables.Count == 0) { throw new ArgumentException("Did not find any SOURCE_VARIABLE nodes in RPM_CUSTOM_VARIABLE", name); } string oper = node.GetValue("operator"); if (oper == Operator.NONE.ToString()) { op = Operator.NONE; } else if (oper == Operator.AND.ToString()) { op = Operator.AND; } else if (oper == Operator.OR.ToString()) { op = Operator.OR; } else if (oper == Operator.XOR.ToString()) { op = Operator.XOR; } else { throw new ArgumentException("Found an invalid operator type in RPM_CUSTOM_VARIABLE", oper); } }
public static string GetName(Operator type) { string result = String.Empty; switch (type) { case Operator.Equal: result = "=="; break; case Operator.GreaterThan: result = ">"; break; case Operator.GreaterThanEqual: result = ">="; break; case Operator.LessThan: result = "<"; break; case Operator.LessThanEqual: result = "<="; break; case Operator.NotEqual: result = "!="; break; } return result; }
public static void Main(string[] args) { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); Document doc = new Document(dataDir+ "input.pdf"); Page page = doc.Pages[2]; OperatorCollection oc = page.Contents; // used path-painting operators Operator[] operators = new Operator[] { new Operator.Stroke(), new Operator.ClosePathStroke(), new Operator.Fill() }; ArrayList list = new ArrayList(); foreach (Operator op in operators) { OperatorSelector os = new OperatorSelector(op); oc.Accept(os); list.AddRange(os.Selected); } oc.Delete(list); doc.Save(dataDir+ "No_Graphics.pdf"); }
public SimpleSelectNode(IQueryPlanNode child, ObjectName leftVar, Operator op, Expression rightExpression) : base(child) { this.leftVar = leftVar; this.op = op; this.rightExpression = rightExpression; }
// tests building and pretty-printing static void test1() { Template t = new Template(); t.Add("a", ClassType.mark.PLUS); t.Add("b", ClassType.mark.MINUS); t.Add("c", ClassType.mark.HASH); Template t2 = new Template(); t2.Add("a", ClassType.mark.PLUS); t2.Add("b", ClassType.mark.MINUS); t2.Add("c", ClassType.mark.MINUS); Scheme s = new Scheme(); s.Add(t); s.Add(t2); Scheme s2 = new Scheme(); Offering o = new Offering(1, 1); o.addInputScheme(1, s); o.addOutputScheme(1, s2); o.addFeedbackInputScheme(1, Scheme.SchemeAsAny()); o.addFeedbackOutputScheme(1, Scheme.SchemeAsAny()); Operator op = new Operator("SELECT", 1, 1); op.AddOffering(o); op.AddOffering(o); Console.WriteLine(op.ToString()); Console.ReadLine(); }
/*cmpXslt:*/ static bool cmpQueryQueryE(Operator.Op op, object val1, object val2) { Debug.Assert(op == Operator.Op.EQ || op == Operator.Op.NE); bool isEQ = (op == Operator.Op.EQ); NodeSet n1 = new NodeSet(val1); NodeSet n2 = new NodeSet(val2); while (true) { if (! n1.MoveNext()) { return false; } if (! n2.MoveNext()) { return false; } string str1 = n1.Value; do { if ((str1 == n2.Value) == isEQ) { return true; } }while (n2.MoveNext()); n2.Reset(); } }
private static IMongoQuery CreateFilter(ModelInfo.SearchParamDefinition parameter, Operator op, String modifier, Expression operand) { if (op == Operator.CHAIN) { throw new NotSupportedException("Chain operators should be handled in MongoSearcher."); } else // There's only one operand. { var valueOperand = (ValueExpression)operand; switch (parameter.Type) { case Conformance.SearchParamType.Composite: return CompositeQuery(parameter, op, modifier, valueOperand); case Conformance.SearchParamType.Date: return DateQuery(parameter.Name, op, modifier, valueOperand); case Conformance.SearchParamType.Number: return NumberQuery(parameter.Name, op, valueOperand); case Conformance.SearchParamType.Quantity: return QuantityQuery(parameter.Name, op, modifier, valueOperand); case Conformance.SearchParamType.Reference: //Chain is handled in MongoSearcher, so here we have the result of a closed criterium: IN [ list of id's ] return StringQuery(parameter.Name, op, modifier, valueOperand); case Conformance.SearchParamType.String: return StringQuery(parameter.Name, op, modifier, valueOperand); case Conformance.SearchParamType.Token: return TokenQuery(parameter.Name, op, modifier, valueOperand); default: //return M.Query.Null; throw new NotSupportedException("Only SearchParamType.Number or String is supported."); } } }
private Calculation(Column column, Guid id, double operand, Operator @operator) { _column = column; Id = id; Operand = operand; Operator = @operator; }
public void AddOperator(Operator op, bool serialize = true) { Operators.Add(op.GUID, op); if (serialize) { TemplateSerializer.Serialize(this); } }
public void Connect(Operator outOp, IOOutlet output, Operator inOp, IOOutlet input, bool serialize = true) { Connections.Add(new IOConnection() { From=outOp, Output=output, To=inOp, Input=input }); if (serialize) { TemplateSerializer.Serialize(this); } }
public static Boolean Evaluate(Object state, ref Boolean error, Operator @operator, xnaMugen.MoveType movetype) { Combat.Character character = state as Combat.Character; if (character == null) { error = true; return false; } if (movetype == xnaMugen.MoveType.Unchanged || movetype == xnaMugen.MoveType.None) { error = true; return false; } switch (@operator) { case Operator.Equals: return movetype == character.MoveType; case Operator.NotEquals: return movetype != character.MoveType; default: error = true; return false; } }
public ComputedCell(Cell lhs, Operator op, Cell rhs) { if (rhs == null) throw new ArgumentNullException("rhs"); _lhs = lhs; _op = op; _rhs = rhs; }
public HistoryReadModelTests() { _model = new HistoryReadModel(); _user1 = new Operator { Name = "Andy Dote" }; _user2 = new Operator { Name = "John Wick" }; }
public RequiredIfAttribute(string dependentProperty, Operator @operator, object dependentValue) : base(dependentProperty) { Operator = @operator; DependentValue = dependentValue; Metadata = OperatorMetadata.Get(Operator); }
public static Boolean Evaluate(Object state, ref Boolean error, Operator @operator, xnaMugen.StateType statetype) { Combat.Character character = state as Combat.Character; if (character == null) { error = true; return false; } Combat.Player opponent = character.GetOpponent(); if (opponent == null) { error = true; return false; } if (statetype == xnaMugen.StateType.Unchanged || statetype == xnaMugen.StateType.None) { error = true; return false; } switch (@operator) { case Operator.Equals: return statetype == opponent.StateType; case Operator.NotEquals: return statetype != opponent.StateType; default: error = true; return false; } }
private static void InsertBinaryOperationMethod(Core core, CodeBlockNode root, Operator op, PrimitiveType r, PrimitiveType op1, PrimitiveType op2, int retRank = 0, int op1rank = 0, int op2rank = 0) { FunctionDefinitionNode funcDefNode = new FunctionDefinitionNode(); funcDefNode.access = CompilerDefinitions.AccessModifier.kPublic; funcDefNode.IsAssocOperator = true; funcDefNode.IsBuiltIn = true; funcDefNode.Name = Op.GetOpFunction(op); funcDefNode.ReturnType = new Type() { Name = core.TypeSystem.GetType((int)r), UID = (int)r, rank = retRank }; ArgumentSignatureNode args = new ArgumentSignatureNode(); args.AddArgument(new VarDeclNode() { Access = CompilerDefinitions.AccessModifier.kPublic, NameNode = AstFactory.BuildIdentifier(DSASM.Constants.kLHS), ArgumentType = new Type { Name = core.TypeSystem.GetType((int)op1), UID = (int)op1, rank = op1rank } }); args.AddArgument(new VarDeclNode() { Access = CompilerDefinitions.AccessModifier.kPublic, NameNode = AstFactory.BuildIdentifier(DSASM.Constants.kRHS), ArgumentType = new Type { Name = core.TypeSystem.GetType((int)op2), UID = (int)op2, rank = op2rank } }); funcDefNode.Signature = args; CodeBlockNode body = new CodeBlockNode(); var lhs = AstFactory.BuildIdentifier(DSASM.Constants.kLHS); var rhs = AstFactory.BuildIdentifier(DSASM.Constants.kRHS); var binaryExpr = AstFactory.BuildBinaryExpression(lhs, rhs, op); body.Body.Add(AstFactory.BuildReturnStatement(binaryExpr)); funcDefNode.FunctionBody = body; root.Body.Add(funcDefNode); }
public string BuildSelectSqlFor(string tableName, string[] fields, string[] filterFields, Operator[] filterOperators, string[] filterValues, string[] orders, int limitResultSet) { string sql = "select "; if (limitResultSet > 0) sql += "top " + limitResultSet + " "; if (ArrayHelper.IsNull(fields)) sql += "*"; else sql += string.Join(", ", fields); sql += " from " + tableName + " "; if (!ArrayHelper.IsNull(filterFields)) { sql += "where "; for (int i = 0; i < filterFields.Length; i++) { if (i > 0) sql += " and "; sql += filterFields[i] + " " + OperatorString(filterOperators[i], filterValues[i]); } } if (!ArrayHelper.IsNull(orders)) { sql += " order by "; sql += string.Join(", ", orders); } return sql; }
internal QueryExpression(string FieldName, Operator Operator, Guid Value) { this.Type = ExpressionType.String; this.FieldName = FieldName; this.Operator = Operator; this.Value = Value.ToString(); }
public static IMongoQuery ExpressionQuery(string name, Operator optor, BsonValue value) { switch (optor) { case Operator.EQ: return M.Query.EQ(name, value); case Operator.GT: return M.Query.GT(name, value); case Operator.GTE: return M.Query.GTE(name, value); case Operator.ISNULL: return M.Query.EQ(name, null); case Operator.LT: return M.Query.LT(name, value); case Operator.LTE: return M.Query.LTE(name, value); case Operator.NOTNULL: return M.Query.NE(name, null); default: throw new ArgumentException(String.Format("Invalid operator {0} on token parameter {1}", optor.ToString(), name)); } }
public Delete(string table, Operator where, bool allowMultiple) { Table.Name = table; AllowMultiple = allowMultiple; Where = where; Filter = FilterType.Where; }
public void ProcessOperator(Operator op) { if (ProcessOperatorObject != null) ProcessOperatorObject(op); foreach (var obj in op.Children) obj.AcceptVisitor(this); }
private void ExecuteLastOperator(Operator newOperator) { decimal currentValue = Convert.ToDecimal(textBoxDisplay.Text); decimal newValue = currentValue; if (numberHitSinceLastOperator) { switch (lastOperator) { case Operator.Plus: newValue = valueSoFar + currentValue; break; case Operator.Minus: newValue = valueSoFar - currentValue; break; case Operator.Times: newValue = valueSoFar * currentValue; break; case Operator.Divide: if (currentValue == 0) newValue = 0; else newValue = valueSoFar / currentValue; break; case Operator.Equals: newValue = currentValue; break; } } valueSoFar = newValue; lastOperator = newOperator; numberHitSinceLastOperator = false; textBoxDisplay.Text = valueSoFar.ToString(); }
public override Object PerformOperation(Executer exec, Operator op, Object otherTerm) { if (op == null) return this; this.CheckOperation(op); string sReturn = ""; string sThis = (string)this.GetUnboxed(exec); string sOther = otherTerm.GetUnboxed(exec).ToString(); switch (op.InternalTokens) { case "+": sReturn = sThis + sOther; break; case "-": sReturn = sThis.Replace(sOther, ""); break; case "*": for (int i = Convert.ToInt32(sOther)-1; i>=0; i--) sReturn+=sThis; break; } //this.m_value = sReturn; //return this; return Types.Object.CreateType(sReturn); }
/// <summary> /// 在隐患登记中选择检查记录进行关联 /// </summary> /// <param name="recId">安全检查记录Id</param> /// <param name="user"></param> /// <returns></returns> public string GetRecordFromHT(string recId, Operator user) { return(service.GetRecordFromHT(recId, user)); }
public DataTable GetSafeCheckWarning(Operator user, string mode = "0") { return(service.GetSafeCheckWarning(user, mode)); }
public DataTable GetSaftyCheckDataList(string safeCheckTypeId, long status, Operator user, string deptCode, long page, long size, out int total, string startTime, string endTime) { return(service.GetSaftyCheckDataList(safeCheckTypeId, status, user, deptCode, page, size, out total, startTime, endTime)); }
/// <summary> /// 选择检查人员 /// </summary> public DataTable selectCheckPerson(Operator user) { return(service.selectCheckPerson(user)); }
/// <summary> /// 新增日常检查计划 /// </summary> public int addDailySafeCheck(SaftyCheckDataRecordEntity se, Operator user) { return(service.addDailySafeCheck(se, user)); }
public IEnumerable <SaftyCheckDataRecordEntity> GetSaftyDataList(string safeCheckTypeId, string searchString, Operator user, string deptCode, int page, int size, out int total) { return(service.GetSaftyDataList(safeCheckTypeId, searchString, user, deptCode, page, size, out total)); }
/// <summary> /// 获取列表 /// </summary> /// <param name="safeCheckTypeId">检查类型</param> /// <param name="searchString">检查记录名称</param> /// <returns>返回分页列表</returns> public IEnumerable <SaftyCheckDataRecordEntity> GetSaftyDataList(string safeCheckTypeId, string searchString, Operator user, string deptCode = "") { return(service.GetSaftyDataList(safeCheckTypeId, searchString, user)); }
public OperatorLuceneASTNode(LuceneASTNodeBase leftNode, LuceneASTNodeBase rightNode, Operator op, bool isDefaultOperatorAnd) { var rightHandBooleanNode = rightNode as OperatorLuceneASTNode; //This basically say that if we have a nested boolean query and the child boolean is not an OR operation do nothing special. if (rightHandBooleanNode == null || rightHandBooleanNode.Op == Operator.AND || rightHandBooleanNode.Op == Operator.INTERSECT || (rightHandBooleanNode.Op == Operator.Implicit && isDefaultOperatorAnd)) { LeftNode = leftNode; RightNode = rightNode; Op = op; } //if we are in this case we are a boolean query with a child who is a boolean query with an OR operator . //we shall roll the nodes so (A) and (B or C) will become (A and b) or (C). else { LeftNode = new OperatorLuceneASTNode(leftNode, rightHandBooleanNode.LeftNode, op, isDefaultOperatorAnd); RightNode = rightHandBooleanNode.RightNode; Op = Operator.OR; //this should not be used but if it does a NRE exception will be thrown and it would be easy to locate it. rightHandBooleanNode.RightNode = null; rightHandBooleanNode.LeftNode = null; } }
private static bool ShouldInvertBoolean(Operator op) { return((op == Operator.NotEqual) || (op == Operator.GreaterOrEqual) || (op == Operator.Greater)); }
/// <summary> /// 根据检查对象和检查内容名称获取检查内容ID和检查对象ID(中间用逗号分隔,依次为检查内容ID、检查对象ID),当无匹配时返回空字符串 /// </summary> /// <param name="chkId">检查记录Id</param> /// <param name="checkObject">检查对象名称</param> /// <param name="checkContent">检查内容名称</param> /// <param name="user">当前用户</param> /// <returns></returns> public string GetCheckContentId(string chkId, string checkObject, string checkContent, Operator user) { string id = ""; DepartmentBLL deptBll = new DepartmentBLL(); if (string.IsNullOrWhiteSpace(checkObject) && string.IsNullOrWhiteSpace(checkContent)) { id = GetRecordFromHT(chkId, user); } else { string sql = string.Format("select id from BIS_SAFTYCHECKDATADETAILED where recid='{2}' and checkobject='{0}' and checkcontent='{1}'", checkObject.Trim(), checkContent.Trim(), chkId); SaftyCheckDataRecordEntity sd = GetEntity(chkId); if (sd != null) { if (sd.CheckDataType != 1) { sql += string.Format(" and (',' || checkmanid || ',') like '%,{0},%'", user.Account); } } DataTable dt = deptBll.GetDataTable(sql); if (dt.Rows.Count > 0) { id = dt.Rows[0][0].ToString(); DataTable dtItem = deptBll.GetDataTable(string.Format("select id from BIS_SAFTYCONTENT where checkobject='{0}' and detailid='{1}' and recid='{2}'", checkObject.Trim(), id, chkId)); if (dtItem.Rows.Count > 0) { id = ""; } } } if (!string.IsNullOrWhiteSpace(id)) { DataTable dt = deptBll.GetDataTable(string.Format("select checkobjectid from BIS_SAFTYCHECKDATADETAILED where id='{0}' and recid='{1}'", id, chkId)); if (dt.Rows.Count > 0) { id += "," + dt.Rows[0][0].ToString(); } } return(id); }
private static Node PrioritizeRightAssociative(Node nodes, ScriptLoadingContext lcontext, Operator operatorsToFind) { Node last; for (last = nodes; last.Next != null; last = last.Next) { } for (var n = last; n != null; n = n.Prev) { var o = n.Op; if ((o & operatorsToFind) != 0) { n.Op = Operator.NotAnOperator; n.Expr = new BinaryOperatorExpression(n.Prev.Expr, n.Next.Expr, o, lcontext); n.Prev = n.Prev.Prev; n.Next = n.Next.Next; if (n.Next != null) { n.Next.Prev = n; } if (n.Prev != null) { n.Prev.Next = n; } else { nodes = n; } } } return(nodes); }
private bool EvalComparison(DynValue l, DynValue r, Operator op) { switch (op) { case Operator.Less: if (l.Type == DataType.Number && r.Type == DataType.Number) { return(l.Number < r.Number); } else if (l.Type == DataType.String && r.Type == DataType.String) { return(l.String.CompareTo(r.String) < 0); } else { throw new DynamicExpressionException("Attempt to compare non-numbers, non-strings."); } case Operator.LessOrEqual: if (l.Type == DataType.Number && r.Type == DataType.Number) { return(l.Number <= r.Number); } else if (l.Type == DataType.String && r.Type == DataType.String) { return(l.String.CompareTo(r.String) <= 0); } else { throw new DynamicExpressionException("Attempt to compare non-numbers, non-strings."); } case Operator.Equal: if (ReferenceEquals(r, l)) { return(true); } else if (r.Type != l.Type) { if ((l.Type == DataType.Nil && r.Type == DataType.Void) || (l.Type == DataType.Void && r.Type == DataType.Nil)) { return(true); } return(false); } else { return(r.Equals(l)); } case Operator.Greater: return(!this.EvalComparison(l, r, Operator.LessOrEqual)); case Operator.GreaterOrEqual: return(!this.EvalComparison(l, r, Operator.Less)); case Operator.NotEqual: return(!this.EvalComparison(l, r, Operator.Equal)); default: throw new DynamicExpressionException("Unsupported operator {0}", op); } }
private LinkedList <Token> GenerateTokens() { string[] lines = sourceString.SplitAndKeep(new[] { '\r', '\n' }).ToArray(); string[] temp; List <string> list = new List <string>(); foreach (string line in lines) { list.AddRange(line.Split('\t', ' ')); } temp = list.ToArray(); temp = temp.Where(x => !String.IsNullOrEmpty(x)).ToArray(); tokenStrings = new LinkedList <string>(temp); currentTokenString = tokenStrings.First; nextTokenString = currentTokenString.Next; previousTokenString = currentTokenString.Previous; while (currentTokenString != null) { Token token = new GenericToken(currentTokenString.Value); if (token.isOperator()) { Operator op = new Operator(currentTokenString.Value); op.Type = op.DetectType(); tokens.AddLast(new LinkedListNode <Token>(op)); } else if (token.isKeyword()) { Keyword keyword = new Keyword(currentTokenString.Value); keyword.Type = keyword.DetectType(); tokens.AddLast(new LinkedListNode <Token>(keyword)); } else if (token.isType()) { Typename typename = new Typename(currentTokenString.Value); typename.Type = typename.DetectType(); tokens.AddLast(new LinkedListNode <Token>(typename)); } else { token.Type = token.DetectType(); if ((EnumTokenType)token.Type == EnumTokenType.STRING) { StringLiteral literal = new StringLiteral(currentTokenString.Value); literal.Type = EnumTokenType.STRING_LITERAL; while (!literal.Value.EndsWith("\"")) { currentTokenString = nextTokenString; nextTokenString = currentTokenString.Next; if (currentTokenString.Value == null) { ThrowError(EnumErrorCodes.STRING_NOT_TETMINATED, "\""); return(null); } literal.Value += " " + currentTokenString.Value; } tokens.AddLast(new LinkedListNode <Token>(literal)); } else if ((EnumTokenType)token.Type == EnumTokenType.NUMBER) { NumericLiteral literal = new NumericLiteral(currentTokenString.Value); literal.Type = EnumTokenType.NUMERIC_LITERAL; tokens.AddLast(new LinkedListNode <Token>(literal)); } else { tokens.AddLast(new LinkedListNode <Token>(token)); } } currentTokenString = nextTokenString; if (nextTokenString != null) { nextTokenString = currentTokenString.Next; } if (previousTokenString != null) { previousTokenString = currentTokenString.Previous; } } return(tokens); }
private BinaryOperatorExpression(Expression exp1, Expression exp2, Operator op, ScriptLoadingContext lcontext) : base(lcontext) { m_Exp1 = exp1; m_Exp2 = exp2; m_Operator = op; }
public static bool operator !=(EqualsOrSubtypeClass left, EqualsOrSubtypeClass right) => Operator.Weave(left, right);
private static Node PrioritizeLeftAssociative(Node nodes, ScriptLoadingContext lcontext, Operator operatorsToFind) { for (var N = nodes; N != null; N = N.Next) { var o = N.Op; if ((o & operatorsToFind) != 0) { N.Op = Operator.NotAnOperator; N.Expr = new BinaryOperatorExpression(N.Prev.Expr, N.Next.Expr, o, lcontext); N.Prev = N.Prev.Prev; N.Next = N.Next.Next; if (N.Next != null) { N.Next.Prev = N; } if (N.Prev != null) { N.Prev.Next = N; } else { nodes = N; } } } return(nodes); }
public RpnItemOperator(Operator op) { Operator = op; }
public PredefinedMembers (ModuleContainer module) { var types = module.PredefinedTypes; var atypes = module.PredefinedAttributes; var btypes = module.Compiler.BuiltinTypes; var tp = new TypeParameter (0, new MemberName ("T"), null, null, Variance.None); ActivatorCreateInstance = new PredefinedMember<MethodSpec> (module, types.Activator, MemberFilter.Method ("CreateInstance", 1, ParametersCompiled.EmptyReadOnlyParameters, null)); AsyncTaskMethodBuilderCreate = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder, MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, types.AsyncTaskMethodBuilder.TypeSpec)); AsyncTaskMethodBuilderSetResult = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder, MemberFilter.Method ("SetResult", 0, ParametersCompiled.EmptyReadOnlyParameters, btypes.Void)); AsyncTaskMethodBuilderSetStateMachine = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder, "SetStateMachine", MemberKind.Method, () => new[] { types.IAsyncStateMachine.TypeSpec }, btypes.Void); AsyncTaskMethodBuilderSetException = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder, MemberFilter.Method ("SetException", 0, ParametersCompiled.CreateFullyResolved (btypes.Exception), btypes.Void)); AsyncTaskMethodBuilderOnCompleted = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder, MemberFilter.Method ("AwaitOnCompleted", 2, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.REF) }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (1, tp, SpecialConstraint.None, Variance.None, null) }, false), btypes.Void)); AsyncTaskMethodBuilderOnCompletedUnsafe = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder, MemberFilter.Method ("AwaitUnsafeOnCompleted", 2, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.REF) }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (1, tp, SpecialConstraint.None, Variance.None, null) }, false), btypes.Void)); AsyncTaskMethodBuilderStart = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder, MemberFilter.Method ("Start", 1, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), }, false), btypes.Void)); AsyncTaskMethodBuilderTask = new PredefinedMember<PropertySpec> (module, types.AsyncTaskMethodBuilder, MemberFilter.Property ("Task", null)); AsyncTaskMethodBuilderGenericCreate = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric, MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, types.AsyncVoidMethodBuilder.TypeSpec)); AsyncTaskMethodBuilderGenericSetResult = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric, "SetResult", MemberKind.Method, () => new TypeSpec[] { types.AsyncTaskMethodBuilderGeneric.TypeSpec.MemberDefinition.TypeParameters[0] }, btypes.Void); AsyncTaskMethodBuilderGenericSetStateMachine = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric, "SetStateMachine", MemberKind.Method, () => new[] { types.IAsyncStateMachine.TypeSpec }, btypes.Void); AsyncTaskMethodBuilderGenericSetException = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric, MemberFilter.Method ("SetException", 0, ParametersCompiled.CreateFullyResolved (btypes.Exception), btypes.Void)); AsyncTaskMethodBuilderGenericOnCompleted = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric, MemberFilter.Method ("AwaitOnCompleted", 2, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.REF) }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (1, tp, SpecialConstraint.None, Variance.None, null) }, false), btypes.Void)); AsyncTaskMethodBuilderGenericOnCompletedUnsafe = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric, MemberFilter.Method ("AwaitUnsafeOnCompleted", 2, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.REF) }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (1, tp, SpecialConstraint.None, Variance.None, null) }, false), btypes.Void)); AsyncTaskMethodBuilderGenericStart = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric, MemberFilter.Method ("Start", 1, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), }, false), btypes.Void)); AsyncTaskMethodBuilderGenericTask = new PredefinedMember<PropertySpec> (module, types.AsyncTaskMethodBuilderGeneric, MemberFilter.Property ("Task", null)); AsyncVoidMethodBuilderCreate = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder, MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, types.AsyncVoidMethodBuilder.TypeSpec)); AsyncVoidMethodBuilderSetException = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder, MemberFilter.Method ("SetException", 0, null, btypes.Void)); AsyncVoidMethodBuilderSetResult = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder, MemberFilter.Method ("SetResult", 0, ParametersCompiled.EmptyReadOnlyParameters, btypes.Void)); AsyncVoidMethodBuilderSetStateMachine = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder, "SetStateMachine", MemberKind.Method, () => new[] { types.IAsyncStateMachine.TypeSpec }, btypes.Void); AsyncVoidMethodBuilderOnCompleted = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder, MemberFilter.Method ("AwaitOnCompleted", 2, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.REF) }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (1, tp, SpecialConstraint.None, Variance.None, null) }, false), btypes.Void)); AsyncVoidMethodBuilderOnCompletedUnsafe = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder, MemberFilter.Method ("AwaitUnsafeOnCompleted", 2, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.REF) }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (1, tp, SpecialConstraint.None, Variance.None, null) }, false), btypes.Void)); AsyncVoidMethodBuilderStart = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder, MemberFilter.Method ("Start", 1, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), }, false), btypes.Void)); AsyncStateMachineAttributeCtor = new PredefinedMember<MethodSpec> (module, atypes.AsyncStateMachine, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved ( btypes.Type))); DebuggerBrowsableAttributeCtor = new PredefinedMember<MethodSpec> (module, atypes.DebuggerBrowsable, MemberFilter.Constructor (null)); DecimalCtor = new PredefinedMember<MethodSpec> (module, btypes.Decimal, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved ( btypes.Int, btypes.Int, btypes.Int, btypes.Bool, btypes.Byte))); DecimalCtorInt = new PredefinedMember<MethodSpec> (module, btypes.Decimal, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved (btypes.Int))); DecimalCtorLong = new PredefinedMember<MethodSpec> (module, btypes.Decimal, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved (btypes.Long))); DecimalConstantAttributeCtor = new PredefinedMember<MethodSpec> (module, atypes.DecimalConstant, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved ( btypes.Byte, btypes.Byte, btypes.UInt, btypes.UInt, btypes.UInt))); DefaultMemberAttributeCtor = new PredefinedMember<MethodSpec> (module, atypes.DefaultMember, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved (btypes.String))); DelegateCombine = new PredefinedMember<MethodSpec> (module, btypes.Delegate, "Combine", btypes.Delegate, btypes.Delegate); DelegateRemove = new PredefinedMember<MethodSpec> (module, btypes.Delegate, "Remove", btypes.Delegate, btypes.Delegate); DelegateEqual = new PredefinedMember<MethodSpec> (module, btypes.Delegate, new MemberFilter (Operator.GetMetadataName (Operator.OpType.Equality), 0, MemberKind.Operator, null, btypes.Bool)); DelegateInequal = new PredefinedMember<MethodSpec> (module, btypes.Delegate, new MemberFilter (Operator.GetMetadataName (Operator.OpType.Inequality), 0, MemberKind.Operator, null, btypes.Bool)); DynamicAttributeCtor = new PredefinedMember<MethodSpec> (module, atypes.Dynamic, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved ( ArrayContainer.MakeType (module, btypes.Bool)))); FieldInfoGetFieldFromHandle = new PredefinedMember<MethodSpec> (module, types.FieldInfo, "GetFieldFromHandle", MemberKind.Method, types.RuntimeFieldHandle); FieldInfoGetFieldFromHandle2 = new PredefinedMember<MethodSpec> (module, types.FieldInfo, "GetFieldFromHandle", MemberKind.Method, types.RuntimeFieldHandle, new PredefinedType (btypes.RuntimeTypeHandle)); FixedBufferAttributeCtor = new PredefinedMember<MethodSpec> (module, atypes.FixedBuffer, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved (btypes.Type, btypes.Int))); IDisposableDispose = new PredefinedMember<MethodSpec> (module, btypes.IDisposable, "Dispose", TypeSpec.EmptyTypes); IEnumerableGetEnumerator = new PredefinedMember<MethodSpec> (module, btypes.IEnumerable, "GetEnumerator", TypeSpec.EmptyTypes); InterlockedCompareExchange = new PredefinedMember<MethodSpec> (module, types.Interlocked, MemberFilter.Method ("CompareExchange", 0, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.NONE), new ParameterData (null, Parameter.Modifier.NONE) }, new[] { btypes.Int, btypes.Int, btypes.Int }, false), btypes.Int)); InterlockedCompareExchange_T = new PredefinedMember<MethodSpec> (module, types.Interlocked, MemberFilter.Method ("CompareExchange", 1, new ParametersImported ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.NONE), new ParameterData (null, Parameter.Modifier.NONE) }, new[] { new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), new TypeParameterSpec (0, tp, SpecialConstraint.None, Variance.None, null), }, false), null)); MethodInfoGetMethodFromHandle = new PredefinedMember<MethodSpec> (module, types.MethodBase, "GetMethodFromHandle", MemberKind.Method, types.RuntimeMethodHandle); MethodInfoGetMethodFromHandle2 = new PredefinedMember<MethodSpec> (module, types.MethodBase, "GetMethodFromHandle", MemberKind.Method, types.RuntimeMethodHandle, new PredefinedType (btypes.RuntimeTypeHandle)); MonitorEnter = new PredefinedMember<MethodSpec> (module, types.Monitor, "Enter", btypes.Object); MonitorEnter_v4 = new PredefinedMember<MethodSpec> (module, types.Monitor, MemberFilter.Method ("Enter", 0, new ParametersImported (new[] { new ParameterData (null, Parameter.Modifier.NONE), new ParameterData (null, Parameter.Modifier.REF) }, new[] { btypes.Object, btypes.Bool }, false), null)); MonitorExit = new PredefinedMember<MethodSpec> (module, types.Monitor, "Exit", btypes.Object); RuntimeCompatibilityWrapNonExceptionThrows = new PredefinedMember<PropertySpec> (module, atypes.RuntimeCompatibility, MemberFilter.Property ("WrapNonExceptionThrows", btypes.Bool)); RuntimeHelpersInitializeArray = new PredefinedMember<MethodSpec> (module, types.RuntimeHelpers, "InitializeArray", btypes.Array, btypes.RuntimeFieldHandle); RuntimeHelpersOffsetToStringData = new PredefinedMember<PropertySpec> (module, types.RuntimeHelpers, MemberFilter.Property ("OffsetToStringData", btypes.Int)); SecurityActionRequestMinimum = new PredefinedMember<ConstSpec> (module, types.SecurityAction, "RequestMinimum", MemberKind.Field, types.SecurityAction); StringEmpty = new PredefinedMember<FieldSpec> (module, btypes.String, MemberFilter.Field ("Empty", btypes.String)); StringEqual = new PredefinedMember<MethodSpec> (module, btypes.String, new MemberFilter (Operator.GetMetadataName (Operator.OpType.Equality), 0, MemberKind.Operator, null, btypes.Bool)); StringInequal = new PredefinedMember<MethodSpec> (module, btypes.String, new MemberFilter (Operator.GetMetadataName (Operator.OpType.Inequality), 0, MemberKind.Operator, null, btypes.Bool)); StructLayoutAttributeCtor = new PredefinedMember<MethodSpec> (module, atypes.StructLayout, MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved (btypes.Short))); StructLayoutCharSet = new PredefinedMember<FieldSpec> (module, atypes.StructLayout, "CharSet", MemberKind.Field, types.CharSet); StructLayoutSize = new PredefinedMember<FieldSpec> (module, atypes.StructLayout, MemberFilter.Field ("Size", btypes.Int)); TypeGetTypeFromHandle = new PredefinedMember<MethodSpec> (module, btypes.Type, "GetTypeFromHandle", btypes.RuntimeTypeHandle); }
public Rule(Operator ruleOperator, object value, int processingRuleId) { _processingRuleId = processingRuleId; Operator_ = ruleOperator; Value = value; }
public ActionResult SubmitForm(string keyValue, QuestionVerifyEntity qEntity) { Operator curUser = OperatorProvider.Provider.Current(); WfControlResult result = new WfControlResult(); try { string wfFlag = string.Empty; //流程标识 string participant = string.Empty; //获取流程下一节点的参与人员 (取验收人) QuestionInfoEntity baseEntity = questioninfobll.GetEntity(keyValue); QuestionReformEntity reformEntity = questionreformbll.GetEntityByBid(keyValue); QuestionVerifyEntity aptEntity = questionverifybll.GetEntityByBid(keyValue); if (null == aptEntity) { aptEntity = new QuestionVerifyEntity(); } aptEntity.QUESTIONID = keyValue; aptEntity.VERIFYRESULT = qEntity.VERIFYRESULT; aptEntity.VERIFYOPINION = qEntity.VERIFYOPINION; aptEntity.MODIFYDATE = DateTime.Now; aptEntity.MODIFYUSERID = curUser.UserId; aptEntity.MODIFYUSERNAME = curUser.UserName; aptEntity.VERIFYSIGN = !string.IsNullOrEmpty(qEntity.VERIFYSIGN) ? HttpUtility.UrlDecode(qEntity.VERIFYSIGN) : ""; aptEntity.VERIFYDATE = qEntity.VERIFYDATE; WfControlObj wfentity = new WfControlObj(); wfentity.businessid = keyValue; wfentity.startflow = baseEntity.FLOWSTATE; wfentity.rankid = null; wfentity.user = curUser; wfentity.argument1 = curUser.UserId; wfentity.organizeid = baseEntity.BELONGDEPTID; //对应电厂id //厂级 wfentity.mark = "厂级问题流程"; //验证通过 if (qEntity.VERIFYRESULT == "1") { wfentity.submittype = "提交"; } else //验证不通过 { wfentity.submittype = "退回"; } //获取下一流程的操作人 result = wfcontrolbll.GetWfControl(wfentity); //返回操作结果成功(配置流程的情况下) if (result.code == WfCode.Sucess) { participant = result.actionperson; wfFlag = result.wfflag; //如果是更改状态 #region 如果是更改状态 if (result.ischangestatus) { //提交流程到下一节点 if (!string.IsNullOrEmpty(participant)) { int count = htworkflowbll.SubmitWorkFlow(wfentity, result, keyValue, participant, wfFlag, curUser.UserId); if (count > 0) { //添加问题验证记录 aptEntity.ID = null; aptEntity.VERIFYDEPTID = curUser.DeptId; aptEntity.VERIFYDEPTCODE = curUser.DeptCode; aptEntity.VERIFYDEPTNAME = curUser.DeptName; aptEntity.VERIFYPEOPLE = curUser.Account; aptEntity.VERIFYPEOPLENAME = curUser.UserName; questionverifybll.SaveForm("", aptEntity); //退回则重新添加验证记录 if (wfFlag == "2") { QuestionReformEntity newEntity = new QuestionReformEntity(); newEntity = reformEntity; newEntity.CREATEDATE = DateTime.Now; newEntity.MODIFYDATE = DateTime.Now; newEntity.MODIFYUSERID = curUser.UserId; newEntity.MODIFYUSERNAME = curUser.UserName; newEntity.REFORMPIC = null; //重新生成图片GUID newEntity.REFORMSTATUS = null; //整改完成情况 newEntity.REFORMDESCRIBE = null; //整改情况描述 newEntity.REFORMFINISHDATE = null; //整改完成时间 newEntity.ID = ""; questionreformbll.SaveForm("", newEntity); //验证记录记录 QuestionVerifyEntity cptEntity = new QuestionVerifyEntity(); cptEntity = aptEntity; cptEntity.ID = null; cptEntity.CREATEDATE = DateTime.Now; cptEntity.MODIFYDATE = DateTime.Now; cptEntity.VERIFYRESULT = null; cptEntity.VERIFYOPINION = null; cptEntity.VERIFYSIGN = null; questionverifybll.SaveForm("", cptEntity); } htworkflowbll.UpdateFlowStateByObjectId("bis_questioninfo", "flowstate", keyValue); //更新业务流程状态 } else { return(Error("当前用户无评估权限!")); } } else { return(Error(result.message)); } } #endregion #region 更改状态的情况下 else //不更改状态的情况下 { //保存隐患评估信息 #region 提交流程到下一节点 if (!string.IsNullOrEmpty(participant)) { //添加问题验证记录 aptEntity.ID = null; aptEntity.VERIFYDEPTID = curUser.DeptId; aptEntity.VERIFYDEPTCODE = curUser.DeptCode; aptEntity.VERIFYDEPTNAME = curUser.DeptName; aptEntity.VERIFYPEOPLE = curUser.Account; aptEntity.VERIFYPEOPLENAME = curUser.UserName; questionverifybll.SaveForm("", aptEntity); htworkflowbll.SubmitWorkFlowNoChangeStatus(wfentity, result, keyValue, participant, curUser.UserId); } else { return(Error(result.message)); } #endregion } #endregion } //不按照配置 else if (result.code == WfCode.NoInstance || result.code == WfCode.NoEnable) { //验证通过 if (qEntity.VERIFYRESULT == "1") { wfFlag = "1"; participant = curUser.Account; } else //验证不通过 { wfFlag = "2"; participant = reformEntity.REFORMPEOPLE; //整改人 } if (!string.IsNullOrEmpty(participant)) { int count = htworkflowbll.SubmitWorkFlow(keyValue, participant, wfFlag, curUser.UserId); if (count > 0) { //添加问题验证记录 aptEntity.VERIFYDEPTID = curUser.DeptId; aptEntity.VERIFYDEPTCODE = curUser.DeptCode; aptEntity.VERIFYDEPTNAME = curUser.DeptName; aptEntity.VERIFYPEOPLE = curUser.Account; aptEntity.VERIFYPEOPLENAME = curUser.UserName; questionverifybll.SaveForm(aptEntity.ID, aptEntity); //退回则重新添加验证记录 if (wfFlag == "2") { QuestionReformEntity newEntity = new QuestionReformEntity(); newEntity = reformEntity; newEntity.CREATEDATE = DateTime.Now; newEntity.MODIFYDATE = DateTime.Now; newEntity.MODIFYUSERID = curUser.UserId; newEntity.MODIFYUSERNAME = curUser.UserName; newEntity.REFORMPIC = null; //重新生成图片GUID newEntity.REFORMSTATUS = null; //整改完成情况 newEntity.REFORMDESCRIBE = null; //整改情况描述 newEntity.REFORMFINISHDATE = null; //整改完成时间 newEntity.ID = ""; questionreformbll.SaveForm("", newEntity); //验证记录记录 QuestionVerifyEntity cptEntity = new QuestionVerifyEntity(); cptEntity = aptEntity; cptEntity.ID = null; cptEntity.CREATEDATE = DateTime.Now; cptEntity.MODIFYDATE = DateTime.Now; cptEntity.VERIFYRESULT = null; cptEntity.VERIFYOPINION = null; cptEntity.VERIFYSIGN = null; questionverifybll.SaveForm("", cptEntity); } htworkflowbll.UpdateFlowStateByObjectId("bis_questioninfo", "flowstate", keyValue); //更新业务流程状态 } result.message = "操作成功!"; } else { return(Error("操作失败,请联系管理员!")); } } } catch (Exception ex) { return(Error(ex.Message)); } return(Success(result.message)); }
public RightEntry(long left, Operator @operator, long right) { Left = left; Operator = @operator; Right = right; }
public static T sq <T>(T a) => Operator <T> .Multiply(a, a);
/// <summary> /// Instantiates a operator token using the specified value /// </summary> /// <param name="value">The value of the operator token</param> /// <param name="index">The 0-based index in the expression of the first character of the token</param> public OperatorToken(Operator value, int index) : base(value.Symbol.Length, index) { Value = value; }
public BooleanExpression(ExpressionSyntax expression, ValueType value, Operator op) : this(expression, value, op, false, false) { }
/// <summary> /// 获取表达式 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="fieldName">字段名</param> /// <param name="value">值</param> /// <param name="op">操作符</param> /// <returns></returns> public static Expression <Func <T, bool> > GetPredicate <T>(string fieldName, object value, Operator op) { var field = typeof(T).GetProperty(fieldName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); if (field == null) { throw new ArgumentException(string.Format("模型不存在字段{0}", fieldName)); } var paramExp = Expression.Parameter(typeof(T), "item"); var memberExp = Expression.MakeMemberAccess(paramExp, field); switch (op) { case Operator.Contains: case Operator.EndWith: case Operator.StartsWith: var method = typeof(string).GetMethod(op.ToString(), new Type[] { typeof(string) }); var callBody = Expression.Call(memberExp, method, Expression.Constant(value, typeof(string))); return(Expression.Lambda(callBody, paramExp) as Expression <Func <T, bool> >); default: var valueType = field.PropertyType; var valueExp = Expression.Constant(value, valueType); var expMethod = typeof(Expression).GetMethod(op.ToString(), new Type[] { typeof(Expression), typeof(Expression) }); var symbolBody = expMethod.Invoke(null, new object[] { memberExp, valueExp }) as Expression; return(Expression.Lambda(symbolBody, paramExp) as Expression <Func <T, bool> >); } }
public static bool operator !=(AdvancedCase left, AdvancedCase right) => Operator.Weave(left, right);
public object GetPlanWorkList([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; long pageIndex = dy.pageindex; long pageSize = dy.pagesize; string PlanWorkName = res.Contains("planworkname") ? dy.data.planworkname : ""; //作业内容 string PlanArea = res.Contains("planareaid") ? dy.data.planareaid : ""; //区域 string PlanDeptCode = res.Contains("plandeptcode") ? dy.data.plandeptcode : ""; //部门或专业 string PlanYear = res.Contains("planyear") ? dy.data.planyear : DateTime.Now.Year.ToString(); //计划年度 string PlanRiskLevel = res.Contains("planrisklevel") ? dy.data.planrisklevel : ""; //风险等级 string PlanMonth = res.Contains("planmonth") ? dy.data.planmonth : ""; //计划月度 OperatorProvider.AppUserId = userId; //设置当前用户 Operator currUser = OperatorProvider.Provider.Current(); if (null == currUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } Pagination pagination = new Pagination(); var tableClass = "bis_obstask_tz t"; pagination.p_kid = "t.id tid"; pagination.p_fields = @" t.planyear, t.plandept, t.planspeciaty, t.plandeptcode,t.plandeptid, t.planspeciatycode,t.oldplanid, t.planarea,t.planareacode, t.planlevel,p.risklevel, p.workname fjname, t.workname,p.id pid, p.obsperson,p.oldworkid, p.obspersonid, p.obsnum,p.obsnumtext, p.obsmonth, t.createuserid, t.createuserdeptcode, t.createuserorgcode, t.createdate,t.iscommit,p.remark,null status"; pagination.conditionJson = "t.iscommit='1' and t.ispublic='1' "; pagination.p_tablename = string.Format(@"{0} left join bis_obstaskwork p on p.planid = t.id", tableClass); pagination.sidx = "t.createdate desc,t.id asc"; pagination.page = int.Parse(pageIndex.ToString()); pagination.rows = int.Parse(pageSize.ToString()); if (!currUser.IsSystem) { if (currUser.RoleName.Contains("专业级用户") || currUser.RoleName.Contains("班组级用户")) { var d = new DepartmentBLL().GetParentDeptBySpecialArgs(currUser.ParentId, "部门"); if (d != null) { pagination.conditionJson += " and t.plandeptcode like '" + d.EnCode + "%'"; } else { pagination.conditionJson += " and 0=1"; } } else { //通过菜单名称和菜单Encode查询菜单Id string sql = string.Format("select * from BASE_MODULE t where t.fullname='观察计划台账' and t.encode='ObsTaskStanding'"); var dtMenu = observerecordbll.GetMenuTable(sql); string authType = string.Empty; if (dtMenu.Rows.Count > 0) { authType = new AuthorizeBLL().GetOperAuthorzeType(currUser, dtMenu.Rows[0]["moduleid"].ToString(), "search"); } if (!string.IsNullOrEmpty(authType)) { switch (authType) { case "1": pagination.conditionJson += " and t.createuserid='" + currUser.UserId + "'"; break; case "2": pagination.conditionJson += " and t.plandeptcode='" + currUser.DeptCode + "'"; break; case "3": pagination.conditionJson += " and t.plandeptcode like '" + currUser.DeptCode + "%'"; break; case "4": pagination.conditionJson += " and t.plandeptcode like '" + currUser.OrganizeCode + "%'"; break; case "5": pagination.conditionJson += string.Format(" and t.plandeptcode in(select encode from BASE_DEPARTMENT where deptcode like '{0}%')", currUser.NewDeptCode); break; } } else { pagination.conditionJson += " and 0=1"; } } } string queryJson = Newtonsoft.Json.JsonConvert.SerializeObject(new { PlanWorkName = PlanWorkName, //作业内容 PlanArea = PlanArea, //区域 PlanDeptCode = PlanDeptCode, //部门或专业 PlanYear = PlanYear, //计划年度 PlanRiskLevel = PlanRiskLevel, //风险等级 PlanMonth = PlanMonth //计划月度 }); var data = obsplanbll.GetPageList(pagination, queryJson); for (int i = 0; i < data.Rows.Count; i++) { var dt = obsplanbll.GetObsRecordIsExist(data.Rows[i]["oldplanid"].ToString(), data.Rows[i]["oldworkid"].ToString(), PlanYear); //var obsmonth = data.Rows[i]["obsmonth"].ToString().Split(','); if (dt.Rows.Count > 0) { //for (int j = 0; j < obsmonth.Length; j++) //{ if (DateTime.Now.Year.ToString() == PlanYear && DateTime.Now.Month <= Convert.ToInt32(PlanMonth)) { if (Convert.ToInt32(dt.Rows[0]["m" + Convert.ToInt32(PlanMonth)]) > 0) { data.Rows[i]["status"] = "1"; } else { if (DateTime.Now.Month == Convert.ToInt32(Convert.ToInt32(PlanMonth))) { var currTime = DateTime.Now; var lastTime = Convert.ToDateTime(DateTime.Now.AddMonths(1).ToString("yyyy-MM-01")).AddDays(-1); if (DateTime.Compare(lastTime, currTime) <= 5) { data.Rows[i]["status"] = "2"; } else { data.Rows[i]["status"] = "3"; } } else { data.Rows[i]["status"] = "3"; } } } else { if (Convert.ToInt32(dt.Rows[0]["m" + Convert.ToInt32(PlanMonth)]) > 0) { data.Rows[i]["status"] = "1"; } else { data.Rows[i]["status"] = "4"; } } //} } else { //for (int j = 0; j < obsmonth.Length; j++) //{ if (DateTime.Now.Year.ToString() == PlanYear && DateTime.Now.Month <= Convert.ToInt32(PlanMonth)) { if (DateTime.Now.Month == Convert.ToInt32(PlanMonth)) { var currTime = DateTime.Now; var lastTime = Convert.ToDateTime(DateTime.Now.AddMonths(1).ToString("yyyy-MM-01")).AddDays(-1); if (DateTime.Compare(lastTime, currTime) <= 5) { data.Rows[i]["status"] = "2"; } else { data.Rows[i]["status"] = "3"; } } else { data.Rows[i]["status"] = "3"; } } else { data.Rows[i]["status"] = "4"; } //} } } return(new { Code = 0, Count = pagination.records, Info = "获取数据成功", data = data }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
/// <summary> /// Acts on an operator as soon as it is encountered. /// </summary> /// <param name="op">The operator.</param> protected override void PrepareOperator(Operator op) { }
public object GetObsList([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; long pageIndex = dy.pageindex; long pageSize = dy.pagesize; string action = dy.data.action;//0待提交 1全部 string starttime = dy.data.starttime; string endtime = dy.data.endtime; string workname = dy.data.workname; string obspeople = dy.data.obspeople; string workunitid = dy.data.workunitid; string deptcode = dy.data.deptcode; OperatorProvider.AppUserId = userId; //设置当前用户 Operator user = OperatorProvider.Provider.Current(); Pagination pagination = new Pagination(); pagination.page = int.Parse(pageIndex.ToString()); pagination.rows = int.Parse(pageSize.ToString()); pagination.p_kid = "t.id"; pagination.p_fields = @"t.workname,t.workunitid,t.workunit, t.workpeople,t.workpeopleid,t.createuserid, t.createuserorgcode,t.createuserdeptcode, t.createdate,t.workarea,t.workareaid, t.workplace,t.obsendtime,t.obsstarttime, t.obsperson,t.obspersonid,t.obsplanid,t.iscommit"; pagination.p_tablename = @"bis_observetaskrecord t"; pagination.sidx = "t.createdate"; //排序字段 pagination.sord = "desc"; //排序方式 pagination.conditionJson += " 1=1 "; string where = string.Empty; //通过菜单名称和菜单Encode查询菜单Id string sql = string.Format("select * from BASE_MODULE t where t.fullname='观察记录' and t.encode='ObsTaskRecord'"); var dtMenu = observerecordbll.GetMenuTable(sql); if (dtMenu.Rows.Count > 0) { //根据当前用户对模块的权限获取记录 where = new AuthorizeBLL().GetModuleDataAuthority(user, dtMenu.Rows[0]["moduleid"].ToString(), "createuserdeptcode", "createuserorgcode"); if (!string.IsNullOrWhiteSpace(where)) { pagination.conditionJson += " and " + where; } } //待提交的观察记录 if (action == "0") { pagination.conditionJson += string.Format(" and t.iscommit=0 and t.createuserid='{0}'", user.UserId); } else { pagination.conditionJson += string.Format(" and (t.iscommit=1 or t.createuserid='{0}')", user.UserId); } string queryJson = Newtonsoft.Json.JsonConvert.SerializeObject(new { starttime = starttime, endtime = endtime, workname = workname, obspeople = obspeople, workunitid = workunitid, deptcode = deptcode }); var data = observerecordbll.GetPageList(pagination, queryJson); return(new { Code = 0, Count = pagination.records, Info = "获取数据成功", data = data }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
/// <summary> /// 与逻辑运算 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="expLeft">表达式1</param> /// <param name="fieldName">键2</param> /// <param name="value">值</param> /// <param name="op">操作符</param> /// <returns></returns> public static Expression <Func <T, bool> > And <T>(this Expression <Func <T, bool> > expLeft, string fieldName, object value, Operator op) { var expRight = Where.GetPredicate <T>(fieldName, value, op); return(expLeft.And(expRight)); }