Ejemplo n.º 1
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            int idgdv = int.Parse(Request.Cookies["MaGDV"].Value);

            NewsDTO news = new NewsDTO();

            news.Title        = txtTitle.Text;
            news.LinkImages   = txtLinkImage.Text;
            news.Brief        = txtBrief.Text;
            news.Contents     = txtContents.Text;
            news.DateCreated  = DateTime.Now;
            news.DateModified = DateTime.Now;
            news.ID_GDVPost   = idgdv;
            news.ID_GDVEdit   = idgdv;

            int[]  aSelected = listBoxType.GetSelectedIndices();
            String type      = "";

            for (int i = 0; i < aSelected.Length; i++)
            {
                string value = listBoxType.Items[aSelected[i]].Value;
                type += value;
                if (i != aSelected.Length - 1)
                {
                    type += ", ";
                }
            }
            news.ID_Types = type;

            lblStatus.Text = "";
            if (newsDao.CreateNew(news))
            {
                SaveLogTracking(idgdv, gdv.LayTenTheoMa(idgdv) + " viết bài: " + txtTitle.Text, "Blogs");
                Response.Write("<script> window.parent.closeDialog(); </script>");
                Response.Write("<script> window.parent.Refresh();</script>");
            }
            else
            {
                lblStatus.Text = "Create Error";
            }
        }