日历上添加活动通知(Asp.net)
<div id="calendar_contain">
</div> <script language="javascript" src="js/event.js"></script> <link href="css/gallery.css" rel="stylesheet" type="text/css" /> <script type="text/javascript">
$.ajax({
type: "post",
datatype: "json",
url: "Handler/DHallZTinfo.ashx",
async: false, //异步发送
success: function(rdata) {
rdata = $.parseJSON(rdata); //转换成json格式
for (var item = ; item < rdata.length; item++) {
hashMap.Set("" + rdata[item].time + "", "<a href=" + rdata[item].url + ">" + rdata[item].title + "</a>");
}
}
}); function Offset(e) {
var t = e.offsetTop;
var l = e.offsetLeft;
var w = e.offsetWidth;
var h = e.offsetHeight - ;
while (e = e.offsetParent) {
t += e.offsetTop;
l += e.offsetLeft;
}
return {
top: t,
left: l,
width: w,
height: h
}
} function itemShow(id) {
document.getElementById(id + "s").className = "calendarEventHov";
document.getElementById(id).style.display = "block";
} function itemHide(id) {
document.getElementById(id + "s").className = "calendarEvent";
document.getElementById(id).style.display = "none";
} //转换日期成字符串,例如2008年8月31日转换成'20080831'
function dateToString(date) {
return date.getFullYear() + this.digitFix(date.getMonth() + , ) + this.digitFix(date.getDate(), );
} //修正当前单数的月份为两位,例如'8'->'08'
function digitFix(number, count) {
var _string = number + "";
var _count = count - _string.length;
for (var i = ; i < _count; i++)
_string = "" + _string;
return _string;
}
var monthArray = ["1月", "2月", "3/月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]; </script> <script src="js/JCalendar.js" type="text/javascript"></script> <script type="text/javascript">
document.getElementById("calendar_contain").innerHTML = new JCalendar().show();
JCalendar.update(); $(function() {
/* 日历 右上角按钮*/
$('.preMonth').mouseover(function() {
$(this).attr('class', 'preMonthHov');
}).mouseout(function() {
$(this).attr('class', 'preMonth');
}); $('.nextMonth').mouseover(function() {
$(this).attr('class', 'nextMonthHov');
}).mouseout(function() {
$(this).attr('class', 'nextMonth');
}); /*显示事件安排弹出框*/
$('.calendarEvent').mouseover(function() {
$(this).css('z-index', '');
$(this).attr('class', 'calendarEventHov');
$(this).find('.calendarShowBox').show();
}).mouseout(function() {
$(this).css('z-index', '');
$(this).attr('class', 'calendarEvent');
$(this).find('.calendarShowBox').hide();
});
});
</script> ///
<%@ WebHandler Language="C#" Class="DHallZTinfo" %> using System;
using System.Web;
using System.Data;
public class DHallZTinfo : IHttpHandler
{ public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
DataTable dtdhallInfo = SystemBLL.information.Instance.selectinfobyzongid(, );//绑定日历上要显示的通知
context.Response.Write(GetJson(dtdhallInfo));
} /// <summary>
/// 编写json格式
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
private string GetJson(DataTable dt)
{
string url = "";
string strlv = "";
string flag = "";
string strid = ""; System.Text.StringBuilder _sb = new System.Text.StringBuilder(); if (dt == null || dt.Rows.Count == ) return "[]"; _sb.Append("["); int tmpRows = dt.Rows.Count; for (int i = ; i < tmpRows; i++)
{
url = dt.Rows[i]["info_url"].ToString();
strlv = dt.Rows[i]["info_lb"].ToString();
flag = dt.Rows[i]["info_zong"].ToString();
strid = dt.Rows[i]["info_id"].ToString();
if (url == "#")
{
url = "Show.aspx?info_lb=" + strlv + "&info_id=" + strid + "&flag=" + flag;
} _sb.Append("{ \"time\":\"" + GetTimeinfo(dt.Rows[i].Field<DateTime>("info_addtime")) + "\", \"url\":\"" + url + "\", \"title\":\"" + dt.Rows[i].Field<string>("info_title") + "\"}"); }
_sb.Append("]");
System.Collections.Generic.List<object> list = new System.Collections.Generic.List<object>();
foreach (var item in dt.AsEnumerable())
{
list.Add(new
{
id = item.Field<int>("id"),
url = GetUrl("", "", "", "")
});
} // var jsonstr = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
// var jsonstr2 = Newtonsoft.Json.JsonConvert.SerializeObject(list); return _sb.ToString();
}
private string GetUrl(string strlv, string strid, string flag, string url)
{
if (url == "#")
{
return url = "Show.aspx?info_lb=" + strlv + "&info_id=" + strid + "&flag=" + flag;
}
return url;
} /// <summary>
/// 获取时间
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public string GetTimeinfo(DateTime time)
{
return time.ToString("yyyyMMdd");
} public bool IsReusable
{
get
{
return false;
}
} } //效果:不知道怎么上传js文件。需要的可以问我要先关文件~~
日历上添加活动通知(Asp.net)的更多相关文章
- ASP.NET#在设计窗口上添加了一个SqlDataSource控件后,没有显示出来?
在设计窗口上添加了一个SqlDataSource控件后,没有显示出来,但后台代码是有的 处理的办法:菜单栏->视图->可视辅助->ASP.NET非可视控件 (我用的是VS2012)
- 在 Mac OS 上使用 TypeScript 编写 ASP.NET Core 1.0 应用
var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...
- Android 向系统日历中添加事件
查了一天半,总算有点大概了.以下是自己的理解,有错误的地方望指正. android系统有日历功能,应用程序可以根据一些接口开发自己的功能,即使是日历app也是根据这些接口开发的,所以我们可以利用程序向 ...
- Flash上传文件(结合asp.net)
一.实现原理.在某些场合,我们需要使用Flash进行“文件上传”,原因是Flash 能制作出表现力丰富的UI界面. (自负又孤陋寡闻的我在这里做一个补充:Flash使用flash.net包中的File ...
- 读取Excel任务列表并显示在Outlook日历上
前几天,公司发了一个任务安排,时间不固定,但要求准时到,为了给自己加一个提醒,也为了回顾一下以前的技术,特做了一个Demo. 读取Excel就不多说了,代码很简单,但支持老版本Excel和的版本Exc ...
- 【百度地图API】如何在地图上添加标注?——另有:坐标拾取工具+打车费用接口介绍
原文:[百度地图API]如何在地图上添加标注?--另有:坐标拾取工具+打车费用接口介绍 摘要: 在这篇文章中,你将学会,如何利用百度地图API进行标注.如何使用API新增的打车费用接口. ------ ...
- [原]逆向iOS SDK -- “添加本地通知”的流程分析
观点: 代码面前没有秘密 添加通知的 Demo 代码 - (void)scheduleOneLocalNotification { [[UIApplication sharedApplication] ...
- 002.Create a web API with ASP.NET Core MVC and Visual Studio for Windows -- 【在windows上用vs与asp.net core mvc 创建一个 web api 程序】
Create a web API with ASP.NET Core MVC and Visual Studio for Windows 在windows上用vs与asp.net core mvc 创 ...
- Android训练课程(Android Training) - 添加活动栏(使用action bar)
2014-10-28 张云飞VIR 翻译自:https://developer.android.com/training/basics/actionbar/index.html 添加活动栏(Addin ...
随机推荐
- mfc---CFileFind
使用CFileFind实现在指定路径下,查找指定类型文件 CFileFind.FindFile(FilePath + "\\*.*"),成功返回true,否则返回false CFi ...
- 《shell脚本学习指南》学习笔记之入门
为什么要使用shell脚本? shell脚本能够轻易处理文件与目录之类的对象,而且是各UNIX系统之间经过POSIX标准化的通用的功能,因此Shell脚本只要“用心写”一次,即可应用到很多系统上,因此 ...
- js对象继承的问题
js继承方法有多种: 1.利用call()和apply()的方法. call()里面接受多个参数:apply()只能接受两个参数. call()第一个参数是本身,后面都是他的属性和方法. apply( ...
- 黑苹果引导工具 Clover 配置详解及Clover Configurator使用
黑苹果引导工具 Clover 配置详解及Clover Configurator使用 2017-03-11 14:01:40 by SemiconductorKING 转自:@三个表哥 简介: 可 ...
- [.net 面向对象程序设计深入](24)实战设计模式——策略模式(行为型)
[.net 面向对象程序设计深入](24)实战设计模式——策略模式(行为型) 1,策略模式定义 策略模式定义了一系列的算法,并将每一个算法封装起来,而且使它们还可以相互替换.策略模式让算法独立于使用它 ...
- 每天一个Linux命令 3
Linux grep命令详解: grep(global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一 ...
- android开发艺术探索读书笔记之-------view的事件分发机制
View的点击事件的分发,其实就是对MotionEvent事件的分发过程,即当一个MotionEvent产生后,系统需要把这个事件传递给一个具体的View,而这个过程就是分发过程. 分发过程主要由以下 ...
- Hibernate注解之@Enumerated
Hibernate注解之@Enumerated 转:http://www.cnblogs.com/minideas/archive/2011/11/04/2235262.html @Enumerate ...
- 多线程——i++的坑
在使用socket编程的时候发生数据丢失问题,一直以为是网络原因,后来测试后发现是多线程操作同一数据源又未加入数据锁导致. 直接上代码,下面程序执行的结果可能出现198.199.200.两个线程统一时 ...
- iOS开发之instancetype
instancetype和id使用方法类似,但他们还有不同点: (1)instancetype在类型表示上,跟id一样,可以表示任何对象类型 (2)instancetype只能用在返回值类型上,不能像 ...
不知道怎么上传js文件。需要的可以问我要先关文件~~