Esempio n. 1
0
    protected void SendEmail(string strID, bool bApproved)
    {
        CafeDeluxe.Functionality.MailMan mm = new CafeDeluxe.Functionality.MailMan();
        string        subject = string.Empty;
        StringBuilder sbBody  = new StringBuilder();
        DataTable     dt      = CafeDeluxe.Data.DAO.GetAllOrderInfo(strID);

        sbBody.Append("Order ID : " + strID + "\r\n");

        if (bApproved)
        {
            subject = "Approved Purchase";
            sbBody.Append("Approval Code : " + dt.Rows[0]["ResponseApproval_Code"].ToString() + "\r\n\r\n");
        }
        else
        {
            subject = "Declined Purchase";
            sbBody.Append("Failure Reason : " + dt.Rows[0]["ResponseFailReason"].ToString() + "\r\n\r\n");
        }

        sbBody.Append("Order Date : " + dt.Rows[0]["DTCompleted"].ToString() + "\r\n");
        sbBody.Append("Order : " + dt.Rows[0]["Quantity"].ToString() + "  $" + dt.Rows[0]["Amount"].ToString() + " Gift Cards" + "\r\n");
        sbBody.Append("SubTotal : $" + dt.Rows[0]["SubTotal"].ToString() + "\r\n");
        sbBody.Append("Shipping Type : " + dt.Rows[0]["ShippingType"].ToString() + "\r\n");
        sbBody.Append("Shipping Amount : $" + dt.Rows[0]["ShippingAmount"].ToString() + "\r\n");
        sbBody.Append("Total : $" + dt.Rows[0]["Total"].ToString() + "\r\n\r\n");

        sbBody.Append("Personal Message : " + dt.Rows[0]["PersonalMessage"].ToString() + "\r\n\r\n");

        sbBody.Append("Billing Information:" + "\r\n");
        sbBody.Append(dt.Rows[0]["bFirstName"].ToString() + " " + dt.Rows[0]["bLastName"].ToString() + "\r\n");

        if (dt.Rows[0]["bCompany"].ToString().Trim() != "")
        {
            sbBody.Append(dt.Rows[0]["bCompany"].ToString() + "\r\n");
        }

        sbBody.Append(dt.Rows[0]["bAddress1"].ToString() + "\r\n");

        if (dt.Rows[0]["bAddress2"].ToString().Trim() != "")
        {
            sbBody.Append(dt.Rows[0]["bAddress2"].ToString() + "\r\n");
        }

        sbBody.Append(dt.Rows[0]["bCity"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bState"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bZipcode"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bCountry"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bPhone"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bEmail"].ToString() + "\r\n\r\n");

        sbBody.Append("Shipping Information:" + "\r\n");
        sbBody.Append(dt.Rows[0]["sFirstName"].ToString() + " " + dt.Rows[0]["sLastName"].ToString() + "\r\n");

        if (dt.Rows[0]["sCompany"].ToString().Trim() != "")
        {
            sbBody.Append(dt.Rows[0]["sCompany"].ToString() + "\r\n");
        }

        sbBody.Append(dt.Rows[0]["sAddress1"].ToString() + "\r\n");

        if (dt.Rows[0]["sAddress2"].ToString().Trim() != "")
        {
            sbBody.Append(dt.Rows[0]["sAddress2"].ToString() + "\r\n");
        }

        sbBody.Append(dt.Rows[0]["sCity"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sState"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sZipcode"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sCountry"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sPhone"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sEmail"].ToString() + "\r\n\r\n");

        //if approved send purchaser and purchase summary email
        if (bApproved)
        {
            StringBuilder sbBody2 = new StringBuilder();

            //sbBody2.Append("Contact : " + System.Configuration.ConfigurationManager.AppSettings["ContactName"].ToString() + "\r\n");
            //sbBody2.Append("Contact Email : " + System.Configuration.ConfigurationManager.AppSettings["ContactEmail"].ToString() + "\r\n");
            //sbBody2.Append("Contact Phone : " + System.Configuration.ConfigurationManager.AppSettings["ContactPhone"].ToString() + "\r\n\r\n");
            sbBody2.Append("Thank you for purchasing a Cafe Deluxe and Tortilla Coast gift card.  Please visit our website at cafedeluxe.com or tortillacoast.com for locations and other great information about our restaurants." + "\r\n\r\n");
            sbBody2.Append("We look forward to seeing you soon.  If you have any questions call 202-362-9842 ext. 04" + "\r\n\r\n");

            sbBody2.Append(sbBody.ToString());

            mm.MailOrder(System.Configuration.ConfigurationManager.AppSettings["MailFrom"].ToString(), dt.Rows[0]["bEmail"].ToString(), "Cafe Deluxe Purchase Confirmation", sbBody2.ToString());
        }

        sbBody.Append("Wishes to Receive Promotions : " + dt.Rows[0]["Promos"].ToString());

        //send cafe deluxe a purchase email, approved or declined
        mm.MailOrder(System.Configuration.ConfigurationManager.AppSettings["MailFrom"].ToString(), System.Configuration.ConfigurationManager.AppSettings["MailTo"].ToString(), subject, sbBody.ToString());
    }
Esempio n. 2
0
    protected void SendEmail(string strID, bool bApproved)
    {
        CafeDeluxe.Functionality.MailMan mm = new CafeDeluxe.Functionality.MailMan();
        string subject = string.Empty;
        StringBuilder sbBody = new StringBuilder();
        DataTable dt = CafeDeluxe.Data.DAO.GetAllOrderInfo(strID);

        sbBody.Append("Order ID : " + strID + "\r\n");

        if (bApproved)
        {
            subject = "Approved Purchase";
            sbBody.Append("Approval Code : " + dt.Rows[0]["ResponseApproval_Code"].ToString() + "\r\n\r\n");
        }
        else
        {
            subject = "Declined Purchase";
            sbBody.Append("Failure Reason : " + dt.Rows[0]["ResponseFailReason"].ToString() + "\r\n\r\n");
        }

        sbBody.Append("Order Date : " + dt.Rows[0]["DTCompleted"].ToString() + "\r\n");
        sbBody.Append("Order : " + dt.Rows[0]["Quantity"].ToString() + "  $" + dt.Rows[0]["Amount"].ToString() + " Gift Cards" + "\r\n");
        sbBody.Append("SubTotal : $" + dt.Rows[0]["SubTotal"].ToString() + "\r\n");
        sbBody.Append("Shipping Type : " + dt.Rows[0]["ShippingType"].ToString() + "\r\n");
        sbBody.Append("Shipping Amount : $" + dt.Rows[0]["ShippingAmount"].ToString() + "\r\n");
        sbBody.Append("Total : $" + dt.Rows[0]["Total"].ToString() + "\r\n\r\n");

        sbBody.Append("Personal Message : " + dt.Rows[0]["PersonalMessage"].ToString() + "\r\n\r\n");

        sbBody.Append("Billing Information:" + "\r\n");
        sbBody.Append(dt.Rows[0]["bFirstName"].ToString() + " " + dt.Rows[0]["bLastName"].ToString() + "\r\n");

        if(dt.Rows[0]["bCompany"].ToString().Trim() != "")
            sbBody.Append(dt.Rows[0]["bCompany"].ToString() + "\r\n");

        sbBody.Append(dt.Rows[0]["bAddress1"].ToString() + "\r\n");

        if (dt.Rows[0]["bAddress2"].ToString().Trim() != "")
            sbBody.Append(dt.Rows[0]["bAddress2"].ToString() + "\r\n");

        sbBody.Append(dt.Rows[0]["bCity"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bState"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bZipcode"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bCountry"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bPhone"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["bEmail"].ToString() + "\r\n\r\n");

        sbBody.Append("Shipping Information:" + "\r\n");
        sbBody.Append(dt.Rows[0]["sFirstName"].ToString() + " " + dt.Rows[0]["sLastName"].ToString() + "\r\n");

        if (dt.Rows[0]["sCompany"].ToString().Trim() != "")
            sbBody.Append(dt.Rows[0]["sCompany"].ToString() + "\r\n");

        sbBody.Append(dt.Rows[0]["sAddress1"].ToString() + "\r\n");

        if (dt.Rows[0]["sAddress2"].ToString().Trim() != "")
            sbBody.Append(dt.Rows[0]["sAddress2"].ToString() + "\r\n");

        sbBody.Append(dt.Rows[0]["sCity"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sState"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sZipcode"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sCountry"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sPhone"].ToString() + "\r\n");
        sbBody.Append(dt.Rows[0]["sEmail"].ToString() + "\r\n\r\n");

        //if approved send purchaser and purchase summary email
        if (bApproved)
        {
            StringBuilder sbBody2 = new StringBuilder();

            //sbBody2.Append("Contact : " + System.Configuration.ConfigurationManager.AppSettings["ContactName"].ToString() + "\r\n");
            //sbBody2.Append("Contact Email : " + System.Configuration.ConfigurationManager.AppSettings["ContactEmail"].ToString() + "\r\n");
            //sbBody2.Append("Contact Phone : " + System.Configuration.ConfigurationManager.AppSettings["ContactPhone"].ToString() + "\r\n\r\n");
            sbBody2.Append("Thank you for purchasing a Cafe Deluxe and Tortilla Coast gift card.  Please visit our website at cafedeluxe.com or tortillacoast.com for locations and other great information about our restaurants." + "\r\n\r\n");
            sbBody2.Append("We look forward to seeing you soon.  If you have any questions call 202-362-9842 ext. 04" + "\r\n\r\n");

            sbBody2.Append(sbBody.ToString());

            mm.MailOrder(System.Configuration.ConfigurationManager.AppSettings["MailFrom"].ToString(), dt.Rows[0]["bEmail"].ToString(), "Cafe Deluxe Purchase Confirmation", sbBody2.ToString());
        }

        sbBody.Append("Wishes to Receive Promotions : " + dt.Rows[0]["Promos"].ToString());

        //send cafe deluxe a purchase email, approved or declined
        mm.MailOrder(System.Configuration.ConfigurationManager.AppSettings["MailFrom"].ToString(), System.Configuration.ConfigurationManager.AppSettings["MailTo"].ToString(), subject, sbBody.ToString());
    }