日历上添加活动通知(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 ...
随机推荐
- MyBatis 使用Generator自动生成Model , Dao, mapper
最近 我新建了一 个maven 项目,使用的是spring + springmvc + mybatis框架. 听说Mybatis可以自动生成model和mapper以及dao层,我就从网上查了查资 ...
- appium desktop 版本发布
Appium Desktop is an open source app for Mac, Windows, and Linux which gives you the power of the Ap ...
- CSS,注意点!!!!!!!
css 一.整体布局 1.创建一个html标签 2.创建三个div标签(分别是网页的头部,中间,和底部三部分) 3.一般都用class选择器 4.用css给body标签加个 margin:0(用于消除 ...
- Java面试系列
如果你的面试简历是如下这样写的,请务必准备回答下面的所有问题. 面试职位:Java高级工程师 专业技能: (1)牢固掌握Java基础知识,如集合.并发.I/O等,并对Java源码有一定的研究. (2) ...
- weblogic 双机集群搭建
weblogic 双机集群搭建,基本步骤引用百度文库的一篇文章: wenlogic双机集群基本步骤 下面详解一下该文章搭建后会遇到的问题: 1. 主机名验证失败 javax.net.ssl.SSLKe ...
- 大数据系列之Flume--几种不同的Sources
1.flume概念 flume是分布式的,可靠的,高可用的,用于对不同来源的大量的日志数据进行有效收集.聚集和移动,并以集中式的数据存储的系统. flume目前是apache的一个顶级项目. flum ...
- 基于requirejs+bluebird,50行代码实现轻巧实用的前端CMD加载器
首先是github地址,可以用git克隆命令也可以直接在git页面下载 https://github.com/kazetotori/js-requireAsync 下载下来后目录结构是这样的 -pac ...
- jQuery(20161108)
jQuery的引入包必须要在其他引入包的最上方,否则会出错.因为如果在页面加载完成后还未执行jQuery包,那么jQuery的引入包就没用了 如果浏览器报错:Uncaught Error: Boots ...
- 计算两个YUV420P像素数据的PSNR---高等算法
PSNR是最基本的视频质量评价方法.本程序中的函数可以对比两张YUV图片中亮度分量Y的PSNR.函数的代码如下所示. /** * Calculate PSNR between 2 YUV420P fi ...
- Spring-Mybatis配置多数据源
可以参考: http://www.cnblogs.com/ityouknow/p/6102399.html 需要一个DatabaseConfiguration类,实现 TransactionManag ...
不知道怎么上传js文件。需要的可以问我要先关文件~~