Esempio n. 1
0
    public void SendMailForApprovedByNotSet(CostingSmv smv)
    {
        string       buyerName    = String.Empty;
        string       sampleStage  = String.Empty;
        string       postedByName = String.Empty;
        string       zoneName     = String.Empty;
        BuyerGateway buyerGateway = new BuyerGateway();
        DataTable    dt           = new DataTable();

        if (smv.UpdatedBy == 0)
        {
            dt = buyerGateway.GetSendingMailInfo(smv.BuyerId, smv.SampleStageId, smv.PostedBy);
        }
        else
        {
            dt = buyerGateway.GetSendingMailInfo(smv.BuyerId, smv.SampleStageId, smv.UpdatedBy);
        }


        if (dt.Rows.Count > 0)
        {
            buyerName    = dt.Rows[0]["BuyerName"].ToString();
            sampleStage  = dt.Rows[0]["SampleStage"].ToString();
            postedByName = dt.Rows[0]["PostedByName"].ToString();
            zoneName     = dt.Rows[0]["ZoneName"].ToString();
        }

        StringBuilder mailBody = new StringBuilder();

        mailBody.Append("<h3>Dear Concern,</h3>"
                        + "<br/>"
                        + " <p>"
                        + " The costing smv of Buyer Name : " + buyerName + ", <br/> Style number: " + smv.StyleNumber
                        + " <br/> Design number: " + smv.DesignNumber
                        + " <br/> Sample Stage : " + sampleStage + ", <br/> Season : " + smv.Season + ", <br/> Sewing Smv:" + smv.SewingSmv
                        + " <br/> was stored by : " + postedByName
                        + " <br/> Without Approved From: " + zoneName
                        + " </p>"
                        + "<br/>"
                        + " Thank You"
                        + "<br/>"
                        + "**NB:- Please do not reply this Email"
                        );


        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

        //mail.To.Add("*****@*****.**");
        //mail.To.Add("*****@*****.**");

        //if (zoneName == "CEPZ")
        //{
        //    mail.To.Add("*****@*****.**");

        //}
        //else if (zoneName == "KEPZ")
        //{
        //    mail.To.Add("*****@*****.**");

        //}
        //mail.To.Add("*****@*****.**");
        //mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");

        mail.From            = new MailAddress("*****@*****.**", "No-Reply", System.Text.Encoding.UTF8);
        mail.Subject         = "Approval Missing For - Style:" + smv.StyleNumber;
        mail.SubjectEncoding = System.Text.Encoding.UTF8;
        mail.Body            = mailBody.ToString();
        mail.BodyEncoding    = System.Text.Encoding.UTF8;
        mail.IsBodyHtml      = true;
        mail.Priority        = MailPriority.High;
        SmtpClient client = new SmtpClient();

        //client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "@2018Smv");
        client.Port = 25;
        client.Host = "mail.hirdaramani.com";
        //client.EnableSsl = true;
        try
        {
            //if (zoneName == "KEPZ" || zoneName == "CEPZ")
            //{
            client.Send(mail);
            //}
        }
        catch (Exception ex)
        {
            Exception ex2          = ex;
            string    errorMessage = string.Empty;
            while (ex2 != null)
            {
                errorMessage += ex2.ToString();
                ex2           = ex2.InnerException;
                throw ex2;
            }
        }
    }
Esempio n. 2
0
    public void SendMailForCostingSmv(CostingSmv smv)
    {
        string       buyerName    = String.Empty;
        string       sampleStage  = String.Empty;
        string       postedByName = String.Empty;
        string       zoneName     = String.Empty;
        BuyerGateway buyerGateway = new BuyerGateway();
        DataTable    dt           = new DataTable();

        dt = buyerGateway.GetSendingMailInfo(smv.BuyerId, smv.SampleStageId, smv.PostedBy);
        if (dt.Rows.Count > 0)
        {
            buyerName    = dt.Rows[0]["BuyerName"].ToString();
            sampleStage  = dt.Rows[0]["SampleStage"].ToString();
            postedByName = dt.Rows[0]["PostedByName"].ToString();
            zoneName     = dt.Rows[0]["ZoneName"].ToString();
        }

        StringBuilder mailBody = new StringBuilder();

        mailBody.Append("Dear Concern,"
                        + " The new costing smv on Buyer Name : " + buyerName + ", Style number: " + smv.StyleNumber
                        + " Sample Stage : " + sampleStage + ", Season : " + smv.Season + "Sewing Smv:" + smv.SewingSmv
                        + " was stored by : " + postedByName

                        + "Thank You"
                        + "**NB:- Please do not reply this Email"
                        );


        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();


        //mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");

        //mail.To.Add("ismatkhanzarin @gmail.com");

        mail.From            = new MailAddress("*****@*****.**", "Smv System", System.Text.Encoding.UTF8);
        mail.Subject         = "New Smv For - Style:" + smv.StyleNumber;
        mail.SubjectEncoding = System.Text.Encoding.UTF8;
        mail.Body            = mailBody.ToString();
        mail.BodyEncoding    = System.Text.Encoding.UTF8;
        mail.IsBodyHtml      = true;
        mail.Priority        = MailPriority.High;
        SmtpClient client = new SmtpClient();

        client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "@2018Smv");
        client.Port        = 587;
        client.Host        = "smtp.gmail.com";
        client.EnableSsl   = true;
        try
        {
            client.Send(mail);
        }
        catch (Exception ex)
        {
            Exception ex2          = ex;
            string    errorMessage = string.Empty;
            while (ex2 != null)
            {
                errorMessage += ex2.ToString();
                ex2           = ex2.InnerException;
                throw ex2;
            }
        }
    }