public ClientList FindClientList(string alarmRootToString) { ClientList clientlist = new ClientList(); foreach (ISetAgainst setAgainst in List) { AlarmRoot alarmRoot = new AlarmRoot(); alarmRoot.AlarmType = setAgainst.AlarmType; alarmRoot.ChannelNo = setAgainst.Channel.ChannelNO; alarmRoot.DeviceIP = setAgainst.Channel.Device.DeviceIP; if (alarmRoot.ToString() == alarmRootToString) { clientlist.Add(setAgainst.Client); } } return clientlist; }
/// <summary> /// ����ͨ�� /// </summary> public void LodaChannel() { if (Data.IsStand_aloneDB) { tbsourceTableAdapter.FillBySourceType(videospDBDataSet.tbsource, 0, 1); } if (Data.IsStand_aloneDB ? videospDBDataSet.tbsource.Rows.Count != 0 : netsysdbDataSet.VCHANNEL.Rows.Count != 0) { foreach (DataRow dataRow in (Data.IsStand_aloneDB ? videospDBDataSet.tbsource.Rows : netsysdbDataSet.VCHANNEL.Rows)) { //��Ƶͨ�� VideoChannel videoChannel = new VideoChannel(); IDevice videoChannelInDevice; if (Data.IsStand_aloneDB) { videoChannel.DeviceID = Convert.ToInt32(dataRow["iunit_no"]); videoChannelInDevice = deviceList.FindByID(videoChannel.DeviceID); videoChannel.Device = videoChannelInDevice; videoChannel.ChannelID = Convert.ToInt32(dataRow["isource_no"]); videoChannel.ChannelName = dataRow["ssource_name"].ToString().Trim(); videoChannel.ChannelNO = Convert.ToInt32(dataRow["isource_linkno"]); videoChannel.ChannelState = dataRow["iwork_state"].ToString() == "" ? -1 : Convert.ToInt32(dataRow["iwork_state"]); videoChannel.RealPalyEvent += videoChannel_RealPalyEvent; videoChannel.StopRealPLayEvent += videoChannel_StopRealPLayEvent; } else { videoChannel.DeviceID = (int)dataRow["nunitno"]; videoChannelInDevice = deviceList.FindByID(videoChannel.DeviceID); videoChannel.Device = videoChannelInDevice; videoChannel.ChannelID = (int)dataRow["nvchno"]; videoChannel.ChannelName = dataRow["svchname"].ToString().Trim(); videoChannel.ChannelNO = (int)dataRow["newno"]; videoChannel.ChannelState = dataRow["state"].ToString() == "" ? -1 : Convert.ToInt32(dataRow["state"]); } //if ( // !arraylistChannel.Contains(string.Format("V-{0}-{1}", videoChannel.DeviceID, // videoChannel.ChannelNO))) //{ // arraylistChannel.Add( // string.Format("V-{0}-{1}", videoChannel.DeviceID, videoChannel.ChannelNO)); //} channelList.Add(videoChannel); //�ӱ���Դ #region ��䱨��Դ AlarmRoot alarmRoot2 = new AlarmRoot(); alarmRoot2.ChannelNo = videoChannel.ChannelNO; alarmRoot2.DeviceIP = videoChannelInDevice.DeviceIP; //�źŶ�ʧ alarmRoot2.AlarmType = 2; //alarmRoot2.Hashkey = alarmRoot2.ToString().GetHashCode(); alarmRootList.Add(alarmRoot2); AlarmRoot alarmRoot3 = new AlarmRoot(); alarmRoot3.ChannelNo = videoChannel.ChannelNO; alarmRoot3.DeviceIP = videoChannelInDevice.DeviceIP; //�ƶ���� alarmRoot3.AlarmType = 3; //alarmRoot3.Hashkey = alarmRoot3.ToString().GetHashCode(); alarmRootList.Add(alarmRoot3); AlarmRoot alarmRoot6 = new AlarmRoot(); alarmRoot6.ChannelNo = videoChannel.ChannelNO; alarmRoot6.DeviceIP = videoChannelInDevice.DeviceIP; //�ڵ����� alarmRoot6.AlarmType = 6; //alarmRoot6.Hashkey = alarmRoot6.ToString().GetHashCode(); alarmRootList.Add(alarmRoot6); AlarmRoot alarmRoot7 = new AlarmRoot(); alarmRoot7.ChannelNo = videoChannel.ChannelNO; alarmRoot7.DeviceIP = videoChannelInDevice.DeviceIP; //��ʽ��ƥ�� alarmRoot7.AlarmType = 7; //alarmRoot7.Hashkey = alarmRoot7.ToString().GetHashCode(); alarmRootList.Add(alarmRoot7); #endregion ��䱨��Դ } } if (Data.IsStand_aloneDB) { //videospDBDataSet.tbsource = tbsourceTableAdapter.GetDataBySourceType(2, -1); tbsourceTableAdapter.FillBySourceType(videospDBDataSet.tbsource, 2, -1); } else { dSOURCETableAdapter.FillDSourceByNdchtype(netsysdbDataSet.DSOURCE, 1); } if (Data.IsStand_aloneDB ? videospDBDataSet.tbsource.Rows.Count != 0 : netsysdbDataSet.DSOURCE.Rows.Count != 0) { foreach (DataRow dataRow in (Data.IsStand_aloneDB ? videospDBDataSet.tbsource.Rows : netsysdbDataSet.DSOURCE.Rows)) { //�������� DataInput dataInput = new DataInput(); IDevice dataInputInDevice; if (Data.IsStand_aloneDB) { dataInput.DeviceID = Convert.ToInt32(dataRow["iunit_no"]); dataInputInDevice = deviceList.FindByID(dataInput.DeviceID); dataInput.Device = deviceList.FindByID(dataInput.DeviceID); dataInput.ChannelID = Convert.ToInt32(dataRow["isource_no"]); dataInput.ChannelName = dataRow["ssource_name"].ToString(); dataInput.ChannelNO = Convert.ToInt32(dataRow["isource_linkno"]); dataInput.ChannelState = dataRow["iwork_state"].ToString() == "" ? -1 : Convert.ToInt32(dataRow["iwork_state"]); } else { dataInput.DeviceID = ((int)dataRow["nunitno"]); dataInputInDevice = deviceList.FindByID(dataInput.DeviceID); dataInput.Device = dataInputInDevice; dataInput.ChannelID = (int)dataRow["ndchnno"]; dataInput.ChannelName = dataRow["sdchname"].ToString().Trim(); dataInput.ChannelNO = (int)dataRow["nno"]; dataInput.ChannelState = dataRow["state"].ToString() == "" ? -1 : Convert.ToInt32(dataRow["state"]); } channelList.Add(dataInput); #region ��䱨��Դ AlarmRoot alarmRoot0 = new AlarmRoot(); alarmRoot0.ChannelNo = dataInput.ChannelNO; alarmRoot0.DeviceIP = dataInputInDevice.DeviceIP; //�źŶ�ʧ alarmRoot0.AlarmType = 0; //alarmRoot0.Hashkey = alarmRoot0.ToString().GetHashCode(); alarmRootList.Add(alarmRoot0); #endregion ��䱨�� } } if (Data.IsStand_aloneDB) { tbsourceTableAdapter.FillBySourceType(videospDBDataSet.tbsource, 3, -1); } else { dSOURCETableAdapter.FillDSourceByNdchtype(netsysdbDataSet.DSOURCE, 2); } if (Data.IsStand_aloneDB ? videospDBDataSet.tbsource.Rows.Count != 0 : netsysdbDataSet.DSOURCE.Rows.Count != 0) { foreach (DataRow dataRow in (Data.IsStand_aloneDB ? videospDBDataSet.tbsource.Rows : netsysdbDataSet.DSOURCE.Rows)) { //������� ClassLibrary.Channel.DataOutput dataOutput = new ClassLibrary.Channel.DataOutput(); IDevice dataOutputInDevice; if (Data.IsStand_aloneDB) { dataOutput.DeviceID = Convert.ToInt32(dataRow["iunit_no"]); dataOutputInDevice = deviceList.FindByID(dataOutput.DeviceID); dataOutput.Device = deviceList.FindByID(dataOutput.DeviceID); dataOutput.ChannelID = Convert.ToInt32(dataRow["isource_no"]); dataOutput.ChannelName = dataRow["ssource_name"].ToString(); dataOutput.ChannelNO = Convert.ToInt32(dataRow["isource_linkno"]); dataOutput.ChannelState = dataRow["iwork_state"].ToString() == "" ? -1 : Convert.ToInt32(dataRow["iwork_state"]); } else { dataOutput.DeviceID = (int)dataRow["nunitno"]; dataOutputInDevice = deviceList.FindByID(dataOutput.DeviceID); dataOutput.Device = dataOutputInDevice; dataOutput.ChannelID = (int)dataRow["ndchnno"]; dataOutput.ChannelName = dataRow["sdchname"].ToString().Trim(); dataOutput.ChannelNO = (int)dataRow["nno"]; dataOutput.ChannelState = dataRow["state"].ToString() == "" ? -1 : Convert.ToInt32(dataRow["state"]); } channelList.Add(dataOutput); } } }