日历上添加活动通知(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 ...
随机推荐
- 2017-2-22 if语句 if语句的嵌套 以及课堂练习 经典猜拳游戏,闰年判断,输出当前时间的天数等
(一)if语句 1.格式 if(){ }else if() { } 注意:如果if后面不写花括号,只执行下面第一句 (二)语句1:顺序语句 2:循环语句 3:分支语句 课后练习: 1.猜拳游戏(用 ...
- 构建Docker平台【第四篇】创建服务及扩缩容等操作
第一步:创建服务 1. 配置 nginx 的 yaml 文件 apiVersion: extensions/v1beta1 kind: Deployment metadata: name: my-ng ...
- Collector for ArcGIS的使用体验
基于Esri的Portal for ArcGIS(下面简称Portal),用户可以搭建一个本地的地理信息云平台.围绕着这个云平台,Esri为不同的终端提供了响应的解决方案,其中Collector fo ...
- 使用Spring构建RMI服务器和客户端
上一篇文章我们实用JDK原生API构造了简单RMI应用,本篇将实用Spring框架来构造RMI的应用,实用Spring你会体验到简单,不需要那么多的条条框框,因为Spring给你做了很多封装. 项目构 ...
- 1083: [SCOI2005]繁忙的都市
1083: [SCOI2005]繁忙的都市 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 1319 Solved: 878[Submit][Stat ...
- 485. Max Consecutive Ones
题目 Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: ...
- Alamofire源码解读系列(六)之Task代理(TaskDelegate)
本篇介绍Task代理(TaskDelegate.swift) 前言 我相信可能有80%的同学使用AFNetworking或者Alamofire处理网络事件,并且这两个框架都提供了丰富的功能,我也相信很 ...
- mui和zepto的tap事件
zepto.js和mui一起使用的时候,tap事件会发生两次,这时只要不引用zepto.js的touch.js就可以了,只用mui的tap事件转自[B5教程网]:http://www.bcty365. ...
- Map集合概述和特点
A:Map集合概述和特点(Set底层依赖的是Map) 将键映射到值的对象 一个映射不能包含重复的键 每个键最多只能映射到一个值 B:Map接口和Collection接口的不同 Map是双列的(是双列集 ...
- Android中查看布局文件中的控件(view,id)在哪里被调用(使用)
在阅读别人的代码时通常是很痛苦的,有时很想要看一看布局中的控件在哪里被调用了,为之很苦恼 在这里提供一种方法. 复制要查看的控件ID,到R文件中搜索到该ID, 接下来就好办的了,选中ID按下C ...
不知道怎么上传js文件。需要的可以问我要先关文件~~