Ejemplo n.º 1
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;
            }
            }
        }
Ejemplo n.º 2
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;
     }
 }
Ejemplo n.º 3
0
 public static bool Update(ECategories category)
 {
     DALCategories.Update(category);
     return(true);
 }