public List<clsCateNew> GetAll()
        {
            try
            {
                List<clsCateNew> list = new List<clsCateNew>();
                string str = "select * from tblCateNew";
                SqlCommand com = new SqlCommand(str, con.getCon());
                con.openCon();
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    clsCateNew obj = new clsCateNew();
                    if (dr["tieude"] != DBNull.Value)
                    {
                        obj.TieuDe = dr["tieude"].ToString();
                    }
                    if (dr["id"] != DBNull.Value)
                    {
                        obj.Id = Convert.ToInt32(dr["id"].ToString());
                    }
                    list.Add(obj);
                }
                return list;
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }
        public clsCateNew GetById(int id)
        {
            try
            {
                clsCateNew obj = new clsCateNew();
                string str = "select * from tblCateNew where id=@id";
                SqlCommand com = new SqlCommand(str, con.getCon());
                com.Parameters.AddWithValue("@id", id);
                con.openCon();
                SqlDataReader dr = com.ExecuteReader();
                if (dr.Read())
                {
                    obj.Id = id;
                    if (dr["tieude"] != DBNull.Value)
                    {
                        obj.TieuDe = dr["tieude"].ToString();
                    }

                }
                return obj;
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }
        public int Insert(clsCateNew obj)
        {
            try
            {
                return this.obj.Insert(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }
        public void Delete(clsCateNew obj)
        {
            try
            {
                this.obj.Delete(obj.Id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                clsCateNew cate = new clsCateNew();
                cate.TieuDe = this.TextBox1.Text;
                obj.Insert(cate);
                this.TextBox1.Text = "";
                this.Page.ClientScript.RegisterStartupScript(Page.GetType(), "show", "<script type='text/javascript'>alert('Thêm mới thành công')</script>");
                this.odsCateNews.DataBind();
                this.GridView1.DataBind();
            }
            catch (Exception)
            {

                throw;
            }
        }
        public void Update(clsCateNew obj)
        {
            try
            {
                string str = "Update tblCateNew set tieude=@tieude where id=@id";
                SqlCommand com = new SqlCommand(str, con.getCon());
                com.Parameters.AddWithValue("@tieude", obj.TieuDe);
                com.Parameters.AddWithValue("@id", obj.Id);
                con.openCon();
                com.ExecuteNonQuery();
                con.closeCon();
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }
        public int Insert(clsCateNew obj)
        {
            try
            {
                string str = "insert into tblCateNew(tieude) values(@tieude)";
                SqlCommand com = new SqlCommand(str, con.getCon());
                com.Parameters.AddWithValue("@tieude", obj.TieuDe);
                con.openCon();
                com.ExecuteNonQuery();
                con.closeCon();
                return clsDAStaticMethod.getIDIdentity("tblCateNew");
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }
        public void Update(clsCateNew obj)
        {
            try
            {
                this.obj.Update(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }