public static bool Update(MucLucDTO mucLuc) { string sql = "sp_MucLuc_Update"; List<SqlParameter> ds = new List<SqlParameter>(); ds.Add(new SqlParameter("@ID_Claim", mucLuc.ID_Claim)); ds.Add(new SqlParameter("@ClaimType", mucLuc.ClaimType)); ds.Add(new SqlParameter("@JsonValue", mucLuc.JsonValue)); return SqlDataAcessHelper.exNonStoreParas(sql, ds); }
public static MucLucDTO getMucLuc(string ID_Claim, string ClaimType) { string sql = "sp_MucLuc_Select"; List<SqlParameter> ds = new List<SqlParameter>(); ds.Add(new SqlParameter("@ID_Claim", ID_Claim)); ds.Add(new SqlParameter("@ClaimType", ClaimType)); DataTable dt = SqlDataAcessHelper.exStoreParas(sql, ds); if(dt.Rows.Count > 0 ) { MucLucDTO mucLuc = new MucLucDTO(); mucLuc.ID_Claim = dt.Rows[0]["ID_Claim"].ToString(); mucLuc.ClaimType = dt.Rows[0]["ClaimType"].ToString(); mucLuc.JsonValue = dt.Rows[0]["JsonValue"].ToString(); return mucLuc; } return null; }
protected void update_Click(object sender, EventArgs e) { if (mClaimType == "PR") { JSonObject jsonValue = new JSonObject(); jsonValue.Put("GioiThieuChung", ckbPR_GioiThieuChung.Checked.ToString()); jsonValue.Put("NguoiDuocBaoHiem", ckbPR_NguoiDuocBaoHiem.Checked.ToString()); jsonValue.Put("DienBien", ckbPR_DienBien.Checked.ToString()); jsonValue.Put("NguyenNhan", ckbPR_NguyenNhan.Checked.ToString()); jsonValue.Put("PhamViBaoHiem", ckbPR_PhamViBaoHiem.Checked.ToString()); jsonValue.Put("PhamViVaMucDoThietHai", ckbPR_PhamViVaMucDoThietHai.Checked.ToString()); jsonValue.Put("DonBaoHiemKhac", ckbPR_DonBaoHiemKhac.Checked.ToString()); jsonValue.Put("GiaTriThuHoi", ckbPR_GiaTriThuHoi.Checked.ToString()); jsonValue.Put("TheQuyenTruyDoiBenThuBa", ckbPR_TheQuyenTruyDoiBenThuBa.Checked.ToString()); jsonValue.Put("DuPhongBoiThuong", ckbPR_DuPhongBoiThuong.Checked.ToString()); jsonValue.Put("TamUngBoiThuongText", ckbPR_TamUngBoiThuongText.Checked.ToString()); jsonValue.Put("BaoCaoTiepTheo", ckbPR_BaoCaoTiepTheo.Checked.ToString()); MucLucDTO mucLucDTO = MucLucDAO.getMucLuc(mClaimID, mClaimType); if (mucLucDTO == null) { mucLucDTO = new MucLucDTO(); mucLucDTO.ID_Claim = mClaimID; mucLucDTO.ClaimType = mClaimType; mucLucDTO.JsonValue = jsonValue.ToString(); MucLucDAO.Insert(mucLucDTO); } else { mucLucDTO.JsonValue = jsonValue.ToString(); MucLucDAO.Update(mucLucDTO); } Response.Write("<script> window.parent.closeAllDialog(); </script>"); Response.Write("<script> window.parent.reloaData(); </script>"); } }