internal OperatorTimeChecker(ICallMessage callMessage, CallDataConsumerImplSqlServer parent) {// constructed to hold id_operator number, to save time this.parent = parent; string oper = callMessage.Operator(); if (!setIdOperator(oper, ref id_operator)) { //insert, get id string query = "INSERT INTO operator(mail) VALUES (@mail);SELECT Scope_Identity()"; id_operator = parent.ExecScalar(query, new SqlParameter[] {new SqlParameter("@mail", oper)}); } }
public void HandleMessage(ICallMessage callMessage) { if (null == callMessage || !callMessage.isValid()) return; if ("".Equals(callMessage.Operator()) || // <---- these fields could be empty DateTime.MinValue.Equals(callMessage.DateTimeStart()) || // <---- because of incorrect mail template (regex), DateTime.MaxValue.Equals(callMessage.DateTimeInterval()) ||// <---- they must be checked in the CallDataConsumer "".Equals(callMessage.Abonent())) // <---- and mail should be saved in special table { String description = "Possibly the regex is incorrect. Check the MessageRegex element in the MessageStructure section of the config class. "; saveFailedMessage(callMessage, description); return; } OperatorTimeChecker ot; if (!operatorOperatorTime.TryGetValue(callMessage.Operator(), out ot)) { ot = new OperatorTimeChecker(callMessage, this); operatorOperatorTime.Add(callMessage.Operator(), ot); } checkDateAndSave(callMessage, ot); }