protected void lnksms_Click(object sender, EventArgs e) { if (txtNewsletter.Text.Length > 0) { bool DoesEmailExist = new NewsletterRepo().DoesEmailExist(txtNewsletter.Text); if (!DoesEmailExist) { NewsLetter news = new NewsLetter(); news.Email = txtNewsletter.Text; news.IsActive = true; news.DateCreated = DateTime.Now; new NewsletterRepo().CreateNewsLetter(news); } Response.Redirect("Newsletter.aspx"); } }
private void BindItemsList() { List<Model.NewsLetter> users = new NewsletterRepo().GetManagementNewsLetters(ToSQL.SQLToDateTimeNull(txtFromDate.Text), ToSQL.SQLToDateTimeNull(txtToDate.Text)); _PageDataSource.DataSource = users; _PageDataSource.AllowPaging = true; _PageDataSource.PageSize = 10; _PageDataSource.CurrentPageIndex = CurrentPage; ViewState["TotalPages"] = _PageDataSource.PageCount; //this.lblPageInfo.Text = "Results: " + ProductList.Count.ToString() + " Page " + (CurrentPage + 1) + " of " + _PageDataSource.PageCount + " "; this.btnPre.Visible = !_PageDataSource.IsFirstPage; this.btnNext.Visible = !_PageDataSource.IsLastPage; //this.lbtnFirst.Visible = !_PageDataSource.IsFirstPage; //this.lbtnLast.Visible = !_PageDataSource.IsLastPage; this.gvNewsletters.DataSource = _PageDataSource; this.gvNewsletters.DataBind(); //this.gvProducts.UseAccessibleHeader = true; //this.gvProducts.HeaderRow.TableSection = TableRowSection.TableHeader; this.doPaging(); }
protected void btnRemove_Click(object sender, EventArgs e) { try { LinkButton lnk = (LinkButton)sender; int Id = ToSQL.SQLToInt(lnk.CommandArgument); if (Id > 0) { int i = new NewsletterRepo().DeleteNewsLetter(Id); BindItemsList(); } } catch { } }