示例#1
0
 /// <summary>
 /// 新建视频监控
 /// </summary>
 /// <param name="videoNew"></param>
 /// <returns></returns>
 public ActionResult <bool> AddVideo(VideoNew videoNew)
 {
     try
     {
         if (videoNew == null)
         {
             throw new Exception("参数类型错误");
         }
         var check = _rpsv.Any(p => p.Code == videoNew.Code);
         if (check)
         {
             throw new Exception("该摄像头已存在");
         }
         var dbv  = videoNew.MAPTO <Basic_Vedio>();
         var lsvs = (from vs in videoNew.Subjects
                     select new Basic_VedioSubject
         {
             ID = Guid.NewGuid(),
             SubjectID = vs.SubjectID,
             SubjectType = vs.SubjectType,
             VedioID = dbv.ID
         }).ToList();
         _rpsv.Add(dbv);
         _rpsvs.Add(lsvs);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
示例#2
0
 public bool Insert(VideoNew video_new)
 {
     try
     {
         return(this.VideoDAL.Insert(video_new));
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        // GET: api/CropStep_VideoAllocation
        //public IQueryable<CropStep_VideoAllocation> GetCropStep_VideoAllocation()
        //{
        //    return db.CropStep_VideoAllocation;
        //}

        public HttpResponseMessage GetCropStep_VideoAllocation(int StepId)
        {
            var VideoAllocation = from Videodata in db.CropStep_VideoAllocation
                                  join Lang in db.Languages on Videodata.LangId equals Lang.Id into LangNew
                                  from Lang in LangNew.DefaultIfEmpty()
                                  join Video in db.Videos on Videodata.VideoId equals Video.Id into VideoNew
                                  from Video in VideoNew.DefaultIfEmpty()
                                  where Videodata.StepId == StepId && Videodata.Active == true
                                  select new { Videodata.Id, Videodata.StepId, Videodata.LangId, Lang.LanguageName, Videodata.VideoId, Video.VideoName, Video.FilePath, Videodata.Active };

            return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.OK, new { data = new { VideoAllocation }, success = true, error = string.Empty }));
        }
示例#4
0
        public VideoNew Get(int num)
        {
            VideoNew result = null;

            try
            {
                return(this.VideoDAL.Get(num));
            }
            catch (Exception ex)
            {
                return(result);
            }
        }
示例#5
0
        public bool Insert(VideoNew VideoNew)
        {
            {
                Func <bool> func = new Func <bool>(() =>
                {
                    _entity.Entry(VideoNew).State = EntityState.Added;

                    _entity.SaveChanges();

                    return(true);
                });

                return(_adapter.Catch <bool>(func));
            }
        }
示例#6
0
        public bool Update(VideoNew VideoNew)
        {
            {
                Func <bool> func = new Func <bool>(() =>
                {
                    VideoNew.DtUpdate = DateTime.Now;

                    _entity.Entry(VideoNew).State = EntityState.Modified;

                    _entity.SaveChanges();

                    return(true);
                });

                return(_adapter.Catch <bool>(func));
            }
        }
示例#7
0
        public bool Update(VideoNew video_new)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    if (video_new.BoolCheck)
                    {
                        this.ClearAllCheck();
                    }

                    this.VideoDAL.Update(video_new);

                    scope.Complete();
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
示例#8
0
 public ActionResult <bool> AddVideo(VideoNew videoNew)
 {
     LogContent = "新建了监控模型,参数源:" + JsonConvert.SerializeObject(videoNew);
     return(bll.AddVideo(videoNew));
 }