public void testUpdateMessageSqlStatement() { SecureMessageDao dao = new SecureMessageDao(_cxn); domain.sm.Message message = new domain.sm.Message(); message.MessageThread = new domain.sm.Thread() { Id = 1, Subject = "Test" }; // this must be set otherwise function will try to create it inline OracleQuery query = dao.buildUpdateMessageQuery(message); Assert.IsTrue(String.Equals(query.Command.CommandText, "UPDATE SMS.SECURE_MESSAGE SET OPLOCK = :oplockPlusOne, CLINICIAN_STATUS = :clinicianStatus, COMPLETED_DATE = :completedDate, ASSIGNED_TO = :assignedTo, CHECKSUM = :checksum, THREAD_ID = :threadId, STATUS_SET_BY = :statusSetBy, MODIFIED_DATE = :modifiedDate, ESCALATED = :escalated, BODY = :body, SENT_DATE = :sentDate, SENDER_TYPE = :senderType, SENDER_ID = :senderId, SENDER_NAME = :senderName, RECIPIENT_TYPE = :recipientType, RECIPIENT_ID = :recipientId, RECIPIENT_NAME = :recipientName, SENT_DATE_LOCAL = :sentDateLocal, ESCALATION_NOTIFICATION_DATE = :escalationNotificationDate, ESCALATION_NOTIFICATION_TRIES = :escalationNotificationTries, READ_RECEIPT = :readReceipt, HAS_ATTACHMENT = :hasAttachment, ATTACHMENT_ID = :attachmentId WHERE SECURE_MESSAGE_ID = :secureMessageId AND OPLOCK = :oplock")); }
public void testSendMessageSqlStatement() { SecureMessageDao dao = new SecureMessageDao(_cxn); domain.sm.Message message = new domain.sm.Message(); message.MessageThread = new domain.sm.Thread() { Id = 1, Subject = "Test" }; // this must be set otherwise function will try to create it inline OracleQuery query = dao.buildSendMessageCommand(message); Assert.IsTrue(String.Equals(query.Command.CommandText, "INSERT INTO SMS.SECURE_MESSAGE (CLINICIAN_STATUS, COMPLETED_DATE, ASSIGNED_TO, CHECKSUM, THREAD_ID, STATUS_SET_BY, MODIFIED_DATE, ESCALATED, BODY, SENT_DATE, SENDER_TYPE, SENDER_ID, SENDER_NAME, RECIPIENT_TYPE, RECIPIENT_ID, RECIPIENT_NAME, SENT_DATE_LOCAL, ESCALATION_NOTIFICATION_DATE, ESCALATION_NOTIFICATION_TRIES, READ_RECEIPT, HAS_ATTACHMENT, ATTACHMENT_ID) VALUES (:clinicianStatus, :completedDate, :assignedTo, :checksum, :threadId, :statusSetBy, :modifiedDate, :escalated, :body, :sentDate, :senderType, :senderId, :senderName, :recipientType, :recipientId, :recipientName, :sentDateLocal, :escalationNotificationDate, :escalationNotificationTries, :readReceipt, :hasAttachment, :attachmentId) RETURNING SECURE_MESSAGE_ID INTO :outId")); }
public static String buildDetailString(domain.sm.Message message) { StringBuilder sb = new StringBuilder(); sb.Append("MOBILE_APPS_ENTRY^Recipient:"); sb.Append(message.RecipientId.ToString()); if (message.MessageThread != null && message.MessageThread.MailGroup != null) { sb.Append("^"); sb.Append(message.MessageThread.MailGroup.Id); sb.Append("^"); sb.Append(message.MessageThread.MailGroup.Name); } return(sb.ToString()); }
public void testToMessageFromReaderComplete() { MockDataReader rdr = new MockDataReader(); DataTable table = new DataTable(); foreach (string columnName in TableSchemas.SECURE_MESSAGE_COLUMNS) { table.Columns.Add(columnName); } rdr.Table = table; object[] fakeValues = new object[] { 1, 2, DateTime.Now, 4, "ABCD1234", 6, 7, 8, 9, DateTime.Now, DateTime.Now, DateTime.Now, DBNull.Value, DateTime.Now, 15, 16, "BUTTS,SEYMOUR", 18, 19, "HUMPALOT,YVONNA", DateTime.Now, DateTime.Now, DBNull.Value, 0, 0 }; rdr.Table.Rows.Add(fakeValues); rdr.Read(); domain.sm.Message result = domain.sm.Message.getMessageFromReader(rdr); Assert.IsNotNull(result); }
public void testToMessageFromReaderSparse() { MockDataReader rdr = new MockDataReader(); DataTable table = new DataTable(); for (int i = 0; i < TableSchemas.SECURE_MESSAGE_COLUMNS.Count; i++) { if (i % 2 == 0) // just add the even indices to simulate randomly chosen columns { table.Columns.Add(TableSchemas.SECURE_MESSAGE_COLUMNS[i]); } } rdr.Table = table; object[] fakeValues = new object[] { 1, DateTime.Now, "ABCD1234", 7, 9, DateTime.Now, DBNull.Value, 15, "BUTTS,SEYMOUR", 19, DateTime.Now, DBNull.Value, 0 }; rdr.Table.Rows.Add(fakeValues); rdr.Read(); domain.sm.Message result = domain.sm.Message.getMessageFromReader(rdr); Assert.IsNotNull(result); }
internal domain.sm.Message toMessage(IDataReader rdr) { domain.sm.Message message = new domain.sm.Message(); if (rdr.Read()) { message = Message.getMessageFromReader(rdr); } return message; }
public void testUpdateMessageSqlStatement() { SecureMessageDao dao = new SecureMessageDao(_cxn); domain.sm.Message message = new domain.sm.Message(); message.MessageThread = new domain.sm.Thread() { Id = 1, Subject = "Test" }; // this must be set otherwise function will try to create it inline OracleQuery query = dao.buildUpdateMessageQuery(message); Assert.IsTrue(String.Equals(query.Command.CommandText, "UPDATE SMS.SECURE_MESSAGE SET OPLOCK = :oplockPlusOne, CLINICIAN_STATUS = :clinicianStatus, COMPLETED_DATE = :completedDate, ASSIGNED_TO = :assignedTo, CHECKSUM = :checksum, THREAD_ID = :threadId, STATUS_SET_BY = :statusSetBy, MODIFIED_DATE = :modifiedDate, ESCALATED = :escalated, BODY = :body, SENT_DATE = :sentDate, SENDER_TYPE = :senderType, SENDER_ID = :senderId, SENDER_NAME = :senderName, RECIPIENT_TYPE = :recipientType, RECIPIENT_ID = :recipientId, RECIPIENT_NAME = :recipientName, SENT_DATE_LOCAL = :sentDateLocal, ESCALATION_NOTIFICATION_DATE = :escalationNotificationDate, ESCALATION_NOTIFICATION_TRIES = :escalationNotificationTries, READ_RECEIPT = :readReceipt, HAS_ATTACHMENT = :hasAttachment, ATTACHMENT_ID = :attachmentId WHERE SECURE_MESSAGE_ID = :secureMessageId AND OPLOCK = :oplock")); }
public void testSendMessageSqlStatement() { SecureMessageDao dao = new SecureMessageDao(_cxn); domain.sm.Message message = new domain.sm.Message(); message.MessageThread = new domain.sm.Thread() { Id = 1, Subject = "Test" }; // this must be set otherwise function will try to create it inline OracleQuery query = dao.buildSendMessageCommand(message); Assert.IsTrue(String.Equals(query.Command.CommandText, "INSERT INTO SMS.SECURE_MESSAGE (CLINICIAN_STATUS, COMPLETED_DATE, ASSIGNED_TO, CHECKSUM, THREAD_ID, STATUS_SET_BY, MODIFIED_DATE, ESCALATED, BODY, SENT_DATE, SENDER_TYPE, SENDER_ID, SENDER_NAME, RECIPIENT_TYPE, RECIPIENT_ID, RECIPIENT_NAME, SENT_DATE_LOCAL, ESCALATION_NOTIFICATION_DATE, ESCALATION_NOTIFICATION_TRIES, READ_RECEIPT, HAS_ATTACHMENT, ATTACHMENT_ID) VALUES (:clinicianStatus, :completedDate, :assignedTo, :checksum, :threadId, :statusSetBy, :modifiedDate, :escalated, :body, :sentDate, :senderType, :senderId, :senderName, :recipientType, :recipientId, :recipientName, :sentDateLocal, :escalationNotificationDate, :escalationNotificationTries, :readReceipt, :hasAttachment, :attachmentId) RETURNING SECURE_MESSAGE_ID INTO :outId")); }