/// <summary> /// 删除countrytest /// </summary> /// <param name="uniqueId"></param> /// <param name="msg"></param> /// <returns></returns> public bool DelCountryTest(int uniqueId, ref string msg) { XML_CountryTest _test = AllCountryTest.SingleOrDefault(c => c.UniqueId == uniqueId); if (_test != null) { lock (AllCountryTest) { AllCountryTest.Remove(_test); DelCountryTestFromXML(uniqueId); return(true); } } else { msg = "不存在这个站点"; return(false); } }
/// <summary> /// 修改countrytest /// </summary> /// <param name="_test"></param> /// <param name="msg"></param> /// <returns></returns> public bool EditCountryTest(XML_CountryTest _test, ref string msg) { bool flag = true; try { lock (AllCountryTest) { XML_CountryTest s = AllCountryTest.SingleOrDefault(c => c.UniqueId == _test.UniqueId); AllCountryTest.Remove(s); //先把这个对象删了 AllCountryTest.Add(_test); //再把新的对象添加进去 flag = EditCountryTestFromXML(_test); } } catch (Exception ex) { LogMg.AddError(ex); flag = false; } return(flag); }