protected void btn_add_Click(object sender, EventArgs e) { try { ConfigBSO configBSO = new ConfigBSO(); Config config = configBSO.GetAllConfig(Language.language); MailBSO mailBSO = new MailBSO(); mailBSO.EmailFrom = config.Email_from; EmailBSO emailBSO = new EmailBSO(); DataTable table = emailBSO.GetEmailAll(); string subject = txtTitle.Text; string body = txtRadFull.Html; for (int i = 0; i < table.Rows.Count; i++) mailBSO.SendMail(table.Rows[i]["EmailAddress"].ToString(), subject, body); clientview.Text = "Thư đã được gửi đến danh sách Người dùng"; } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
public void ViewEmail() { EmailBSO emailBSO = new EmailBSO(); DataTable table = emailBSO.GetEmailAll(); commonBSO commonBSO = new commonBSO(); commonBSO.FillToGridView(grvEmail, table); }
private void initControl(int Id) { if (Id > 0) { btn_add.Visible = false; btn_edit.Visible = true; try { EmailBSO emailBSO = new EmailBSO(); Email email = emailBSO.GetEmailById(Id); hddEmailID.Value = Convert.ToString(email.EmailID); txtEmailAddress.Text = email.EmailAddress; txtName.Text = email.Name; } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } else { btn_add.Visible = true; btn_edit.Visible = false; } }
protected void btn_add_Click(object sender, EventArgs e) { try { Email email = ReceiveHtml(); EmailBSO emailBSO = new EmailBSO(); emailBSO.CreateEmail(email); clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
protected void grvEmail_RowCommand(object sender, GridViewCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); string nName = e.CommandName.ToLower(); switch (nName) { case "_edit": Response.Redirect("~//Admin/editemail/" + Id + "/Default.aspx"); break; case "_delete": EmailBSO emailBSO = new EmailBSO(); emailBSO.DeleteEmail(Id); ViewEmail(); break; } }
protected void btn_edit_Click(object sender, EventArgs e) { try { Email email = ReceiveHtml(); EmailBSO emailBSO = new EmailBSO(); emailBSO.UpdateEmail(email); clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Email: ", email.EmailAddress); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }