Esempio n. 1
0
        protected void rptrBlog_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Down":
            {
                BLOG self  = DALBlog.Get(Int32.Parse(e.CommandArgument.ToString()));
                BLOG upper = DALBlog.GetBySort(self.SORT + 1);
                self.SORT++;
                upper.SORT--;
                DALBlog.Update(self);
                DALBlog.Update(upper);
                fillBlog();
                break;
            }

            case "Up":
            {
                BLOG self  = DALBlog.Get(Int32.Parse(e.CommandArgument.ToString()));
                BLOG upper = DALBlog.GetBySort(self.SORT - 1);
                self.SORT--;
                upper.SORT++;
                DALBlog.Update(self);
                DALBlog.Update(upper);
                fillBlog();
                break;
            }
            }
        }
Esempio n. 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateItem())
     {
         BLOG rec = new BLOG();
         if (RECid > 0)
         {
             rec = DALBlog.Get(RECid);
             if (!string.IsNullOrEmpty(IMAGE))
             {
                 rec.IMAGE = IMAGE;
             }
             if (!string.IsNullOrEmpty(txtVideo.Text))
             {
                 rec.ISIMAGE   = false;
                 rec.ISVIDEO   = true;
                 rec.ISARTICLE = false;
             }
             else if (!string.IsNullOrEmpty(rec.IMAGE))
             {
                 rec.ISIMAGE   = true;
                 rec.ISVIDEO   = false;
                 rec.ISARTICLE = false;
             }
             else
             {
                 rec.ISIMAGE   = false;
                 rec.ISVIDEO   = false;
                 rec.ISARTICLE = true;
             }
             if (drpCatergori.Items.Count >= 1)
             {
                 rec.CATEGORIESID = Int32.Parse(drpCatergori.SelectedItem.Value);
             }
             else
             {
                 rec.CATEGORIESID = -1;
             }
             rec.EDITOR    = ONLINEUSER.NAME;
             rec.ALT       = txtAlt.Text;
             rec.ISACTIVE  = chkActive.Checked;
             rec.MAINTEXT  = Server.HtmlEncode(hdnDescription.Value);
             rec.TITLE     = txtTitle.Text;
             rec.URLSEO    = Code.Helper.SEOUrl(txtTitle.Text);
             rec.VIDEOCODE = txtVideo.Text;
             DALBlog.Update(rec);
         }
         else
         {
             if (!string.IsNullOrEmpty(txtVideo.Text))
             {
                 rec.ISIMAGE   = false;
                 rec.ISVIDEO   = true;
                 rec.ISARTICLE = false;
             }
             else if (!string.IsNullOrEmpty(IMAGE))
             {
                 rec.ISIMAGE   = true;
                 rec.ISVIDEO   = false;
                 rec.ISARTICLE = false;
             }
             else
             {
                 rec.ISIMAGE   = false;
                 rec.ISVIDEO   = false;
                 rec.ISARTICLE = true;
             }
             if (drpCatergori.Items.Count >= 1)
             {
                 rec.CATEGORIESID = Int32.Parse(drpCatergori.SelectedItem.Value);
             }
             else
             {
                 rec.CATEGORIESID = -1;
             }
             rec.VIDEOCODE = txtVideo.Text;
             rec.EDITOR    = ONLINEUSER.NAME;
             rec.IMAGE     = IMAGE;
             rec.SORT      = Convert.ToInt16(DALBlog.GetLastSort() + 1);
             rec.ALT       = txtAlt.Text;
             rec.ISACTIVE  = chkActive.Checked;
             rec.MAINTEXT  = Server.HtmlEncode(hdnDescription.Value);
             rec.TITLE     = txtTitle.Text;
             rec.URLSEO    = Code.Helper.SEOUrl(txtTitle.Text);
             rec.DATE      = DateTime.Now;
             DALBlog.Insert(rec);
         }
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true);
         btnDelete.Visible = false;
         btnCancel.Visible = false;
     }
 }