using System;
using System.Collections.Generic;
using System.Web;
using System.IO;
using System.Web.Security;
using System.Web.SessionState;
using System.Net.Mail;
using System.Configuration;
using CCWOnline.Management.iknow.Web;
using CSI.Management.Model;
using CCWOnline.Management.Web.MyServiceChampion.Interface;
using System.Linq;
using System.Data;

namespace website
{
public class GlobalSuper : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
// 在应用程序启动时运行的代码 Create by wuyaunyaun 2014/02/28 星魔力抽奖活动
System.Timers.Timer timer = new System.Timers.Timer(1000);//每秒钟执行以
timer.AutoReset = true;
timer.Enabled = true;
timer.Elapsed += new System.Timers.ElapsedEventHandler(EachDayJob);//使用委托
}

protected void Session_Start(object sender, EventArgs e)
{

}

protected void Application_BeginRequest(object sender, EventArgs e)
{

}

protected void Application_AuthenticateRequest(object sender, EventArgs e)
{

}

protected void Application_Error(object sender, EventArgs e)
{
Exception exception = this.Server.GetLastError();
HttpResponse Response = this.Response;
HttpRequest Request = this.Request;

//发送调试邮件
if (exception != null && ConfigurationManager.AppSettings["DebugerEnable"].ToLower() == "true")
{
if (exception.InnerException != null)
{
SendErrorEmail(exception.InnerException);
}
else
{
SendErrorEmail(exception);
}

//跳转到错误页
// string errorPage = System.Web.Configuration.WebConfigurationManager.AppSettings["ErrorPage"];
// Response.Redirect(errorPage);
}

}

protected void Session_End(object sender, EventArgs e)
{

}

protected void Application_End(object sender, EventArgs e)
{

}

protected void SendErrorEmail(Exception e)
{

}

protected string ParseTemplate(Exception e)
{

}

/// <summary>
/// 定时抽奖事件
/// Create By wuyaunyaun 2014/02/28
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
#region
void EachDayJob(object source, System.Timers.ElapsedEventArgs e)//执行的事件
{
    EachDayAward();
}

protected void EachDayAward()//自定义要执行的方法
{

}

/// <summary>
/// 获取中奖奖品名称
/// </summary>
/// <param name="Turntable"></param>
/// <returns></returns>
protected string Getname(List<ZhiWeiClass> Turntable)
{
   return LuckDrow(Turntable).ZhiWei;
}

/// <summary>
/// 计算概率
/// </summary>
/// <param name="Turntable"></param>
/// <returns></returns>
private ZhiWeiClass LuckDrow(List<ZhiWeiClass> Turntable)
{
Random Rnd = new Random();
return (from x in Enumerable.Range(0, 1000000) //最多支100万次骰子
let ZhiWeiClass = Turntable[Rnd.Next(Turntable.Count())]
let Sieve = Rnd.Next(0, 100)
where Sieve < ZhiWeiClass.Chance
select ZhiWeiClass).First();
}
#endregion

}
}

