private void btnInitCameraData_Click(object sender, EventArgs e) { if (CameraSDK.Status) { List <Dictionary <string, object> > list = CameraSDK.GetCameraList(); foreach (Dictionary <string, object> item in list) { string cameraIndexCode = item["cameraIndexCode"].ToString(); string cameraName = item["cameraName"].ToString(); string channelNo = item["channelNo"].ToString(); if (commonDAO.SelfDber.Entity <CmcsCamera>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = cameraIndexCode }) != null) { continue; } commonDAO.SelfDber.Insert(new CmcsCamera() { Channel = int.Parse(channelNo), EquipmentCode = cameraIndexCode, Name = cameraName, ParentId = "-1", Type = "1", Code = commonDAO.GetCameraNewChildCode("00") }); } MessageBoxEx.Show("初始化完成"); InitTree(); } }
private void btnSave_Click(object sender, EventArgs e) { if (!ValidatePage()) { return; } if (CurrEditMode == eEditMode.新增) { if (this.SelCamera == null) { return; } CmcsCamare entity = new CmcsCamare(); entity.NodeCode = commonDAO.GetCameraNewChildCode(this.txt_Code.Text); entity.Name = txt_CameraName.Text; entity.Ip = txt_IP.Text; entity.UserName = txt_UserName.Text; entity.Password = txt_Password.Text; entity.Port = txt_Port.Value; entity.Sort = dbi_Sequence.Value; entity.EquipmentCode = txt_EquipmentCode.Text; entity.Remark = txt_Remark.Text; entity.Channel = txt_Channel.Value; entity.Type = cmbCameraType.SelectedIndex.ToString(); entity.ParentId = this.SelCamera.Id; Dbers.GetInstance().SelfDber.Insert <CmcsCamare>(entity); } else if (CurrEditMode == eEditMode.修改) { if (this.SelCamera == null) { return; } this.SelCamera.Name = txt_CameraName.Text; this.SelCamera.Ip = txt_IP.Text; this.SelCamera.UserName = txt_UserName.Text; this.SelCamera.Password = txt_Password.Text; this.SelCamera.Port = txt_Port.Value; this.SelCamera.Type = cmbCameraType.SelectedIndex.ToString(); this.SelCamera.Channel = txt_Channel.Value; this.SelCamera.Sort = dbi_Sequence.Value; this.SelCamera.EquipmentCode = txt_EquipmentCode.Text; this.SelCamera.Remark = txt_Remark.Text; Dbers.GetInstance().SelfDber.Update <CmcsCamare>(this.SelCamera); } InitTree(); }