protected void btnXoa_Click(object sender, EventArgs e) { cls_LienHe cls; List <object> selectedKey = grvList.GetSelectedFieldValues(new string[] { "lienhe_id" }); if (selectedKey.Count > 0) { foreach (var item in selectedKey) { cls = new cls_LienHe(); 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_LienHe cls = new cls_LienHe(); if (checknull() == false) { alert.alert_Warning(Page, "Nhập đầy đủ thông tin!", ""); } else { if (Session["_id"].ToString() == "0") { if (cls.Linq_Them(txtemail.Text, txtphone.Text, txtaddress.Text)) { 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()), txtemail.Text, txtphone.Text, txtaddress.Text)) { alert.alert_Success(Page, "Cập nhật thành công", ""); //popupControl.ShowOnPageLoad = false; loadData(); } else { alert.alert_Error(Page, "Cập nhật thất bại", ""); } } } }