示例代码:
private Message SendMessage(Context ctx, string formId, string billId, string title, string content, DateTime now, long receiverId)
{
string messageId = SequentialGuid.NewGuid().ToString();
Message msg = new DynamicObject(Message.MessageDynamicObjectType);
msg.MessageId = messageId;
msg.Title = title;
msg.Content = content;
msg.CreateTime = now;
msg.SenderId = ctx.UserId;
msg.ObjectTypeId = formId;
msg.KeyValue = billId;
msg.ReceiverId = receiverId;
IDbDriver driver = new OLEDbDriver(ctx);
var dataManager = Orm.DataManagerUtils.GetDataManager(Message.MessageDynamicObjectType, driver);
dataManager.Save(msg.DataEntity);
return msg;
}
说明:
1.发消息就是往T_WF_MESSAGESEND表中写数据,对应模型FormId是WF_MessageSendBill
2.强类型实体Message(引用Kingdee.Bos.Core.Dll组件,引用Kingdee.BOS.Core.Msg命名空间);IDbDriver接口,引用Kingdee.BOS.OrmEngine.Dll组件,引用Kingdee.BOS.Orm.Drivers命名空间
推荐阅读