예제 #1
0
 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;
     }
 }
예제 #2
0
 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;
         }
     }
 }
예제 #3
0
        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;
            }
            }
        }
예제 #4
0
 private void drpFill()
 {
     drpCatergori.DataSource     = DALCategories.GetAll();
     drpCatergori.DataTextField  = "TITLE";
     drpCatergori.DataValueField = "ID";
     drpCatergori.DataBind();
 }
예제 #5
0
 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));
 }
예제 #6
0
 public static bool InsertNewCategory(ECategories category)
 {
     if (category.Name == "")
     {
         return(false);
     }
     else
     {
         DALCategories.InsertNewCategory(category);
         return(true);
     }
 }
예제 #7
0
        public String GetCategorieName(int id)
        {
            CATEGORIES c = DALCategories.Get(id);

            if (c != null)
            {
                return(c.TITLE);
            }
            else
            {
                return("Boş");
            }
        }
예제 #8
0
        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));
        }
예제 #9
0
 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";
         }
     }
 }
예제 #10
0
        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);
        }
예제 #11
0
 public static bool Update(ECategories category)
 {
     DALCategories.Update(category);
     return(true);
 }
예제 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     rptrCategories.Bind(DALCategories.GetAll());
     rptPost.Bind(DALBlog.GetLastCount(1));
     rptLastPost.Bind(DALBlog.GetLastCount(3));
 }
예제 #13
0
 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));
 }
예제 #14
0
 private void fillCategories()
 {
     rptCountCategories = DALCategories.getCount();
     rptCategories.Bind(DALCategories.GetAll().OrderBy(p => p.SORT));
     lblCountCategories.Text = "(" + rptCountCategories.ToString() + ")";
 }
예제 #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.AsyncMode = true;
     rptrCategories.Bind(DALCategories.GetAll());
     rptLastPost.Bind(DALBlog.GetLastCount(3));
 }
예제 #16
0
 public static bool Delete(ECategories category)
 {
     DALCategories.Delete(category);
     return(true);
 }
예제 #17
0
 public static List <ECategories> GetAll()
 {
     return(DALCategories.GetAll());
 }
예제 #18
0
 public static ECategories GetIdOnly(int categoryID)
 {
     return(DALCategories.GetIdOnly(categoryID));
 }