/// <summary> /// 确认 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConfirmAdd_Click(object sender, RoutedEventArgs e) { try { int nSucess = -1; //判断是添加还是修改 if (!CheckInfo()) { return; } ChannelCfgLBS channelCfg = new ChannelCfgLBS(); channelCfg = _ChannelCfg.MyChannelCfgToChannelCfgLBS(_ChannelCfg); channelCfg.Channel_type = cIViewModel.SelectedChannelType; if (cIViewModel.Title.Equals("添加通道")) { nSucess = thirft.AddChannel(channelCfg); } else { nSucess = thirft.ModifyChannel(channelCfg); } if (nSucess == 0) { MB_MODULES.Views.MyMessage.showYes("操作通道成功!"); //修改通道 如果通道已经被打开则关闭 if (!cIViewModel.Title.Equals("添加通道")) { CloseVideoDelegate(); } this.Close(); } else { MB_MODULES.Views.MyMessage.showYes("操作失败!"); return; } RefreshChannelDelegate(); } catch (Exception ex) { Logger <ChannelInfo> .Log.Error("btnConfirmAdd_Click", ex); } }
public ChannelCfgLBS MyChannelCfgToChannelCfgLBS(MyChannelCfg _MyChannelCfg) { ChannelCfgLBS _ChannelCfg = new ChannelCfgLBS(); _ChannelCfg.TcChannelID = _MyChannelCfg.TcChaneelID; _ChannelCfg.TcUID = _MyChannelCfg.TcUID; _ChannelCfg.TcPSW = _MyChannelCfg.TcPSW; _ChannelCfg.Name = _MyChannelCfg.Name; _ChannelCfg.TcDescription = _MyChannelCfg.TcDescription; _ChannelCfg.CaptureCfg = _MyChannelCfg.CaptureCfg; _ChannelCfg.CatchFaceCfg = _MyChannelCfg.CatchFaceCfg; _ChannelCfg.Addr = _MyChannelCfg.Addr; _ChannelCfg.Channel_address = _MyChannelCfg.Channel_address; _ChannelCfg.Port = _MyChannelCfg.Port; _ChannelCfg.Latitude = _MyChannelCfg.Latitude; _ChannelCfg.Longitude = _MyChannelCfg.Longitude; return(_ChannelCfg); }
public MyChannelCfg ChannelCfgToMyChannelCfgLBS(ChannelCfgLBS _ChannelCfg) { MyChannelCfg _MyChannelCfg = new MyChannelCfg(); _MyChannelCfg.TcChaneelID = _ChannelCfg.TcChannelID; _MyChannelCfg.ChannelType = _ChannelCfg.Channel_type; _MyChannelCfg.TcUID = _ChannelCfg.TcUID; _MyChannelCfg.TcPSW = _ChannelCfg.TcPSW; _MyChannelCfg.Name = _ChannelCfg.Name; _MyChannelCfg.TcDescription = _ChannelCfg.TcDescription; _MyChannelCfg.CaptureCfg = _ChannelCfg.CaptureCfg; _MyChannelCfg.CatchFaceCfg = _ChannelCfg.CatchFaceCfg; _MyChannelCfg.Addr = _ChannelCfg.Addr; _MyChannelCfg.Channel_address = _ChannelCfg.Channel_address; _MyChannelCfg.Port = _ChannelCfg.Port; _MyChannelCfg.Latitude = _ChannelCfg.Latitude; _MyChannelCfg.Longitude = _ChannelCfg.Longitude; return(_MyChannelCfg); }