📄 myday.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using MyOffice.BLL;
using MyOffice.Models;
public partial class ScheduleManage_MyDay : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Time_DayRender(object sender, DayRenderEventArgs e)
{
//取出该日历正要显示数据的单元格
TableCell cell = e.Cell;
//判断如果该日期不是本月内日期就不显示
if (e.Day.IsOtherMonth)
{
cell.Text = "";
}
else {
//创建一个超链接
HyperLink link = new HyperLink();
link.ImageUrl = "~/images/add_Schedule.gif";
link.ToolTip = "新增个人日程";
string times = e.Day.Date.Year + "-" + e.Day.Date.Month + "-" + e.Day.Date.Day;
string smalltimes =times+" "+"23:59:59";
DateTime atimes = DateTime.Parse(times);
DateTime asmalltimes = DateTime.Parse(smalltimes);
link.NavigateUrl = "SaveMySchedule.aspx?DateTimes="+times;
//将超链接填入到该单元格
cell.Controls.Add(link);
cell.Controls.Add(new LiteralControl("<br>"));
//创建一个标签,用于显示农历
Label lbl = new Label();
//实例化一个农历类的对象
ChinaDate cd = new ChinaDate();
lbl.Text = cd.GetDate(e.Day.Date);
cell.Controls.Add(lbl);
UserInfoModel uim = (UserInfoModel)Session["User"];
List<ScheduleModel> schmos = scheduleBLL.SelectTimeSche(atimes,asmalltimes,uim.UserId);
if (schmos.Count != 0)
{
foreach (ScheduleModel schmo in schmos)
{
HyperLink label1 = new HyperLink();
/* Label label1 = new Label();*/
DateTime dt = schmo.CreateTime;
string datime = dt.ToShortTimeString();
label1.Text = "@" + datime + schmo.SchContent.Substring(0, 3) + "...";
label1.NavigateUrl = "SaveMySchedule.aspx?DateTimes=" + times+"&SchduleId="+schmo.ScheduleId;
cell.Controls.Add(new LiteralControl("<br>"));
cell.Controls.Add(label1);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -