public static void editEmailTemplate(int intEmailTemplateID, string strTemplateName, string strDescription, string strBody) { SqlConnection con = new clsEmail().con; SqlCommand cmd = new SqlCommand(); con.Open(); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SWITCH_EmailTemplateUpdate"; cmd.Parameters.Add("@param_intEmailTemplateID", System.Data.SqlDbType.Int).Value = intEmailTemplateID; cmd.Parameters.Add("@param_strTemplateName", System.Data.SqlDbType.NVarChar).Value = strTemplateName; cmd.Parameters.Add("@param_strDescription", System.Data.SqlDbType.NVarChar).Value = strDescription; cmd.Parameters.Add("@param_strBody", System.Data.SqlDbType.NVarChar).Value = strBody; try { cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } con.Close(); cmd.Dispose(); }
public void getEmailTemplate(Nullable <int> intEmailTemplateID, string strTemplateName) { SqlConnection con = new clsEmail().con; SqlCommand cmd = new SqlCommand(); SqlDataReader dr; con.Open(); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SWITCH_EmailTemplateGet"; cmd.Parameters.Add("@param_intEmailTemplateID", System.Data.SqlDbType.Int).Value = intEmailTemplateID; cmd.Parameters.Add("@param_strTemplateName", System.Data.SqlDbType.NVarChar).Value = strTemplateName; dr = cmd.ExecuteReader(); while (dr.Read()) { this.propBody = dr["Body"].ToString(); this.propDescription = dr["Description"].ToString(); this.propEmailTemplateID = int.Parse(dr["EmailTemplateID"].ToString()); this.propTemplateName = dr["TemplateName"].ToString(); } con.Close(); cmd.Dispose(); }
public static void deleteEmailTemplate(int intEmailTemplateID) { SqlConnection con = new clsEmail().con; con.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "[SWITCH_EmailTemplateDelete]"; cmd.Parameters.Add("@param_intEmailTemplateID", System.Data.SqlDbType.Int).Value = intEmailTemplateID; cmd.ExecuteNonQuery(); }
public static void Send(String strRecipient, String strSender, String strSubject, String strBody, int intSwitchID, string strClientID, enumEmailPurpose enumPurpose) { String strSMTPHost = new clsEmail().strSMTPHost; MailAddress from = new MailAddress(strSender); MailAddress to = new MailAddress(strRecipient); MailMessage message = new MailMessage(from, to); message.Subject = strSubject; message.Body = strBody; message.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.Host = strSMTPHost; client.Send(message); insertEmailLog(intSwitchID, strRecipient, strClientID, strBody, enumPurpose); }
public void getEmailTemplate(Nullable<int> intEmailTemplateID, string strTemplateName) { SqlConnection con = new clsEmail().con; SqlCommand cmd = new SqlCommand(); SqlDataReader dr; con.Open(); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SWITCH_EmailTemplateGet"; cmd.Parameters.Add("@param_intEmailTemplateID", System.Data.SqlDbType.Int).Value = intEmailTemplateID; cmd.Parameters.Add("@param_strTemplateName", System.Data.SqlDbType.NVarChar).Value = strTemplateName; dr = cmd.ExecuteReader(); while (dr.Read()) { this.propBody = dr["Body"].ToString(); this.propDescription = dr["Description"].ToString(); this.propEmailTemplateID = int.Parse(dr["EmailTemplateID"].ToString()); this.propTemplateName = dr["TemplateName"].ToString(); } con.Close(); cmd.Dispose(); }