Example #1
0
 /// <summary>
 /// 视频下载(往视频下载记录表中插入一条需要下载的记录
 /// </summary>
 /// <param name="deviceCode"></param>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <returns></returns>
 public JsonResult VideoDownload(string deviceCode, string startTime, string endTime)
 {
     try
     {
         ServVideoInfoModel model = new ServVideoInfoModel();
         //根据设备code获取设备
         ServDeviceInfoModel servDeviceInfo = deviceInfoBLL.GetDeviceInfoByDeviceCode(deviceCode);
         if (servDeviceInfo == null)
         {
             return(Json(new { state = 1, message = "该设备不存在" }));
         }
         model.video_name       = servDeviceInfo.device_name + DateTime.Now.ToString();
         model.video_path       = "";
         model.video_type       = (int)VideoDownLoadType.自定义下载;
         model.video_start_time = Convert.ToDateTime(startTime);
         model.video_end_time   = Convert.ToDateTime(endTime);
         model.device_name      = servDeviceInfo.device_name;
         model.device_code      = servDeviceInfo.device_code;
         model.platform_id      = 1;
         model.create_time      = DateTime.Now;
         model.download_status  = (int)VideoDownLoadStatus.未开始下载;
         bool result = servVideoDownloadBLL.VideoDownloadWrite(model);
         return(Json(result));
     }
     catch (Exception ex)
     {
         return(Json(new { state = 1, message = ex.Message }));
     }
 }
Example #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="entity"></param>
 public int AddEntity(ServVideoInfoModel entity)
 {
     try
     {
         int id = (int)mapContext.Insert("InsertVideoInfo", entity);
         return(id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// 增加预案视频下载记录
        /// </summary>
        /// <param name="handleItemId"></param>
        /// <param name="content"></param>
        /// <param name="createTime"></param>
        /// <param name="deviceCode"></param>
        /// <param name="deviceName"></param>
        /// <param name="status"></param>
        /// <param name="platformId"></param>
        /// <param name="endTime"></param>
        /// <param name="startTime"></param>
        /// <param name="downloadType"></param>
        /// <returns></returns>
        public bool AddPlanVideoDownRecord(int handleItemId, string content, DateTime createTime, string deviceCode, string deviceName, int status, int platformId, DateTime endTime, DateTime startTime, int downloadType)
        {
            // mapContext.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);//创建事务
            try
            {
                ServVideoInfoDAL   dal   = new ServVideoInfoDAL();
                ServVideoInfoModel video = new ServVideoInfoModel();
                video.content          = content;
                video.create_time      = createTime;
                video.device_code      = deviceCode;
                video.device_name      = deviceName;
                video.download_status  = status;
                video.platform_id      = platformId;
                video.video_end_time   = endTime;
                video.video_start_time = startTime;
                video.video_type       = downloadType;
                video.video_name       = "";
                video.video_path       = "";
                int videoId = dal.AddEntity(video);
                if (videoId > 0)
                {
                    ServVideoPlanHandleRecordModel model = new ServVideoPlanHandleRecordModel();
                    model.handle_record_id = handleItemId;
                    model.video_id         = videoId;
                    if (AddEntity(model) > 0)
                    {
                        // mapContext.CommitTransaction();
                        return(true);
                    }
                    else
                    {
                        // mapContext.RollBackTransaction();
                        return(false);
                    }
                }
                else
                {
                    //mapContext.RollBackTransaction();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                // mapContext.RollBackTransaction();

                throw ex;
            }
        }
Example #4
0
 /// <summary>
 /// 往下载列表中插入一条数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool VideoDownloadWrite(ServVideoInfoModel model)
 {
     try
     {
         bool result = false;
         int  id     = servVideoInfoDAL.AddEntity(model);
         if (id != 0)
         {
             result = true;
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
 /// <summary>
 /// 告警视屏下载
 /// </summary>
 /// <param name="regionId"></param>
 /// <returns></returns>
 public JsonResult AlarmScreenDownload(string deviceName, string deviceCode, string Event, string alarmTime)
 {
     try
     {
         List <ServVideoInfoModel> ServVideoInfolist  = new List <ServVideoInfoModel>();
         ServAlarmVideoTimeModel   ServAlarmVideoTime = servVideoDownloadBLL.GetAlarmVideoTime(Event);
         DateTime aTime      = Convert.ToDateTime(alarmTime);
         string[] devicename = deviceName.Split(',');
         string[] devicecode = deviceCode.Split(',');
         for (int a = 0; a < devicename.Length; a++)
         {
             ServVideoInfoModel ServVideoInfo = new ServVideoInfoModel();
             ServVideoInfo.video_type = (int)EnumClass.VideoDownLoadType.报警;
             if (ServAlarmVideoTime != null)
             {
                 ServVideoInfo.video_start_time = aTime.AddSeconds(-ServAlarmVideoTime.start_time);
                 ServVideoInfo.video_end_time   = aTime.AddSeconds(ServAlarmVideoTime.end_time);
             }
             else
             {
                 ServVideoInfo.video_start_time = aTime.AddSeconds(-10);
                 ServVideoInfo.video_end_time   = aTime.AddSeconds(10);
             }
             ServVideoInfo.device_name     = devicename[a];
             ServVideoInfo.device_code     = devicecode[a];
             ServVideoInfo.download_status = (int)EnumClass.VideoDownLoadStatus.未开始下载;
             ServVideoInfo.platform_id     = (int)EnumClass.VideoPlatform.宇视;
             ServVideoInfo.create_time     = DateTime.Now;
             ServVideoInfo.video_name      = "";
             ServVideoInfo.video_path      = "";
             ServVideoInfolist.Add(ServVideoInfo);
         }
         bool result = servVideoDownloadBLL.AddvideoDownload(ServVideoInfolist);
         return(Json(new { status = 0, msg = result }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { status = 1, msg = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Example #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model"></param>
        public int UpdateVideoInfoById(ServVideoInfoModel model)
        {
            int result = mapContext.Update("UpdateVideoInfo", model);

            return(result);
        }
Example #7
0
 public bool UpdateEntity(int id, ServVideoInfoModel newentity)
 {
     throw new NotImplementedException();
 }