|
庞聪
发表于 2020-4-11 14:11:02
本帖最后由 庞聪 于 2020-4-12 11:19 编辑
谭文 发表于 2020-4-9 19:04
人员多选控件值获取方法
string[] userIds = this.Request.BizObject["多选控件编码"] as string[];
再通过 ...
非常感谢!人员多选和部门多选的自定义时间提醒完全实现!完整代码如下:
using System;
using System.Collections.Generic;
using System.Text;
using H3;
public class Smgan033l6ajmqpy2489c8nzd1: H3.SmartForm.SmartFormController
{
public Smgan033l6ajmqpy2489c8nzd1(H3.SmartForm.SmartFormRequest request): base(request)
{
}
protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)
{
base.OnLoad(response);
}
protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)
{
base.OnSubmit(actionName, postValue, response);
//增加自定义消息提醒b
H3.Task.UserTask task = new H3.Task.UserTask();
string appId = "A69b534faedd64f389aa145221db1bdce"; //应用编码
string[] userIds1 = this.Request.BizObject["F0000018"] as string[];//获取人员多选控件
string[] userIds2 = this.Request.BizObject["F0000019"] as string[];//获取部门多选控件
task.ObjectId = Guid.NewGuid().ToString();//Guid码
task.Sender = H3.Organization.User.SystemUserId;//任务的发起人id
//task.UserId = this.Request.UserContext.UserId; //任务的接收人id
task.AppCode = appId;//应用编码
task.TaskType = H3.Task.TaskType.Reminder; //任务类型为提醒
task.SchemaCode = "Smgan033l6ajmqpy2489c8nzd1"; //表单编码
task.TargetType = H3.LinkTargetType.BizObject; //关联类型
task.TargetId = this.Request.BizObjectId; //关联业务对象的ID
task.TargetName = this.Request.BizObject.Name; //关联业务对象的数据标题
task.Name = "设置群体提醒"; //提醒标题
task.Summary = this.Request.BizObject["F0000001"] + string.Empty; //提醒的内容
task.**Time = DateTime.Parse(this.Request.BizObject["F0000023"] + string.Empty); // 提醒时间
task.ReminderType = H3.Task.ReminderType.Once; //提醒类型
task.StartTime = DateTime.Now; //开始时间
task.EndTime = DateTime.Now; //截止时间
task.TaskState = H3.Task.TaskState.Unfinished; //任务状态
task.**State = H3.Task.**State.Waiting; //提醒的状态
for(int i = 0;i < userIds1.Length - 1; i++)//获取人员多选接收人
{
task.UserId = userIds1; //任务的接收人id
this.Request.Engine.TaskManager.AddTask(task);//添加任务
}
for(int i = 0;i < userIds2.Length - 1; i++)//获取部门多选接收人
{
task.UserId = userIds2 ; //任务的接收人id
this.Request.Engine.TaskManager.AddTask(task);//添加任务
}
//增加自定义消息提醒e
}
}
|
|