Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TinTucBUL ttBUL = new TinTucBUL();

            param           = int.Parse(Request.QueryString["MaTinTuc"].ToString());
            HyperLink3.Text = ttBUL.getTitle(param);
            Label1.Text     = ttBUL.getTitle(param);
            Literal1.Text   = ttBUL.getDes(param);
            Image1.ImageUrl = ttBUL.getImg(param);
            Literal2.Text   = ttBUL.getCtn(param);
        }
        protected void btnSend_Click(object sender, EventArgs e)
        {
            //Check ma trung
            TinTucBUL ttBUL = new TinTucBUL();

            if (txtMa.Text.Equals("") || txtMoTa.Equals("") || txtNoiDung.Equals("") || txtTieuDe.Equals(""))
            {
                Response.Write("<script>alert('Vui lòng nhập đủ thông tin!');</script>");
            }
            else
            {
                if (ttBUL.isTrung(int.Parse(txtMa.Text)) == true)
                {
                    Response.Write("<script>alert('Lỗi!');</script>");
                }
                else
                {
                    if (ttBUL.create(int.Parse(txtMa.Text), txtTieuDe.Text, Image1.ImageUrl, txtMoTa.Text, txtNoiDung.Text, Calendar1.SelectedDate.ToShortDateString().ToString(), int.Parse(DropDownList1.SelectedValue)) == true)
                    {
                        Response.Redirect("Admin_New.aspx");
                    }
                }
            }
        }