Exemple #1
0
        /// <summary>
        /// 删除视频轮播计划任务
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteCameraPatrolSchedule(int id)
        {
            mapContext.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);//创建事务
            ServScheduleTimeConfigDAL timeConfigDal = new ServScheduleTimeConfigDAL();

            try
            {
                if (DeleteScheduleById(id) > 0)
                {
                    if (timeConfigDal.DeleteTimeConfigByScheduleId(id) > 0)
                    {
                        mapContext.CommitTransaction();
                        return(true);
                    }
                    else
                    {
                        mapContext.RollBackTransaction();
                        return(false);
                    }
                }
                else
                {
                    mapContext.RollBackTransaction();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                mapContext.RollBackTransaction();
                throw ex;
            }
        }
Exemple #2
0
        /// <summary>
        /// 新增视频轮播计划任务
        /// </summary>
        /// <param name="custom"></param>
        /// <returns></returns>
        public bool InsertCameraPatrolSchedule(CameraScheduleCustom custom)
        {
            mapContext.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);//创建事务
            ServScheduleTimeConfigDAL timeConfigDal = new ServScheduleTimeConfigDAL();

            try
            {
                ServScheduleModel schedule = new ServScheduleModel();
                schedule.content           = custom.content;
                schedule.create_time       = custom.create_time;
                schedule.end_time          = custom.end_time;
                schedule.ext1              = custom.ext1;
                schedule.ext10             = custom.ext10;
                schedule.ext2              = custom.ext2;
                schedule.ext3              = custom.ext3;
                schedule.ext4              = custom.ext4;
                schedule.ext5              = custom.ext5;
                schedule.ext6              = custom.ext6;
                schedule.ext7              = custom.ext7;
                schedule.ext8              = custom.ext8;
                schedule.ext9              = custom.ext9;
                schedule.period_expression = custom.period_expression;
                schedule.region_id         = custom.region_id;
                schedule.schedule_name     = custom.schedule_name;
                schedule.schedule_state    = custom.schedule_state;
                schedule.schedule_type     = custom.schedule_type;
                schedule.start_time        = custom.start_time;
                schedule.span_time         = custom.span_time;
                int scheduleId = AddEntity(schedule);
                if (scheduleId > 0)
                {
                    ServScheduleTimeConfigModel timeModel = new ServScheduleTimeConfigModel();
                    timeModel.schedule_id   = scheduleId;
                    timeModel.schedule_time = custom.start_execute_time;
                    timeModel.schedule_date = custom.schedule_date;
                    timeModel.time_type     = 1;//开始时间
                    if (timeConfigDal.AddEntity(timeModel) > 0)
                    {
                        mapContext.CommitTransaction();
                        return(true);
                    }
                    else
                    {
                        mapContext.RollBackTransaction();
                        return(false);
                    }
                }
                else
                {
                    mapContext.RollBackTransaction();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                mapContext.RollBackTransaction();
                throw ex;
            }
        }
Exemple #3
0
        /// <summary>
        /// 更新视频轮播计划任务
        /// </summary>
        /// <param name="custom"></param>
        /// <returns></returns>
        public bool UpdateCameraPatrolSchedule(CameraScheduleCustom custom)
        {
            mapContext.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);//创建事务
            ServScheduleTimeConfigDAL timeConfigDal = new ServScheduleTimeConfigDAL();

            try
            {
                ServScheduleModel schedule = new ServScheduleModel();
                schedule.id                = custom.id;
                schedule.content           = custom.content;
                schedule.create_time       = custom.create_time;
                schedule.end_time          = custom.end_time;
                schedule.ext1              = custom.ext1;
                schedule.ext10             = custom.ext10;
                schedule.ext2              = custom.ext2;
                schedule.ext3              = custom.ext3;
                schedule.ext4              = custom.ext4;
                schedule.ext5              = custom.ext5;
                schedule.ext6              = custom.ext6;
                schedule.ext7              = custom.ext7;
                schedule.ext8              = custom.ext8;
                schedule.ext9              = custom.ext9;
                schedule.period_expression = custom.period_expression;
                schedule.region_id         = custom.region_id;
                schedule.schedule_name     = custom.schedule_name;
                schedule.schedule_state    = custom.schedule_state;
                schedule.schedule_type     = custom.schedule_type;
                schedule.start_time        = custom.start_time;
                schedule.span_time         = custom.span_time;
                int res = UpdateScheduleById(schedule);
                if (res > 0)
                {
                    ServScheduleTimeConfigModel timeModel = timeConfigDal.GetScheduleTimeConfigByScheduleId(custom.id).FirstOrDefault(); //获取第一个视频轮播计划任务时间配置
                    //如果未找到当前时间配置,则新增时间配置记录;找到时间配置,进行更新操作
                    if (timeModel != null)
                    {
                        timeModel.schedule_time = custom.start_execute_time;
                        timeModel.schedule_date = custom.schedule_date;
                        if (timeConfigDal.UpdateTimeConfig(timeModel) > 0)
                        {
                            mapContext.CommitTransaction();
                            return(true);
                        }
                        else
                        {
                            mapContext.RollBackTransaction();
                            return(false);
                        }
                    }
                    else
                    {
                        timeModel               = new ServScheduleTimeConfigModel();
                        timeModel.schedule_id   = custom.id;
                        timeModel.schedule_time = custom.start_execute_time;
                        timeModel.schedule_date = custom.schedule_date;
                        timeModel.time_type     = 1;//开始时间
                        if (timeConfigDal.AddEntity(timeModel) > 0)
                        {
                            mapContext.CommitTransaction();
                            return(true);
                        }
                        else
                        {
                            mapContext.RollBackTransaction();
                            return(false);
                        }
                    }
                }
                else
                {
                    mapContext.RollBackTransaction();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                mapContext.RollBackTransaction();
                throw ex;
            }
        }