protected void btnXoa_Click(object sender, EventArgs e) { cls_ProductCate cls; List <object> selectedKey = grvList.GetSelectedFieldValues(new string[] { "productcate_id" }); if (selectedKey.Count > 0) { foreach (var item in selectedKey) { cls = new cls_ProductCate(); tbProductCate checkImage = (from i in db.tbProductCates where i.productcate_id == Convert.ToInt32(item) select i).SingleOrDefault(); if (cls.Linq_Xoa(Convert.ToInt32(item))) { alert.alert_Success(Page, "Xóa thành công", ""); } else { alert.alert_Error(Page, "Xóa thất bại", ""); } } } else { alert.alert_Warning(Page, "Bạn chưa chọn dữ liệu", ""); } }
protected void btnLuu_Click(object sender, EventArgs e) { cls_ProductCate cls = new cls_ProductCate(); // bool tinhtrang = ddltinhtrang.Text == "Hiển thị" ? true : false; if (checknull() == false) { alert.alert_Warning(Page, "Vui lòng nhập đầy đủ thông tin!", ""); } else { string KEYWORD = "", TitleSeo = "", Link = "", Dep = "", ImageSeo = ""; { if (SEO_KEYWORD.Text != "") { KEYWORD = SEO_KEYWORD.Text; } if (SEO_TITLE.Text != "") { TitleSeo = SEO_TITLE.Text; } if (SEO_LINK.Text != "") { Link = SEO_LINK.Text; } if (SEO_DEP.Value != "") { Dep = SEO_DEP.Value; } //if (SEO_IMAGE.Text != "") //{ // ImageSeo = SEO_IMAGE.Text; //} } if (Session["_id"].ToString() == "0") { if (cls.Linq_Them(txtloaisanpham.Text, 1, KEYWORD, TitleSeo, Link, Dep, ImageSeo)) { alert.alert_Success(Page, "Thêm thành công", ""); } else { alert.alert_Error(Page, "Thêm thất bại", ""); } } else { if (cls.Linq_Sua(Convert.ToInt32(Session["_id"].ToString()), txtloaisanpham.Text, 1, KEYWORD, TitleSeo, Link, Dep, ImageSeo)) { alert.alert_Success(Page, "Cập nhật thành công", ""); } else { alert.alert_Error(Page, "Cập nhật thất bại", ""); } } } }