///// <summary> ///// 新增 ///// </summary> //public override bool AddNew(UserJobData data) //{ // var job = Access.First(p => p.EntityType == data.EntityType && p.LinkId == data.LinkId && // p.ToUserId == data.ToUserId && p.FromUserId == data.FromUserId && // p.JobStatus < JobStatusType.Succeed); // if (job != null) // { // data.Id = job.Id; // return Update(data); // } // return base.AddNew(data); //} /// <summary> /// 初始化UI操作的信息 /// </summary> /// <param name="job"></param> public void InitJobByUi(UserJobData job) { switch (job.JobType) { case UserJobType.Audit: job.UserJob = "audit"; break; case UserJobType.Edit: job.UserJob = "edit"; break; default: job.UserJob = "msg"; break; } WorkflowControler.SetJobUiInfomation(job); }
/// <summary> /// 读取Form传过来的数据 /// </summary> /// <param name="data">数据</param> /// <param name="convert">转化器</param> protected override void ReadFormData(UserJobData data, FormConvert convert) { DefaultReadFormData(data, convert); data.FromUserId = LoginUser.Id; data.LinkId = GetIntArg("lid", 0); data.EntityType = GetIntArg("eid", 0); data.JobType = UserJobType.Audit; var users = GetIntArrayArg("ToUserIds"); if (users.Length == 0) { throw new AgebullBusinessException("必须有接收者"); } if (BusinessContext.Current.LoginUser.RoleId > 1 && users.Any(p => p == BusinessContext.Current.LoginUserId)) { throw new AgebullBusinessException("不得提交给自己"); } users = users.Where(p => p > 0).Distinct().ToArray(); if (users.Length == 0) { throw new AgebullBusinessException("必须有接收者"); } var ids = GetIntArrayArg("ids").Distinct().ToArray(); if (ids.Length == 0) { throw new AgebullBusinessException("必须有数据"); } bool first = true; var cpy = new UserJobData(); cpy.CopyValue(data); string title = data.Title; foreach (var user in users) { foreach (var id in ids) { var wd = WorkflowControler.LoadData(data.EntityType, id); if (first) { data.ToUserId = user; data.LinkId = id; if (title != null && wd != null) { data.Title = title.Replace("*", wd.Title); } first = false; } else { cpy.ToUserId = user; cpy.LinkId = id; if (title != null && wd != null) { cpy.Title = title.Replace("*", wd.Title); } Business.AddNew(cpy); } } } }
public IWorkflowData GetJobData(int id) { var job = Details(id); return(WorkflowControler.LoadData(job.EntityType, job.LinkId)); }