asp.net 定时器的更多相关文章

  1. ASP.NET中设置一个定时器来定时更新 转

    asp.net 定时器 比较少用,  中国红木网这是一个相当实用的功能,有了RSS博客镜像,就不需要在多处同时发布博客日志了.比如你同时在新浪上有自己的博客,又同时有自己的个人博客站点,那么你只需要在 ...

  2. C#实时读取数据----局部页面刷新【转】

    I)现在刚开始学习C#,对一些基本的控件了解的不够,有个实时监控的系统,需要页面中的数据每5秒钟刷新一次, 要是每5秒钟页面全部的刷新,那页面根本就没法看了,对这个问题在CSDN上也专门开了帖子,问了 ...

  3. 推荐一个简单、轻量、功能非常强大的C#/ASP.NET定时任务执行管理器组件–FluentScheduler定时器

    在C#WINFORM或者是ASP.NET的WEB应用程序中,根据各种定时任务的需求,比如:每天的数据统计,每小时刷新系统缓存等等,这个时候我们得应用到定时器这个东东. .NET Framework有自 ...

  4. ASP.NET MVC 中应用Windows服务以及Webservice服务开发分布式定时器

    ASP.NET MVC 中应用Windows服务以及Webservice服务开发分布式定时器一:闲谈一下:1.现在任务跟踪管理系统已经开发快要结束了,抽一点时间来写一下,想一想自己就有成就感啊!!  ...

  5. asp.net中Timer定时器在web中无刷新的使用

    最近在做一个项目的时候,web端的数据需要与数据源进行实时同步,并保证数据的准确性,当时,考虑到使用ajax异步刷新技术.但后来在网上查找相关资料时,发现这样做,太浪费资源了,因为ajax的提交请求不 ...

  6. 自己开发能在asp.net项目正常使用的定时器WebTimer,让定时器听话起来

    简述: iis是一个很不错的服务器,有很多很好用的特性来支持网站运行,但有时候这些特性却会影响到我们开发者的一些操作.比如我们需要定时运行做一些操作,但由于iis的利用应用程序池来管理这种方式会让网站 ...

  7. C#编写一个在asp.net core 3.1下的简单的corn模式的计划任务和一个更简单的定时器类

    asp.net core 下,新增了一个BackgroundService用来实现能在后台跑一个长久运行的任务,因此,也可以用来替换掉原来使用的static的Timer组件, Timer组件主要有以下 ...

  8. ASP.NET MVC 使用 FluentScheduler 定时器计划任务

    MacBook Pro 只有四个 USB Type-C 接口是否错了? 一项新技术的诞生总会对已存在的事物造成冲击或影响,如果大家都害怕冲击与影响,那这个世界永远像现在不变就行了,大家都好好的,待在自 ...

  9. 【转】ASP.NET MVC 使用 FluentScheduler 定时器计划任务

    MacBook Pro 只有四个 USB Type-C 接口是否错了? 一项新技术的诞生总会对已存在的事物造成冲击或影响,如果大家都害怕冲击与影响,那这个世界永远像现在不变就行了,大家都好好的,待在自 ...

随机推荐

  1. python中的builtin函数详解-第二篇

    classmethod(function) 这里不过多说明这个builtin方法的具体用法,python的文档和help函数已经给了这个方法充足的使用说明,所以我这里要说的时关于 classmetho ...

  2. Python异常的使用

    伪代码: try: 出错部分的代码...... except Exception as e: print '404网页' #Exception是所有错误类型的父类,包括所有出错信息 finally: ...

  3. 《30天自制操作系统》读书笔记(3) 引入C语言

    这一次的学习相当曲折, 主要是因为粗心, Makefile里面的错误导致了文件生成出现各种奇奇怪怪的问题, 弄得心力交瘁, 因此制作过程还是尽量按着作者的路子来吧. 作者提供的源码的注释在中文系统下是 ...

  4. Solr In Action 笔记(3) 之 SolrCloud基础

    Solr In Action 笔记(3) 之 SolrCloud基础 在Solr中,一个索引的实例称之为Core,而在SolrCloud中,一个索引的实例称之为Shard:Shard 又分为leade ...

  5. 转:微博"收藏/赞/转发"技术资料汇总

    书籍 HTTP权威指南 <- @Fenng Introduction to Information Retrieval <- @陈利人 Lua 源码欣赏 <- @简悦云风 The A ...

  6. mapreduce (三) MapReduce实现倒排索引(二)

    hadoop api http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Reducer.html 改变一下需求: ...

  7. jQuery plugin

    SidebarJS http://makotot.github.io/sidebar/

  8. cf B. Making Sequences is Fun

    http://codeforces.com/contest/373/problem/B 用二分枚举长度就可以. #include <cstdio> #include <cstring ...

  9. 7816的报文结构APDU

    命令APDU 包括头和主体(这可以在上面的图中看到).头包括CLA,INS,P1 和P2 域.同T0 协议一样,CLA 和INS 说明了应用的分类和指令.P1 和P2 用来详细说明具体指令,并由每一条 ...

  10. 一张图看懂片式多层陶瓷电容器(MLCC)