protected void btnSave_Click(object sender, EventArgs e) { if (ValidateItem()) { CATEGORIES rec = new CATEGORIES(); if (RECid > 0) { rec = DALCategories.Get(RECid); if (!string.IsNullOrEmpty(Title)) { rec.TITLE = Title; } rec.ISACTIVE = chkActive.Checked; rec.TITLE = txtTitle.Text; rec.URLSEO = Code.Helper.SEOUrl(txtTitle.Text); DALCategories.Update(rec); } else { rec.SORT = Convert.ToInt16(DALCategories.GetLastSort() + 1); rec.ISACTIVE = chkActive.Checked; rec.TITLE = txtTitle.Text; rec.URLSEO = Code.Helper.SEOUrl(txtTitle.Text); DALCategories.Insert(rec); } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true); btnDelete.Visible = false; btnCancel.Visible = false; } }
protected void btnDelete_Click(object sender, EventArgs e) { try { CATEGORIES rec = DALCategories.Get(Int32.Parse(Request.QueryString["ID"])); if (rec != null) { if (!GetCountBlog(rec.ID)) { DALCategories.Delete(rec.ID); } else { NotificationAdd(NotificationType.error, "Kategoriyi Silmek için bağlı olan yazıları silin!"); } } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true); NotificationAdd(NotificationType.success, "Kayıt Silindi."); } catch (Exception ex) { if (ex is SqlException) { if ((ex as SqlException).Number == 547) { NotificationAdd(NotificationType.error, "Kayıt başka yerlerde kullanıdı."); } } else { throw ex; } } }
protected void rptCategories_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "Down": { CATEGORIES self = DALCategories.Get(Int32.Parse(e.CommandArgument.ToString())); CATEGORIES upper = DALCategories.GetBySort(self.SORT + 1); self.SORT++; upper.SORT--; DALCategories.Update(self); DALCategories.Update(upper); fillCategories(); break; } case "Up": { CATEGORIES self = DALCategories.Get(Int32.Parse(e.CommandArgument.ToString())); CATEGORIES upper = DALCategories.GetBySort(self.SORT - 1); self.SORT--; upper.SORT++; DALCategories.Update(self); DALCategories.Update(upper); fillCategories(); break; } } }
private void drpFill() { drpCatergori.DataSource = DALCategories.GetAll(); drpCatergori.DataTextField = "TITLE"; drpCatergori.DataValueField = "ID"; drpCatergori.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (RouteData.Values["TITLE"] != null) { title = RouteData.Values["TITLE"].ToString(); isQuestion(); } rptrCategories.Bind(DALCategories.GetAll()); rptLastPost.Bind(DALBlog.GetLastCount(3)); }
public static bool InsertNewCategory(ECategories category) { if (category.Name == "") { return(false); } else { DALCategories.InsertNewCategory(category); return(true); } }
public String GetCategorieName(int id) { CATEGORIES c = DALCategories.Get(id); if (c != null) { return(c.TITLE); } else { return("Boş"); } }
protected void Page_Load(object sender, EventArgs e) { string title = ""; if (RouteData.Values["TITLE"] != null) { title = RouteData.Values["TITLE"].ToString(); CATEGORIES c = DALCategories.GetTitle(title); rptPostTitle.Bind(DALBlog.GetByCategoriesID(c.ID)); } rptrCategories.Bind(DALCategories.GetAll()); rptLastPost.Bind(DALBlog.GetLastCount(3)); }
private void InitializePage() { if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { RECid = Convert.ToInt16(Request.QueryString["ID"]); CATEGORIES item = DALCategories.Get(RECid); if (item != null) { txtTitle.Text = item.TITLE; chkActive.Checked = (bool)item.ISACTIVE; btnDelete.Visible = true; btnSave.Text = "Güncelle"; } } }
protected bool ValidateItem() { bool retval = true; if (string.IsNullOrEmpty(txtTitle.Text)) { NotificationAdd(NotificationType.error, "Başlık Alanını Giriniz"); retval = false; } if (DALCategories.HasTitle(txtTitle.Text)) { NotificationAdd(NotificationType.error, "Title Alanını Değiştiriniz."); retval = false; } return(retval); }
public static bool Update(ECategories category) { DALCategories.Update(category); return(true); }
protected void Page_Load(object sender, EventArgs e) { rptrCategories.Bind(DALCategories.GetAll()); rptPost.Bind(DALBlog.GetLastCount(1)); rptLastPost.Bind(DALBlog.GetLastCount(3)); }
protected void Page_Load(object sender, EventArgs e) { rptrCategories.Bind(DALCategories.GetAll()); rptLastPost.Bind(DALBlog.GetLastCount(3)); rptQuestion.Bind(DALQUESTION.GetAll2().OrderBy(p => p.SORT)); }
private void fillCategories() { rptCountCategories = DALCategories.getCount(); rptCategories.Bind(DALCategories.GetAll().OrderBy(p => p.SORT)); lblCountCategories.Text = "(" + rptCountCategories.ToString() + ")"; }
protected void Page_Load(object sender, EventArgs e) { this.AsyncMode = true; rptrCategories.Bind(DALCategories.GetAll()); rptLastPost.Bind(DALBlog.GetLastCount(3)); }
public static bool Delete(ECategories category) { DALCategories.Delete(category); return(true); }
public static List <ECategories> GetAll() { return(DALCategories.GetAll()); }
public static ECategories GetIdOnly(int categoryID) { return(DALCategories.GetIdOnly(categoryID)); }