Exemplo n.º 1
0
        public Dictionary <int, VideoInfo> GetVideoInfoByCamera(ref string errMessage, int cameraId)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            var videoList = new Dictionary <int, VideoInfo>();

            try
            {
                DataSet ds = VideoDataAccess.GetVideoInfoByCamera(db, cameraId);

                VideoInfo videoInfo;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    videoInfo = new VideoInfo(ds.Tables[0].Rows[i]);
                    DataSet    dsCamera;
                    CameraInfo oCamera;
                    dsCamera = CameraDataAccess.GetCamInfoByCameraId(db, videoInfo.CameraId);
                    foreach (DataRow dr in dsCamera.Tables[0].Rows)
                    {
                        oCamera = new CameraInfo(dr);
                        videoInfo.CameraInfo = oCamera;
                    }

                    videoList.Add(videoInfo.Id, videoInfo);
                }
                return(videoList);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(null);
            }
        }
Exemplo n.º 2
0
        public VideoInfo GetVideoInfoById(ref string errMessage, int id)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            try
            {
                DataSet ds = VideoDataAccess.GetVideoInfoById(db, id);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    return(null);
                }
                VideoInfo  videoInfo = new VideoInfo(ds.Tables[0].Rows[0]);
                DataSet    dsCamera;
                CameraInfo oCamera;
                dsCamera = CameraDataAccess.GetCamInfoByCameraId(db, videoInfo.CameraId);
                foreach (DataRow dr in dsCamera.Tables[0].Rows)
                {
                    oCamera = new CameraInfo(dr);
                    videoInfo.CameraInfo = oCamera;
                }
                return(videoInfo);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(null);
            }
        }
Exemplo n.º 3
0
        public CameraInfo GetCameraInfoByCameraId(ref string errMessage, int CameraId)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            try
            {
                DataSet ds = CameraDataAccess.GetCamInfoByCameraId(db, CameraId);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    return(null);
                }
                return(new CameraInfo(ds.Tables[0].Rows[0]));
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(null);
            }
        }