//------------------------------------------------------------------------------ /// Returns the array associated with the key /// /// @param key - key to search for /// /// @return JSonObject array //------------------------------------------------------------------------------ public JSonObject[] GetJSonArray(String key) { Object o = GetValue(key); if (o == null) { throw new Exception("Key not found: " + key); } Object[] s = (Object[])o; JSonObject[] arr = new JSonObject[s.Length]; for (int i = 0; i < s.Length; i++) { arr[i] = (JSonObject)s[i]; } return(arr); }
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>"); } }
//------------------------------------------------------------------------------ /// Returns the array associated with the key /// /// @param key - key to search for /// /// @return JSonObject array //------------------------------------------------------------------------------ public JSonObject[] GetJSonArray(String key) { Object o = GetValue(key); if (o == null) throw new Exception("Key not found: " + key); Object[] s = (Object[])o; JSonObject[] arr = new JSonObject[s.Length]; for (int i = 0; i < s.Length; i++) { arr[i] = (JSonObject)s[i]; } return arr; }