Exemplo n.º 1
0
            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();
            }
Exemplo n.º 2
0
            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();
            }
Exemplo n.º 3
0
            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();
            }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
            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();

            }
Exemplo n.º 7
0
            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();
            }
Exemplo n.º 8
0
            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();
            }