public bool updateDefence(Defence def) { try { string jsonStr = JsonConvert.SerializeObject(def); string jsonResult = sDefence.update(jsonStr); System.Diagnostics.Debug.WriteLine(jsonResult); } catch (System.Exception ex) { System.Windows.MessageBox.Show(ex.Message); return false; } return true; }
void initDefence() { _def = wsAdapter.queryDefenceByChannel(selectedCamera, selectedChannel); if (_def.dType != "ruleDefence") { setComboItem(_dType, "一键布撤防"); } else { setComboItem(_dType, "规则布撤防"); } if (_def.dState == "yes") { setComboItem(_dState, "布防"); } else { setComboItem(_dState, "撤防"); } foreach (DefenceRule dr in _def.defSRuleList) { DefenceRuleDataSource ds = new DefenceRuleDataSource(); ds.week = dr.week; ds.stime = dr.stime; ds.etime = dr.etime; ds.isSelected = false; dm.DefenceList.Add(ds); } if (_def.dType == "onekeyDefence") { _ruleDefenceGrid.Visibility = Visibility.Hidden; return; } }