public int SetAutoMail (AutoMailType type, int organizationId, int geographyId, int authorPersonId, string title, string body) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand("SetAutoMail", connection); command.CommandType = CommandType.StoredProcedure; AddParameterWithName(command, "autoMailType", type.ToString()); AddParameterWithName(command, "organizationId", organizationId); AddParameterWithName(command, "geographyId", geographyId); AddParameterWithName(command, "authorPersonId", authorPersonId); AddParameterWithName(command, "title", title); AddParameterWithName(command, "body", body); return Convert.ToInt32(command.ExecuteScalar()); } }
public int SetAutoMail(AutoMailType type, int organizationId, int geographyId, int authorPersonId, string title, string body) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand("SetAutoMail", connection); command.CommandType = CommandType.StoredProcedure; AddParameterWithName(command, "autoMailType", type.ToString()); AddParameterWithName(command, "organizationId", organizationId); AddParameterWithName(command, "geographyId", geographyId); AddParameterWithName(command, "authorPersonId", authorPersonId); AddParameterWithName(command, "title", title); AddParameterWithName(command, "body", body); return(Convert.ToInt32(command.ExecuteScalar())); } }
public BasicAutoMail GetAutoMail (AutoMailType type, int organizationId, int geographyId) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand( "select AutoMails.AutoMailId,AutoMailTypes.Name,AutoMails.OrganizationId,AutoMails.GeographyId,AutoMails.AuthorPersonId,Title,Body " + "FROM AutoMails JOIN AutoMailTypes USING (AutoMailTypeId) " + "WHERE AutoMailTypes.Name='" + type.ToString() + "' AND AutoMails.OrganizationId=" + organizationId.ToString() + " AND AutoMails.GeographyId=" + geographyId.ToString(), connection); using (DbDataReader reader = command.ExecuteReader()) { if (reader.Read()) { return ReadAutoMailFromDataReader(reader); } return null; // NULL returned - unusual; usually exception is thrown if not found } } }
public BasicAutoMail GetAutoMail(AutoMailType type, int organizationId, int geographyId) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand( "select AutoMails.AutoMailId,AutoMailTypes.Name,AutoMails.OrganizationId,AutoMails.GeographyId,AutoMails.AuthorPersonId,Title,Body " + "FROM AutoMails JOIN AutoMailTypes USING (AutoMailTypeId) " + "WHERE AutoMailTypes.Name='" + type.ToString() + "' AND AutoMails.OrganizationId=" + organizationId.ToString() + " AND AutoMails.GeographyId=" + geographyId.ToString(), connection); using (DbDataReader reader = command.ExecuteReader()) { if (reader.Read()) { return(ReadAutoMailFromDataReader(reader)); } return(null); // NULL returned - unusual; usually exception is thrown if not found } } }