Exemplo n.º 1
0
        public void Add()
        {
            _workProcessRepository.BeginTran();
            try
            {
                var workProcessList = new List <WorkProcess>();

                for (int i = 0; i < 1000; i++)
                {
                    workProcessList.Add(new WorkProcess()
                    {
                        FuncType      = 1,
                        MethodName    = "",
                        ParameterInfo = "",
                        WorkProcessId = Guid.NewGuid(),
                        UpdateTime    = DateTime.Now
                    });
                }
                _workProcessRepository.Add(workProcessList);
                _workProcessRepository.CommitTran();
            }
            catch (Exception ex)
            {
                _workProcessRepository.CommitTran();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加调度任务
        /// </summary>
        /// <param name="merchantId">商家ID</param>
        /// <param name="typePath">类型路径,如:Lxm.IServices.IWorkProcessService, Lxm.Services</param>
        /// <param name="methodName">方法名</param>
        /// <param name="remark">备注</param>
        /// <param name="paramInfo">参数信息</param>
        /// <param name="funcType">执行类型</param>
        public void Add(string typePath, string methodName, string remark = "", string paramInfo = "",
                        FuncType funcType = FuncType.Function)
        {
            WorkProcess entity = new WorkProcess()
            {
                WorkProcessId = Guid.NewGuid(),
                FuncType      = (int)funcType,
                TypePath      = typePath,
                MethodName    = methodName,
                ParameterInfo = paramInfo,
                Status        = (int)WorkProcessStatus.Init,
                Remark        = remark,
                SystemType    = (int)SystemType.Book,
                UpdateTime    = DateTime.Now
            };

            _workProcessRepository.Add(entity);
        }