private void button_Set_Click(object sender, EventArgs e) { //Validate(textBox_Val.Text.Trim()) && if (comboBox_STCD.SelectedValue != null) { Service.Model.YY_RTU_CONFIGDATA model = new Service.Model.YY_RTU_CONFIGDATA(); model.STCD = comboBox_STCD.SelectedValue.ToString(); model.ItemID = comboBox_Item.SelectedValue.ToString(); model.ConfigID = comboBox_ConfigItem.SelectedValue.ToString(); model.ConfigVal = textBox_Val.Text.Trim(); PublicBD.db.DelRTU_ConfigData(" where STCD='" + model.STCD + "' and ItemID='" + model.ItemID + "' and ConfigID='" + model.ConfigID + "'"); bool b = PublicBD.db.AddRTU_ConfigData(model); if (b) { textBox_Val.Text = ""; DevComponents.DotNetBar.MessageBoxEx.Show("数据添加成功!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); Search(); } else { DevComponents.DotNetBar.MessageBoxEx.Show("数据添加失败!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private bool Insert00() // ConfigID 110000000000 ItemID 0000000000 { string where = " where ItemID='0000000000' and ConfigID='110000000000'"; bool b = Service.PublicBD.db.DelRTU_ConfigData(where); if (b) { for (int i = 0; i < cbl_Item.Items.Count; i++) { if (cbl_Item.GetItemChecked(i)) { cbl_Item.SetSelected(i, true); string STCD = cbl_Item.SelectedValue.ToString(); Service.Model.YY_RTU_CONFIGDATA model = new Service.Model.YY_RTU_CONFIGDATA(); model.STCD = STCD; model.ItemID = "0000000000"; model.ConfigID = "110000000000"; b = Service.PublicBD.db.AddRTU_ConfigData(model); } } } return(b); }
/// <summary> /// 更新或写入测站卫星号码(仅用于卫星信道) /// </summary> /// <param name="CS"></param> /// <param name="Satellite">卫星号码</param> /// <param name="STCD">站号</param> public void InsertComMobile(ComServer CS, string Satellite, string STCD) { var temp = from c in CS.Cs where c.SATELLITE == Satellite && c.STCD == STCD select c; if (temp.Count() == 0) { Service.Model.YY_RTU_CONFIGDATA Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = STCD; Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA08"; Model.ConfigVal = Satellite; Service.PublicBD.db.DelRTU_ConfigData("where STCD='" + STCD + "' and ConfigID = '11000000AA08'"); Service.PublicBD.db.AddRTU_ConfigData(Model); } }
/// <summary> /// 更新或写入测站手机号码(仅用于短信信道) /// </summary> /// <param name="GS"></param> /// <param name="Mobile">手机号</param> /// <param name="STCD">站号</param> public void InsertGsmMobile(GsmServer GS, string Mobile, string STCD) { var temp = from g in GS.Gs where g.MOBILE == Mobile && g.STCD == STCD select g; if (temp.Count() == 0) { Service.Model.YY_RTU_CONFIGDATA Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = STCD; Model.ItemID = "0000000000"; Model.ConfigID = "10000000AA07"; Model.ConfigVal = Mobile; Service.PublicBD.db.DelRTU_ConfigData("where STCD='" + STCD + "' and ConfigID = '10000000AA07'"); Service.PublicBD.db.AddRTU_ConfigData(Model); } }
private string Validate(out List <Service.Model.YY_RTU_CONFIGDATA> list) { string msg = ""; list = new List <Service.Model.YY_RTU_CONFIGDATA>(); Service.Model.YY_RTU_CONFIGDATA Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000000C"; Model.ConfigVal = (comboBox_MODE.SelectedIndex + 1).ToString(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "110000000020"; Model.ConfigVal = comboBox_20.Items[comboBox_20.SelectedIndex].ToString(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "110000000022"; Model.ConfigVal = comboBox_22.Items[comboBox_22.SelectedIndex].ToString(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "110000000025"; Model.ConfigVal = comboBox_25.Items[comboBox_25.SelectedIndex].ToString(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "110000000026"; Model.ConfigVal = comboBox_26.Items[comboBox_26.SelectedIndex].ToString(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA01"; Model.ConfigVal = comboBox_STtype.SelectedValue.ToString(); list.Add(Model); int _24 = 0; if (textBox_24.Text.Trim().Length > 0) { if (int.TryParse(textBox_24.Text.Trim(), out _24) && (_24 >= 1 && _24 <= 59)) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "110000000024"; Model.ConfigVal = _24.ToString(); list.Add(Model); } else { msg += "水位数据存储间隔输入有误!" + "\n"; } } int _21 = 0; if (textBox_21.Text.Trim().Length > 0) { if (int.TryParse(textBox_21.Text.Trim(), out _21) && (_21 >= 0 && _21 <= 59)) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "110000000021"; Model.ConfigVal = _21.ToString(); list.Add(Model); } else { msg += "加报时间间隔输入有误!" + "\n"; } } int _23 = 0; if (textBox_23.Text.Trim().Length > 0) { if (int.TryParse(textBox_23.Text.Trim(), out _23) && (_23 >= 0 && _23 <= 9999)) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "110000000023"; Model.ConfigVal = _23.ToString(); list.Add(Model); } else { msg += "采样间隔输入有误!" + "\n"; } } string CheckedStr = ""; for (int i = 1; i < 65; i++) { foreach (var item in tabPage1.Controls) { if (item is CheckBox && (item as CheckBox).Name == "cb" + i) { if ((item as CheckBox).Checked) { CheckedStr += "1"; } else { CheckedStr += "0"; } } } } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000000D"; Model.ConfigVal = CheckedStr; list.Add(Model); if (textBox_RelayAddress.Text.Trim().Length > 0) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000000E"; Model.ConfigVal = textBox_RelayAddress.Text.Trim(); list.Add(Model); } if (textBox_0F.Text.Trim().Length > 0) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000000F"; Model.ConfigVal = (comboBox_0F.SelectedIndex + 1) + "," + textBox_0F.Text.Trim(); list.Add(Model); } if (textBox_0F.Text.Trim() != "")//1,12345或2,12345 { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA07"; Model.ConfigVal = textBox_PhoneNum.Text.Trim(); list.Add(Model); } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA02"; Model.ConfigVal = GetTabPage2Str(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA04"; Model.ConfigVal = GetTabPage3Str_1(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA05"; Model.ConfigVal = GetTabPage3Str_2(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA06"; Model.ConfigVal = GetTabPage3Str_3(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA07"; Int64 PhoneNum = 0; if (textBox_PhoneNum.Text.Trim().Length > 0) { if (Int64.TryParse(textBox_PhoneNum.Text.Trim(), out PhoneNum) && textBox_PhoneNum.Text.Trim().Length >= 11) { Model.ConfigVal = textBox_PhoneNum.Text.Trim(); list.Add(Model); } else { msg += "手机号输入有误!" + "\n"; } } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000AA08"; Int64 SatelliteNum = 0; if (textBox_SatelliteNum.Text.Trim().Length > 0) { if (Int64.TryParse(textBox_SatelliteNum.Text.Trim(), out SatelliteNum)) { Model.ConfigVal = textBox_SatelliteNum.Text.Trim(); list.Add(Model); } else { msg += "卫星号输入有误!" + "\n"; } } #region 黑龙江增 最低控制水位--FF03 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "11000000FF03"; decimal FF03 = 0; if (textBox_FF03.Text.Trim().Length > 0) { if (decimal.TryParse(textBox_FF03.Text.Trim(), out FF03)) { if (Math.Floor(FF03).ToString().Length > 7) { msg += "最低控制水位输入有误!" + "\n"; } else { Model.ConfigVal = FF03.ToString("f3"); list.Add(Model); } } else { msg += "最低控制水位输入有误!" + "\n"; } } #endregion return(msg); }
private string Validate(out List <Service.Model.YY_RTU_CONFIGDATA> CONFIGDATAList) { List <Service.Model.YY_RTU_CONFIGDATA> list = new List <Service.Model.YY_RTU_CONFIGDATA>(); string msg = ""; #region 工作模式 Service.Model.YY_RTU_CONFIGDATA Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000000012"; if (comboBox_MODE.SelectedIndex == -1) { msg += "请选择工作模式!" + "\n"; } else { Model.ConfigVal = comboBox_MODE.SelectedIndex.ToString(); } list.Add(Model); #endregion #region 工作机(值班/备份)是否自动切换 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000001ED0"; if (checkBox_AutoSwitch.Checked) { Model.ConfigVal = "1"; } else { Model.ConfigVal = "0"; } list.Add(Model); #endregion #region 工作机中继是否允许转发 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000001ED2"; if (checkBox_Relaying.Checked) { Model.ConfigVal = "1"; } else { Model.ConfigVal = "0"; } list.Add(Model); #endregion #region 电源报警是否主动上报 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000001ED4"; if (checkBox_PowerReport.Checked) { Model.ConfigVal = "1"; } else { Model.ConfigVal = "0"; } list.Add(Model); #endregion #region 工作机切换是否主动上报 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000001ED5"; if (checkBox_SwitchReport.Checked) { Model.ConfigVal = "1"; } else { Model.ConfigVal = "0"; } list.Add(Model); #endregion #region 出现故障是否主动上报 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000001ED6"; if (checkBox_FaultReport.Checked) { Model.ConfigVal = "1"; } else { Model.ConfigVal = "0"; } list.Add(Model); #endregion #region 定值控制 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000000032"; if (checkBox_FixValueStatus.Checked) { Model.ConfigVal = "1"; } else { Model.ConfigVal = "0"; } list.Add(Model); #endregion #region IC卡功能是否有效 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000000030"; if (checkBox_ICStatus.Checked) { Model.ConfigVal = "1"; } else { Model.ConfigVal = "0"; } list.Add(Model); #endregion #region 手机号 if (textBox_PhoneNum.Text.Trim().Length > 0) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "12000000AA07"; Int64 PhoneNum = 0; if (Int64.TryParse(textBox_PhoneNum.Text.Trim(), out PhoneNum) && textBox_PhoneNum.Text.Trim().Length >= 11) { Model.ConfigVal = textBox_PhoneNum.Text.Trim(); } else { msg += "手机号输入有误!" + "\n"; } list.Add(Model); } #endregion #region 卫星号 if (textBox_SatelliteNum.Text.Trim().Length > 0) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "12000000AA08"; Int64 SatelliteNum = 0; if (Int64.TryParse(textBox_SatelliteNum.Text.Trim(), out SatelliteNum)) { Model.ConfigVal = textBox_SatelliteNum.Text.Trim(); } else { msg += "卫星号输入有误!" + "\n"; } list.Add(Model); } #endregion #region 定值量 if (textBox_FixValue.Text.Trim().Length > 0) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000000034"; double FixValue = 0; if (double.TryParse(textBox_FixValue.Text.Trim(), out FixValue)) { if (FixValue >= -99.999 && FixValue <= 99.999) { Model.ConfigVal = FixValue.ToString(); } else { msg += "定值量输入有误!" + "\n"; } } else { msg += "定值量输入有误!" + "\n"; } list.Add(Model); } #endregion #region 中继引导码长 if (textBox_RelayLength.Text.Trim().Length > 0) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "12000000001C"; int RelayLength = 0; if (int.TryParse(textBox_RelayLength.Text.Trim(), out RelayLength)) { if (RelayLength >= 0 && RelayLength <= 255) { Model.ConfigVal = RelayLength.ToString(); } else { msg += "中继引导码长输入有误!" + "\n"; } } else { msg += "中继引导码长输入有误!" + "\n"; } list.Add(Model); } #endregion #region 中继站转发终端地址 if (textBox_RelayAddress.Text.Trim().Length > 0) { Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "12000000001D"; string[] stcds = textBox_RelayAddress.Text.Trim().Split(new char[] { ',' }); foreach (var item in stcds) { if (item.Length != 10) { msg += "中继站转发终端地址输入有误!" + "\n"; break; } } Model.ConfigVal = textBox_RelayAddress.Text.Trim(); list.Add(Model); } #endregion #region 工作机切换 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000000095"; if (radGZ_A.Checked) { Model.ConfigVal = "1"; } else if (radGZ_B.Checked) { Model.ConfigVal = "0"; } if (radGZ_A.Checked != radGZ_B.Checked) { list.Add(Model); } #endregion #region 通信机切换 Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "120000000094"; if (radTX_A.Checked) { Model.ConfigVal = "1"; } else if (radTX_B.Checked) { Model.ConfigVal = "0"; } if (radTX_A.Checked != radTX_B.Checked) { list.Add(Model); } #endregion #region SLD bool b1 = true, b2 = true, b3 = true; string Cbs = (cb1.Checked ? "1" : "0") + "," + (cb2.Checked ? "1" : "0") + "," + (cb3.Checked ? "1" : "0") + "," + (cb4.Checked ? "1" : "0") + "," + (cb5.Checked ? "1" : "0") + "," + (cb6.Checked ? "1" : "0") + "," + (cb7.Checked ? "1" : "0") + "," + (cb8.Checked ? "1" : "0") + "," + (cb9.Checked ? "1" : "0"); if (Cbs == "0,0,0,0,0,0,0,0,0") { b1 = false; } string Elevation = textBox_Elevation.Text.Trim(); decimal elevation = 0; if (Elevation == "") { b2 = false; } else { if (!decimal.TryParse(Elevation, out elevation)) { msg += "SLD计算流量的[设备安装点高程]输入有误!" + "\n"; } } string stage = ""; BindingList <Stage> StageList = dataGridView3.DataSource as BindingList <Stage>; if (StageList == null || StageList.Count() == 0) { b3 = false; } else if (StageList.Count() == 1) { b3 = false; msg += "SLD计算流量的[水位、流量关系数据]至少输入2组!" + "\n"; } else { foreach (var item in StageList) { stage += item.WaterLevel + ":" + item.kA + ","; } } stage = stage.TrimEnd(','); if (!b1 && !b2 && !b3) { } else if (b1 && b2 && b3) { //写入 list Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "12000000SLD1"; Model.ConfigVal = Cbs; list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "12000000SLD2"; Model.ConfigVal = elevation.ToString(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "12000000SLD3"; Model.ConfigVal = stage; list.Add(Model); } else { msg += "SLD计算流量信息输入不完整或输入有误!" + "\n"; } #endregion CONFIGDATAList = list; return(msg); }
private string Validate(out List <Service.Model.YY_RTU_CONFIGDATA> list) { string msg = ""; list = new List <Service.Model.YY_RTU_CONFIGDATA>(); Service.Model.YY_RTU_CONFIGDATA Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "100000000011"; Model.ConfigVal = (comboBox_MODE.SelectedIndex).ToString(); list.Add(Model); Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "10000000AA07"; Int64 PhoneNum = 0; if (textBox_PhoneNum.Text.Trim().Length > 0) { if (Int64.TryParse(textBox_PhoneNum.Text.Trim(), out PhoneNum) && textBox_PhoneNum.Text.Trim().Length >= 11) { Model.ConfigVal = textBox_PhoneNum.Text.Trim(); } else { msg += "手机号输入有误!" + "\n"; } } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "10000000AA08"; Int64 SatelliteNum = 0; if (textBox_SatelliteNum.Text.Trim().Length > 0) { if (Int64.TryParse(textBox_SatelliteNum.Text.Trim(), out SatelliteNum)) { Model.ConfigVal = textBox_SatelliteNum.Text.Trim(); } else { msg += "卫星号输入有误!" + "\n"; } } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "100000000007"; if (textBox_Interval.Text.Trim() != "") { int Interval = 0; if (int.TryParse(textBox_Interval.Text.Trim(), out Interval)) { Model.ConfigVal = Interval.ToString(); list.Add(Model); } else { msg = "自报间隔输入有误!" + "\n"; } } else { Model.ConfigVal = "1"; list.Add(Model); } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "100000000010"; if (textBox_Rainfall.Text.Trim() != "") { int Rainfall = 0; if (int.TryParse(textBox_Rainfall.Text.Trim(), out Rainfall)) { Model.ConfigVal = Rainfall.ToString(); list.Add(Model); } else { msg += "雨量量级输入有误!" + "\n"; } } else { Model.ConfigVal = "1"; list.Add(Model); } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "100000000008"; if (textBox_WaterLevel.Text.Trim() != "") { int WaterLevel = 0; if (int.TryParse(textBox_WaterLevel.Text.Trim(), out WaterLevel)) { Model.ConfigVal = WaterLevel.ToString(); list.Add(Model); } else { msg += "水位量级输入有误!" + "\n"; } } else { Model.ConfigVal = "1"; list.Add(Model); } Model = new Service.Model.YY_RTU_CONFIGDATA(); Model.STCD = comboBox_STCD.SelectedValue.ToString(); Model.ItemID = "0000000000"; Model.ConfigID = "100000000013"; if (textBox_Address.Text.Trim() != "") { int Address = 0; if (int.TryParse(textBox_Address.Text.Trim(), out Address)) { Model.ConfigVal = Address.ToString(); list.Add(Model); } else { msg += "中心地址输入有误!" + "\n"; } } else { Model.ConfigVal = "1"; list.Add(Model); } return(msg); }