氚云丨开发课— 06 Timer 定时器的常见使用| 学习笔记

简介: 快速学习氚云丨开发课— 06 Timer 定时器的常见使用。

开发者学堂课程【低代码氚云应用开发课程氚云丨开发课— 06 Timer 定时器的常见使用】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/894/detail/14283


氚云丨开发课— 06 Timer 定时器的常见使用


Timer 定时器的常见使用

Timer
特性:继承类 Timer,4小时执行一遍,时间不固定
public class MyTest_Timer: H3.SmartForm.Timer
//构造方法,跟类名保持一致,里面不必书写代码,但是必须存在
public MyTest_Timer(){ }
//重写窟时器引擎执行的方法,必须存在,且方法名必须为 OnWork
protected override void OnWork(H3.IEngine engine)
public class D66159979535fac4d814ac9a4e8e6596915f458: H3.SmartForm.SmartFormController
public D9@159979535fac4d814ac9a4e8e6596915f458(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.SubmitSmartForn
base.OnSubmit(actionName, postValue, response);public class MyTest_Timer: H3.SmartForm.Timer
//构造方法,跟类名保持一致,里面不必书写代码,但是必须存在
public MyTest_Timer(){}
//重写定时器引擎执行的方法,必须存在,且方法名必须为 OnWork

protected override void OnWork(H3.IEngineI engine)
string SelSql ="select * from I_D881599c275fala12e94a869fdd62e5727717b8 where datee";
DataTable SelDt = engine.Query.QueryTable(SelSql, null);if(SelDt 1= null && SelDt.Rows.Count > e)foreach(DataRow item in SelDt.Rows) 

发送消息通知
示例:
List _messageList=newList0;

string title =“欢迎词”;/标题
string welcomeWords ="hello,氚云!\n很荣幸加入你";//发送内容
string send = H3.Organization.User.SystemUserld;//发起人
string receiverid = this.Request.UserContext.Userld;//接收人
H3.Notification.UserMessage _message = new
H3.Notification.UserMessage(H3.Notification.UserMessageType.DingTalkPlainText,
send, receiverid,"", title, welcomeWords,""):
_messageList.Add(_message);
ifL_messageList.Count > 0)
this.Request.Engine.Notifier.Send(_messageList.ToArray();://执行发送public void SendMessage(H3.IEngine engine,H3.DataModel.Bizobject biz)H3.Task.UserTask task = new H3.Task.UserTask();string appId ="D801599c275fala12e94a869fdd62e5727717b8"; //应用编码
task.ObjectId = Guid.NewGuid().ToString();//Guid 码
task.Sender = H3.Organization.User.SystemUserId;//任务的发起人 id
task.UserId ="a98364eb-5743-4890-9ed9-2bb3fBaebc92";//任务的接收人 id
task.AppCode ="D901599W";//应用编码
task.TaskType = H3.Task.TaskType.Reminder;//任务类型为提醒
task.SchemaCode ="De61599c275fala12e94a869fdd62e5727717b8";//表单编码
task.TargetType = H3.LinkTargetType.BizObject;//关联类型
task.TargetId = biz.ObjectId;//关联业务对象的ID
task.TargetName = biz.Name;//关联业务对象的数据标题
task.Name =“库存过期";//提醒标题
task.Summary ="库存过期";//提醒的内容
task.AlertTime = DateTime.Now;// 提醒时间
task.ReminderType = H3.Task.ReminderType.Once;//提醒类型
task.StartTime = DateTime.Now;//开始时间
task.EndTime = DateTime.Now;//截止时间
task.TaskState = H3.Task.TaskState.Unfinished;//任务状态
task.AlertState = H3.Task.AlentState.Waiting;//提醒的状态
ensine.TaskManaser.AddTask(ta2E):77添加任务

public class MyTest_Timer: H3.SmartForm.Timer
//构造方法,跟类名保持一致,里面不必书写代码,但是必须存在
public MyTest_Timer(){ }
//重写定时器引擎执行的方法,必须存在,且方法名必须为 Onwork
protected override void OnWork(H3.IEngine engine)DoTask(engine);
public void PoTaskH3.IEngine engine)string SelSql ="select * from I_D6@1599c275fala12e94a869fdd62e5727717b8

where datee";
DataTable SelDt = engine.Query.QueryTable(SelSql, null);
if(SelDt != null && SelDt.Rows.Count >e)
foreach(DataRow item in SelDt.Rows)
H3.DataMode1.BizObject biz = H3.DataModel.Biz0bject.Load(H3.Organization.User.SystemUserId, engine,"D861599c275fa1a12e94a869fdd62e5727717
SendMessage(engine, biz);

using System;using System.Collections.Generic;
using System.Text;
using H3;
using System.Data;public class D6@159979535fac4d814ac9a4e8e6596915f458:H3.SmartForm.SmartFormController
public Dee159979535fac4d814ac9a4e8e6596915f458(H3.SmartForm.SmartFormRequest request): base(request)protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)
MyTest_Timer timer=new MyTest_Timer();timer.DoTask(this.Engine);
base.OnLoad(response);protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)base.OnSubmit(actionName, postvalue, response);

相关文章
|
开发者
氚云丨开发课— 05 后端代码调试与业务对象操作| 学习笔记
快速学习氚云丨开发课— 05 后端代码调试与业务对象操作。
|
前端开发 数据挖掘 BI
氚云丨开发课— 03 氚云子表的常见操作| 学习笔记
快速学习氚云丨开发课— 03 氚云子表的常见操作。
氚云丨开发课— 03 氚云子表的常见操作| 学习笔记
|
JSON 移动开发 Java
氚云丨开发课— 09平台 API 的调用及自定义 API 的编写与调用| 学习笔记
快速学习氚云丨开发课— 09平台 API 的调用及自定义 API 的编写与调用。
|
前端开发 数据库 开发者
氚云丨开发课— 02 一般控件的前后端操作| 学习笔记
快速学习氚云丨开发课— 02 一般控件的前后端操作。
氚云丨开发课— 02 一般控件的前后端操作| 学习笔记
|
JSON 中间件 C#
氚云的第三方接口调用| 学习笔记
快速学习氚云的第三方接口调用。
|
JavaScript 前端开发 测试技术
移动端(APP)自动化脚本工具详细列举(autojs、easyclick、hamibot、ctrljs ...)
移动端(APP)自动化脚本工具详细列举(autojs、easyclick、hamibot、ctrljs ...)
5195 0
|
Web App开发 Ubuntu 前端开发
【踩坑记】Ubuntu 20.04.6 LTS下编译安装gcc 4.4.0
【踩坑记】Ubuntu 20.04.6 LTS下编译安装gcc 4.4.0
|
机器学习/深度学习 Java TensorFlow
如何在Java中实现图像识别
如何在Java中实现图像识别
|
数据采集 前端开发 数据可视化
程序员必知:基于氚云平台的应用开发学习(一)
程序员必知:基于氚云平台的应用开发学习(一)
631 0