protected void ButDevAdd_Click(object sender, DirectEventArgs e) { try { HidSaveFlag.Value = "1"; Button5.Hidden = false; Text_SBBH.Text = tgsPproperty.GetRecordId(); Cob_SBLX.Reset(); Text_SBMC.Reset(); Cob_SBXH.Reset(); Cob_SFSY.Reset(); Text_IP.Reset(); Text_DK.Reset(); Text_TYDS.Reset(); Cob_TXLX.Reset(); Cob_TXXY.Reset(); Text_YHM.Reset(); Text_MM.Reset(); Cob_JSDW.Reset(); Cob_ZZCS.Reset(); Cob_WHDW.Reset(); Window4.Show(); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("ServerManager.aspx-ButDevAdd_Click", ex.Message + ";" + ex.StackTrace, "ButDevAdd_Click has an exception"); } }
/// <summary> /// 更新设备信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void UpdateDevice(object sender, DirectEventArgs e) { try { Hashtable hs = new Hashtable(); hs.Add("device_id", Text_SBBH.Text.ToString()); hs.Add("device_idext", TxtDeviceIdExt.Text); hs.Add("device_name", Text_SBMC.Text.ToString()); if (Cob_SBLX.SelectedIndex != -1) { hs.Add("device_type_id", Cob_SBLX.Value.ToString()); } else { NoticeError(GetLangStr("DeviceManager67", "信息错误"), GetLangStr("DeviceManager68", "设备类型未选择")); return; } if (Cob_SBXH.SelectedIndex != -1) { hs.Add("device_mode_id", Cob_SBXH.Value.ToString()); } else { NoticeError(GetLangStr("DeviceManager67", "信息错误"), GetLangStr("DeviceManager68", "设备型号未选择")); return; } hs.Add("ipaddress", Text_IP.Text.ToString()); hs.Add("port", Text_DK.Text.ToString()); if (!string.IsNullOrEmpty(Text_TYDS.Text)) { hs.Add("channels", Text_TYDS.Text.ToString()); } else { hs.Add("channels", "0"); } hs.Add("username", Text_YHM.Text.ToString()); hs.Add("password", Text_MM.Text.ToString()); hs.Add("createdate", "now()"); hs.Add("dev_length", Text_Ledth.Text.ToString()); hs.Add("dev_width", Text_Width.Text.ToString()); hs.Add("port_num", Text_CKH.Text.ToString()); hs.Add("port_param", Text_CKCS.Text.ToString()); hs.Add("protocol_id", CommonExt.IsNullComboBox(Cob_TXXY, "")); hs.Add("comm_type_id", CommonExt.IsNullComboBox(Cob_TXLX, "")); hs.Add("build_id", CommonExt.IsNullComboBox(Cob_JSDW, "")); hs.Add("maintain_company_id", CommonExt.IsNullComboBox(Cob_WHDW, "")); hs.Add("make_company_id", CommonExt.IsNullComboBox(Cob_ZZCS, "")); hs.Add("isuse", CommonExt.IsNullComboBox(Cob_SFSY, "1")); if (deviceManager.UptateDeviceInfo(hs) > 0) { if (HidSaveFlag.Value.Equals("1")) { if (CheckSave.Checked) { Window4.Hide(); } else { Text_SBMC.Reset(); Text_SBBH.Reset(); Text_IP.Reset(); } } else { Window4.Hide(); } if (Cob_SBLX.SelectedIndex != -1) { LedDataBind(" 1=1 and a.device_type_id='" + Cob_SBLX.Value.ToString() + "'"); } else { LedDataBind(" 1=1"); } if (types == 1) { string sbmcs = Text_SBMC.Text; string sblxs = Cob_SBLX.SelectedItem.Text; string kksbs = Cob_SBXH.SelectedItem.Text; string sfsys = Cob_SFSY.SelectedItem.Text; string sbips = Text_IP.Text; string sbdks = Text_DK.Text; string sbtdss = Text_TYDS.Text; string wbbhs = TxtDeviceIdExt.Text; string txlxs = Cob_TXLX.SelectedItem.Text; string txxys = Cob_TXXY.SelectedItem.Text; string yhms = Text_YHM.Text; string mms = Text_MM.Text; string sbcds = Text_Ledth.Text; string sbkds = Text_Width.Text; string ckhs = Text_CKH.Text; string ckcss = Text_CKCS.Text; string jsdws = Cob_JSDW.SelectedItem.Text; string whdws = Cob_WHDW.SelectedItem.Text; string sbzzss = Cob_ZZCS.SelectedItem.Text; string lblname = ""; lblname += Bll.Common.AssembleRunLog(sblx, sblxs, GetLangStr("DeviceManager2", "设备类型"), "1"); lblname += Bll.Common.AssembleRunLog(kksb, kksbs, GetLangStr("DeviceManager71", "卡口设备"), "1"); lblname += Bll.Common.AssembleRunLog(sfsy, sfsys, GetLangStr("DeviceManager31", "是否使用"), "1"); lblname += Bll.Common.AssembleRunLog(sbip, sbips, GetLangStr("DeviceManager19", "设备Ip"), "1"); lblname += Bll.Common.AssembleRunLog(sbdk, sbdks, GetLangStr("DeviceManager20", "设备端口"), "1"); lblname += Bll.Common.AssembleRunLog(sbtds, sbtdss, GetLangStr("DeviceManager37", "设备通道数"), "1"); lblname += Bll.Common.AssembleRunLog(wbbh, wbbhs, GetLangStr("DeviceManager21", "外部编号"), "1"); lblname += Bll.Common.AssembleRunLog(txlx, txlxs, GetLangStr("DeviceManager41", "通讯类型"), "1"); lblname += Bll.Common.AssembleRunLog(txxy, txxys, GetLangStr("DeviceManager43", "通讯协议"), "1"); lblname += Bll.Common.AssembleRunLog(yhm, yhms, GetLangStr("DeviceManager45", "用户名"), "1"); lblname += Bll.Common.AssembleRunLog(mm, mms, GetLangStr("DeviceManager47", "密码"), "1"); lblname += Bll.Common.AssembleRunLog(sbcd, sbcds, GetLangStr("DeviceManager49", "设备长度"), "1"); lblname += Bll.Common.AssembleRunLog(sbkd, sbkds, GetLangStr("DeviceManager51", "设备宽度"), "1"); lblname += Bll.Common.AssembleRunLog(ckh, ckhs, GetLangStr("DeviceManager53", "串口号"), "1"); lblname += Bll.Common.AssembleRunLog(ckcs, ckcss, GetLangStr("DeviceManager55", "串口参数"), "1"); lblname += Bll.Common.AssembleRunLog(jsdw, jsdws, GetLangStr("DeviceManager58", "建设单位"), "1"); lblname += Bll.Common.AssembleRunLog(whdw, whdws, GetLangStr("DeviceManager60", "维护单位"), "1"); lblname += Bll.Common.AssembleRunLog(sbzzs, sbzzss, GetLangStr("DeviceManager62", "设备制造商"), "1"); logManager.InsertLogRunning(uName, GetLangStr("DeviceManager72", "修改:[") + sbmc + "]" + lblname, nowIp, "2"); Notice(GetLangStr("DeviceManager70", "信息提示"), GetLangStr("DeviceManager69", "信息保存成功")); //页面加载方法 BuildTree(TreePanel1.Root); TreePanel1.Render(); types = 0; } else { InsertLog(); } } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("DeviceManager.aspx-UpdateDevice", ex.Message + ";" + ex.StackTrace, "UpdateDevice has an exception"); } }