XAF-通知模块概述 web+win
通知模块概述
1.支持 WinForms和ASP.NET程序.
2.支持调度模块或自定义业务对象.
3.功能:在指定的时间,弹出一个窗口,用户可以查看提醒.也可以取消或推迟.
如需演示项目的源码,可以在留言中留下邮箱!
要使用通知模块,需要使用下面的模块.
第一步:
第二步:
第三步:
Windows Form下面的效果,在底部,出现下图所示的小图标:
在ASP.NET下效果如下:
如何使用自定义类实现通知?
1.假如下面是你的业务类:
[DefaultClassOptions]
public class Task {
[Browsable(false)]
public int Id { get; private set; }
public string Subject { get; set; }
public DateTime DueDate { get; set; }
}
先来实现ISupportNotifications 接口:
[DefaultClassOptions]
public class Task : ISupportNotifications {
// ... #region ISupportNotifications members
private DateTime? alarmTime;
[Browsable(false)]
public DateTime? AlarmTime {
get { return alarmTime; }
set {
alarmTime = value;
if (value == null) {
RemindIn = null;
IsPostponed = false;
}
}
}
[Browsable(false)]
public bool IsPostponed { get; set; }
[Browsable(false), NotMapped]
public string NotificationMessage {
get { return Subject; }
}
public TimeSpan? RemindIn { get; set; }
[Browsable(false), NotMapped]
public object UniqueId {
get { return Id; }
}
#endregion
}
再来实现IXafEntityObject,在保存时设置AlarmTime
[DefaultClassOptions]
public class Task : ISupportNotifications, IXafEntityObject {
// ...
#region IXafEntityObject members
public void OnCreated() { }
public void OnLoaded() { }
public void OnSaving() {
if (RemindIn.HasValue) {
AlarmTime = DueDate - RemindIn.Value;
}
else {
AlarmTime = null;
}
if (AlarmTime == null) {
RemindIn = null;
IsPostponed = false;
}
}
#endregion
}
运行,输入数据:
效果:
如何让为指定的用户指定通知?
[DefaultClassOptions]
public class Task : ISupportNotifications, IXafEntityObject {
// ...
public virtual Employee AssignedTo { get; set; }
}
下面是员工对象,下面是EF的例子,xpo区别的也不大:
using System.ComponentModel;
using DevExpress.Persistent.Base;
// ...
[DefaultClassOptions, DefaultProperty("UserName")]
public class Employee : DevExpress.Persistent.BaseImpl.EF.User {
public Employee() {
Tasks = new List<Task>();
}
public virtual IList<Task> Tasks { get; set; }
}
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp.Notifications;
using DevExpress.Persistent.Base.General;
// ...
public override void Setup(XafApplication application) {
base.Setup(application);
application.LoggedOn += new EventHandler<LogonEventArgs>(application_LoggedOn);
}
void application_LoggedOn(object sender, LogonEventArgs e) {
NotificationsModule notificationsModule = Application.Modules.FindModule<NotificationsModule>();
DefaultNotificationsProvider notificationsProvider = notificationsModule.DefaultNotificationsProvider;
notificationsProvider.CustomizeNotificationCollectionCriteria += notificationsProvider_CustomizeNotificationCollectionCriteria;
}
void notificationsProvider_CustomizeNotificationCollectionCriteria(
object sender, CustomizeCollectionCriteriaEventArgs e) {
if (e.Type == typeof(Task)) {
e.Criteria = CriteriaOperator.Parse("AssignedTo is null || AssignedTo.Id == CurrentUserId()");
//可以看到,这里有个过滤条件,即,通知时,使用什么条件进行过滤.
}
}
如果使用调度模块,则可以使用下面的代码:
using DevExpress.ExpressApp.Scheduler;
// ...
void application_LoggedOn(object sender, LogonEventArgs e) {
SchedulerModuleBase schedulerModule = Application.Modules.FindModule<SchedulerModuleBase>();
NotificationsProvider notificationsProvider = schedulerModule.NotificationsProvider;
notificationsProvider.CustomizeNotificationCollectionCriteria += notificationsProvider_CustomizeNotificationCollectionCriteria;
}
默认情况下,通知刷新间隔是 5 分钟。出于测试目的,可以减少此时间间隔。
双击WIN应用程序项目的 WinApplication.cs(vb) 文件,在模块部分的模块设计器中选择NotificationsModule。在属性窗口中,将 NotificationsModule.NotificationsRefreshInterval 设置为 10 秒。
同样的,在WEB项目的WebApplication.cs(vb) 文件中也需要做这个。
如需演示项目的源码,可以在留言中留下邮箱!
XAF-通知模块概述 web+win的更多相关文章
- XAF-BI.Dashboard模块概述 web/win
Dashboard模块介绍了在ASP.NET XAF 和 WinForms 应用程序中简单的集成 DevExpress Dashboard控件的方法. 其实不仅仅是控件,利用了现有的XAF数据模型,这 ...
- openstack七大模块概述
前言 OpenStack主要由七部分组成,分别是Identify, Image, Network, Compute, Block Storage, Object Storage, Dashboard, ...
- 使用nodejs的http模块创建web服务器
使用nodejs的http模块创建web服务器 laiqun@msn.cn Contents 1. web服务器基础知识 2. Node.js的Web 服务器 3. 代码实现 1. web服务器基础知 ...
- spark概念、编程模型和模块概述
http://blog.csdn.net/pipisorry/article/details/50931274 spark基本概念 Spark一种与 Hadoop 相似的通用的集群计算框架,通过将大量 ...
- Java开源生鲜电商平台-通知模块设计与架构(源码可下载)
Java开源生鲜电商平台-通知模块设计与架构(源码可下载) 说明:对于一个生鲜的B2B平台而言,通知对于我们实际的运营而言来讲分为三种方式: 1. 消息推送:(采用极光推送) ...
- eclipse中创建多模块maven web项目
本文讲述在eclipse中创建分模块maven web项目. 暂时将一个项目分为controller:service:dao以及父类模块四部分. 1.创建父类模块. 创建一个简单的maven proj ...
- 用 requests 模块从 Web 下载文件
用 requests 模块从 Web 下载文件 requests 模块让你很容易从 Web 下载文件,不必担心一些复杂的问题,诸如网络错误.连接问题和数据压缩.requests 模块不是 Python ...
- [HeadFrist-HTMLCSS学习笔记]第三章构建模块:Web页面建设
[HeadFrist-HTMLCSS学习笔记]第三章构建模块:Web页面建设 敲黑板!! <q>元素添加短引用,<blockquote>添加长引用 在段落里添加引用就使用< ...
- IIS7 404 模块 IIS Web Core 通知 MapRequestHandler 处理程序 StaticFile 错误代码 0x80070002
<system.webServer> <!--添加--> <modules runAllManagedModulesForAllRequests="true&q ...
随机推荐
- SVM入门(一)
近来,了解了一下SVM(支持向量机 support vector machine)的原理.顺便把自己理解的内容整理一下. 不讲背景啦,直接切入主题. 一.什么是支持向量机 好比说,我们现在在一 ...
- 使用curl上传报错问题排查
1. THE STOR COMMAND 说明存储出了问题,处理方案: 方案1: 请检查ftp服务器存储是否已满,若已满则清理一下空间即可. 方案2: 若ftp服务器存储未满,请检查是否有上传了的文件, ...
- c++ TCP keepalive 使用
来源:http://blog.csdn.net/weiwangchao_/article/details/7225338 http://www.cnitblog.com/zouzheng/archiv ...
- JPA规范及其它持久层框架
JPA是一种规范,而hibernate是JPA的一种实现 JPA全称为Java Persistence API ,Java持久化API是Sun公司在Java EE 5规范中提出的Java持久化接口.J ...
- MySQL主从复制与主主复制
1.简介 MySQL作为世界上使用最为广泛的数据库之一,免费是其原因之一.但不可忽略的是它本身的功能的确很强大.随着技术的发展,在实际的生产环境中,由单台MySQL数据库服务器不能满足实际的需求.此时 ...
- 强化学习读书笔记 - 05 - 蒙特卡洛方法(Monte Carlo Methods)
强化学习读书笔记 - 05 - 蒙特卡洛方法(Monte Carlo Methods) 学习笔记: Reinforcement Learning: An Introduction, Richard S ...
- ActiveMQ学习系列(四)----消息持久化到mysql
前记:目前学习还比较杂乱,还未找到系统化地学习ActiveMq的方法.在网上看到消息持久化的demo,了解了一下,在此记录. 一.目前ActiveMq支持的持久化方法 url:http://activ ...
- [HDU1282]回文数猜想
Problem Description 一 个正整数,如果从左向右读(称之为正序数)和从右向左读(称之为倒序数)是一样的,这样的数就叫回文数.任取一个正整数,如果不是回文数,将该数与他的倒 序数相加, ...
- jQuery测验题
1.在div元素中,包含了一个<span>元素,通过has选择器获取<div>元素中的<span>元素的语法是? 提示使用has() $("div:has ...
- vue关于class和样式的使用
这篇文章主要为大家详细介绍了Vue.js的Class与样式绑定,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 数据绑定一个常见需求是操作元素的 class 列表和它的内联样式.因为它们都是 att ...