예제 #1
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            var    z  = ckcontent.InnerText;
            var    z2 = HttpUtility.HtmlEncode(z);// Encode va Decode
            string id = Request["id"];
            //get value
            string pt = txtPhoto.ImageUrl;

            if (FileUpload1.FileName != "")
            {
                pt = "~/Image/news/" + FileUpload1.FileName;
            }
            n_DTO            = new DTO_News();
            n_DTO.newID      = id;
            n_DTO.title      = txtTitle.Text;
            n_DTO.summary    = txtSummary.Text;
            n_DTO.photo      = pt;
            n_DTO.statusNews = Int32.Parse(DropDownStatus.SelectedValue.ToString());
            news.updateNew(n_DTO.newID, n_DTO.title, n_DTO.photo, z2, n_DTO.statusNews, n_DTO.summary);
            saveUpLoadFile();
            Response.Redirect("/News.aspx");
        }
 protected void btnThem_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         var z  = ckcontent.InnerText;
         var z2 = HttpUtility.HtmlEncode(z);
         newD = new DTO_News();
         string pt = "";
         if (FileUpload1.FileName != "")
         {
             pt = "~/Image/news/" + FileUpload1.FileName;
         }
         newD.newID      = txtNewID.Text;
         newD.title      = txtTitle.Text;
         newD.summary    = txtSummary.Text;
         newD.statusNews = Convert.ToInt32(DropDownStatusAdd.SelectedValue.ToString());
         newD.photo      = pt;
         newB.insertNew(newD.newID, newD.title, newD.photo, z2, Int32.Parse(DropDownStatusAdd.SelectedValue), newD.summary);
         saveUpLoadFile();
         Response.Redirect("/News.aspx");
     }
 }