protected void btnXoa_Click(object sender, EventArgs e) { cls_Introduce cls; List <object> selectedKey = grvList.GetSelectedFieldValues(new string[] { "introduct_id" }); if (selectedKey.Count > 0) { foreach (var item in selectedKey) { cls = new cls_Introduce(); 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_Introduce cls = new cls_Introduce(); if (Page.IsValid && FileUpload1.HasFile) { string filename = (FileUpload1.FileName); string fileName_save = Path.Combine(Server.MapPath("~/uploadimages"), filename); FileUpload1.SaveAs(fileName_save); image = "/uploadimages/" + filename; } if (checknull() == false) { alert.alert_Warning(Page, "Hãy 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(txtTitle.Text, txtTitle1.Text, txtSummary.Value, edtnoidung.Html, image)) { alert.alert_Success(Page, "Thêm thành công", ""); loadData(); } else { alert.alert_Error(Page, "Thêm thất bại", ""); } } else { if (cls.Linq_Sua(Convert.ToInt32(Session["_id"].ToString()), txtTitle.Text, txtTitle1.Text, txtSummary.Value, edtnoidung.Html, image, KEYWORD, TitleSeo, Link, Dep, ImageSeo)) { //alert.alert_Success(Page, "Cập nhật thành công", ""); ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Alert", "swal('Cập nhật thành công','','success').then(function(){grvList.Refresh();})", true); popupControl.ShowOnPageLoad = false; loadData(); } else { alert.alert_Error(Page, "Cập nhật thất bại", ""); } } } //loadData(); //popupControl.ShowOnPageLoad = false; }