Ejemplo n.º 1
0
        protected void submit_edit_Click(object sender, EventArgs e)
        {
            int           id   = Convert.ToInt32(hidden_id.Value);
            DanhMucNhaDat cate = new DanhMucNhaDat();

            cate.TenDanhMuc = txtTenDanhMuc_edit.Text;
            cate.MoTa       = txtMoTa_edit.Text;
            cate.status     = checkStatus_edit.Checked;;
            obj.update(cate, id);
            //load list
            Response.Redirect(Request.Url.ToString());
        }
Ejemplo n.º 2
0
        protected void submit_create_Click(object sender, EventArgs e)
        {
            //kiem tra trong
            if (txtMoTa_create.Text == "" || txtTenDanhMuc_create.Text == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "vanh", "blank()", true);
                return;
            }
            //them
            DanhMucNhaDat cate = new DanhMucNhaDat();

            cate.TenDanhMuc = txtTenDanhMuc_create.Text;
            cate.MoTa       = txtMoTa_create.Text;

            /*cate.status = true;
             * if (!checkStatus_create.Checked) cate.status = false;*/
            cate.status     = checkStatus_create.Checked;
            cate.created_at = DateTime.Now;

            obj.create(cate);
            //load list
            Response.Redirect(Request.Url.ToString());
        }
Ejemplo n.º 3
0
        public void update(DanhMucNhaDat c, int id)
        {
            string sql = "update tbl_DanhMucNhaDat set TenDanhMuc = N'" + c.TenDanhMuc + "', MoTa =  N'" + c.MoTa + "', status = '" + c.status + "' where id = '" + id + "'";

            obj.ExecuteNonQuery(sql);
        }
Ejemplo n.º 4
0
        public void create(DanhMucNhaDat c)
        {
            string sql = "insert tbl_DanhMucNhaDat values(N'" + c.TenDanhMuc + "' , N'" + c.MoTa + "', '" + c.status + "', '" + c.created_at + "'  )";

            obj.ExecuteNonQuery(sql);
        }