public List <GroupSwitchDetailInfo> GetGroupSwitchDetailByGroupSwitchId(ref string errMessage, int groupSwitchId) { Database db = DatabaseFactory.CreateDatabase(); errMessage = ""; try { List <GroupSwitchDetailInfo> list = new List <GroupSwitchDetailInfo>(); DataSet ds = GroupSwitchDetailDataAccess.GetGroupSwitchDetailByGroupSwitchId(db, groupSwitchId); if (ds.Tables[0].Rows.Count == 0) { return(null); } GroupSwitchDetailInfo oGroupSwitchDetailInfo; foreach (DataRow dr in ds.Tables[0].Rows) { oGroupSwitchDetailInfo = new GroupSwitchDetailInfo(dr); list.Add(oGroupSwitchDetailInfo); } return(list); } catch (Exception ex) { errMessage = ex.Message + ex.StackTrace; logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace); return(null); } }
public Dictionary <int, GroupSwitchGroup> GetAllGroupSwitchGroups(ref string errMessage) { Database db = DatabaseFactory.CreateDatabase(); errMessage = ""; var list = new Dictionary <int, GroupSwitchGroup>(); try { GroupSwitchGroup groupSwitchGroup; DataSet ds = GroupSwitchGroupDataAccess.GetAllGroupSwitchGroupInfo(db); DataSet groupSwitchDetail; GroupSwitchDetailInfo groupSwitchDetailInfo; CameraMonitorPairInfo cameraMonitorPairInfo; //对于每一个群组切换的组 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { groupSwitchGroup = new GroupSwitchGroup(ds.Tables[0].Rows[i]); groupSwitchDetail = GroupSwitchDetailDataAccess.GetGroupSwitchDetailByGroupSwitchId(db, groupSwitchGroup.Id); groupSwitchGroup.ListGroupSwitchDetailInfo = new Dictionary <int, GroupSwitchDetailInfo>(); //对于一个组中的所有与同步群组有联系的记录 foreach (DataRow drgsdi in groupSwitchDetail.Tables[0].Rows) { groupSwitchDetailInfo = new GroupSwitchDetailInfo(drgsdi); //根据同步群组获取同步群组与摄像机、监视器的配对信息 DataSet dsCamMonPair = CameraMonitorPairDataAccess.GetCameraMonitorPairBySynGroupId(db, groupSwitchDetailInfo.SynGroupId); groupSwitchDetailInfo.ListCameraMonitorPair = new Dictionary <int, CameraMonitorPairInfo>(); foreach (DataRow drCmP in dsCamMonPair.Tables[0].Rows) { cameraMonitorPairInfo = new CameraMonitorPairInfo(drCmP); groupSwitchDetailInfo.ListCameraMonitorPair.Add(cameraMonitorPairInfo.CameraMonitorPairId, cameraMonitorPairInfo); } groupSwitchGroup.ListGroupSwitchDetailInfo.Add(groupSwitchDetailInfo.Id, groupSwitchDetailInfo); } list.Add(groupSwitchGroup.Id, groupSwitchGroup); } return(list); } catch (Exception ex) { errMessage = ex.Message + ex.StackTrace; Logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace); return(null); } }
public GroupSwitchGroup GetGroupSwitchGroupById(ref string errMessage, int groupSwitchGroupId) { Database db = DatabaseFactory.CreateDatabase(); errMessage = ""; try { DataSet ds = GroupSwitchGroupDataAccess.GetGroupSwitchGroupById(db, groupSwitchGroupId); if (ds.Tables[0].Rows.Count == 0) { return(null); } var groupSwitchGroup = new GroupSwitchGroup(ds.Tables[0].Rows[0]) { ListGroupSwitchDetailInfo = new Dictionary <int, GroupSwitchDetailInfo>() }; var groupSwitchDetail = GroupSwitchDetailDataAccess.GetGroupSwitchDetailByGroupSwitchId(db, groupSwitchGroup.Id); groupSwitchGroup.ListGroupSwitchDetailInfo = new Dictionary <int, GroupSwitchDetailInfo>(); //对于一个组中的所有与同步群组有联系的记录 foreach (DataRow drgsdi in groupSwitchDetail.Tables[0].Rows) { var groupSwitchDetailInfo = new GroupSwitchDetailInfo(drgsdi); //根据同步群组获取同步群组与摄像机、监视器的配对信息 DataSet dsCamMonPair = CameraMonitorPairDataAccess.GetCameraMonitorPairBySynGroupId(db, groupSwitchDetailInfo.SynGroupId); groupSwitchDetailInfo.ListCameraMonitorPair = new Dictionary <int, CameraMonitorPairInfo>(); foreach (DataRow drCmP in dsCamMonPair.Tables[0].Rows) { var cameraMonitorPairInfo = new CameraMonitorPairInfo(drCmP); groupSwitchDetailInfo.ListCameraMonitorPair.Add(cameraMonitorPairInfo.CameraMonitorPairId, cameraMonitorPairInfo); } groupSwitchGroup.ListGroupSwitchDetailInfo.Add(groupSwitchDetailInfo.Id, groupSwitchDetailInfo); } return(groupSwitchGroup); } catch (Exception ex) { errMessage = ex.Message + ex.StackTrace; Logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace); return(null); } }