Ejemplo n.º 1
0
        protected void btn_CreateInvoice_Click(object sender, EventArgs e)
        {
            //Sending email
            string to, from, subject, body;

            to      = "*****@*****.**";
            from    = "*****@*****.**";
            subject = "[Auto Generated Email] Invoice is Ready to View";
            body    = "Dear customer, Your Invoice is ready for viewing. Thank You and Please Pay as soon as possible";

            MailMessage message = new MailMessage(from, to, subject, body);

            message.IsBodyHtml = true;

            SmtpClient client = new SmtpClient("smtp.gmail.com", 587);

            client.EnableSsl   = true;
            client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "votechvotech");
            client.Send(message);


            DAL_CreateInvoice obj = new DAL_CreateInvoice();

            //Insert into Invoice
            obj.createinvoice(tb_CreationDate.Text, Convert.ToInt32(tb_InvoiceTotalAmt.Text), Convert.ToInt32(tb_COID.Text));
            Response.Write("<script>alert('Successfully Created Invoice!');</script>");
            Response.Redirect("InvoiceCreated.aspx");
        }
        public int createinvoice(string InvoiceDate, decimal InvoiceTotalAmt, int CO_ID)
        {
            DAL_CreateInvoice obj = new DAL_CreateInvoice();

            return(obj.createinvoice(InvoiceDate, InvoiceTotalAmt, CO_ID));
        }