private void saveFailedMessage(ICallMessage callMessage, string description, string fileName) { string query = @" INSERT INTO failed_message( sender_mail, file_name, message_plain_text, description) VALUES (@sender_mail, @file_name, @message_plain_text, @description)"; ExecNonQuery(query, new SqlParameter[] { new SqlParameter("@sender_mail", callMessage.Sender()), new SqlParameter("@file_name", fileName), new SqlParameter("@message_plain_text", callMessage.PlainText()), new SqlParameter("@description", description) }); }
private void saveNormalMessage(ICallMessage callMessage, OperatorTimeChecker ot) { string fileName = saveFileGetNewName(callMessage); try { string query = @"INSERT INTO phone_call( id_operator, phone, date_start, date_interval, sender_mail, file_name) VALUES (@id_operator, @phone, @date_start, @date_interval, @sender_mail, @file_name)"; ExecNonQuery(query, new SqlParameter[] { new SqlParameter("@id_operator", ot.getIdOperator()), new SqlParameter("@phone", callMessage.Abonent()), new SqlParameter("@date_start", callMessage.DateTimeStart()), new SqlParameter("@date_interval", callMessage.DateTimeInterval()), new SqlParameter("@sender_mail", callMessage.Sender()), new SqlParameter("@file_name", fileName) }); } catch(Exception e) { saveFailedMessage(callMessage, "Cannot save message to phone_call table: " + e.Message, fileName); } }