예제 #1
0
 protected void BtnEmail_Click(object sender, EventArgs e)
 {
     lblError.Text = string.Empty;
     Save();
     CustomLinqExtensions.SendEmail(lblInvoiceNo.Text, Server.MapPath("~/App_Data/"), _repositoryWrapper, _emailSender);
     lblError.ForeColor = Color.Green;
     lblError.Text      = $"Email has been sent successfully for {lblInvoiceNo.Text}";
 }
        protected void grdInvoices_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            lblEmail.Text = string.Empty;
            string invoiceNumber = e.CommandArgument.ToString();

            if (e.CommandName == StringHelper.EditCommand)
            {
                Response.Redirect($"~/Forms/Shopping/Cart.aspx?InvoiceNumber={invoiceNumber}");
            }
            else if (e.CommandName == StringHelper.PrintCommand)
            {
                Response.DownloadFile(DocumentHelper.GenerateInvoice(invoiceNumber, _repositoryWrapper, Server.MapPath("~/App_Data/")));
            }
            else if (e.CommandName == StringHelper.EmailCommand)
            {
                CustomLinqExtensions.SendEmail(invoiceNumber, Server.MapPath("~/App_Data/"), _repositoryWrapper, _emailSender);
                lblEmail.Text = $"Email has been sent successfully for invoice:{invoiceNumber}";
            }
        }