protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { Tunnel.BLL.Tunnel_workplan tw = new Tunnel.BLL.Tunnel_workplan(); Tunnel.Model.Tunnel_workplan tww = tw.GetModel(int.Parse(Request.QueryString["id"].ToString())); Label1.Text = tww.w_title; Label2.Text = tww.w_starttime.ToString(); Label4.Text = tww.w_content; if (tww.w_endtime.ToString() == "1800-01-01 0:00:00") { Label3.Text = "不提醒"; } else { Label3.Text = tww.w_endtime.ToString(); } } else { Response.Redirect("Default.aspx"); } } }
protected void Button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TextBox1.Text.Trim())) { if (Tunnel.Common.RegexComm.IsValidTime(text1.Value, 1)) { Tunnel.BLL.Tunnel_workplan tw = new Tunnel.BLL.Tunnel_workplan(); Tunnel.Model.Tunnel_workplan tww = new Tunnel.Model.Tunnel_workplan(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tww.w_user = ul.LoginID; tww.w_title = TextBox1.Text; tww.w_starttime = Convert.ToDateTime(text1.Value); switch (DropDownList1.SelectedValue) { case "0": tww.w_endtime = Convert.ToDateTime("1800-01-01"); break; case "1": tww.w_endtime = tww.w_starttime.AddMinutes(-10); break; case "2": tww.w_endtime = tww.w_starttime.AddMinutes(-30); break; case "3": tww.w_endtime = tww.w_starttime.AddMinutes(-60); break; case "4": tww.w_endtime = tww.w_starttime.Date; break; case "5": tww.w_endtime = tww.w_starttime; break; default: break; } tww.w_content = TextBox2.Text; int id = tw.Add(tww); //添加消息机制 call(tww.w_title, id.ToString(), tww.w_endtime); // Tunnel.Common.Message.Show("添加成功!"); } else { Tunnel.Common.Message.Show("日期格式不正确!"); } } else { Tunnel.Common.Message.Show("请填写标题!"); } }
public void Del() { Tunnel.BLL.Tunnel_workplan tw = new Tunnel.BLL.Tunnel_workplan(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tw.Delete(int.Parse(Request.QueryString["id"].ToString()), ul.LoginID, Tunnel.Common.Common.GetIp()); Tunnel.BLL.Tunnel_Remind tr = new Tunnel.BLL.Tunnel_Remind(); Tunnel.Model.Tunnel_Remind trr = new Tunnel.Model.Tunnel_Remind(); List <Tunnel.Model.Tunnel_Remind> trList = new List <Tunnel.Model.Tunnel_Remind>(); trList = tr.GetModelList("m_type=3 and m_typeid=" + Request.QueryString["id"].ToString() + ""); if (trList.Count > 0) { tr.Delete(trList[0].m_typeid); } }
protected void calSchedule_DayRender(object sender, DayRenderEventArgs e) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); Tunnel.Model.Tunnel_menber user = tm.GetModel(Convert.ToInt64(ul.LoginID.ToString())); //自定义显示内容 CalendarDay calDay = e.Day; //获取表示呈现在空间中的单元格 TableCell tc = e.Cell; if (calDay.IsOtherMonth) { tc.Controls.Clear(); } else { try { HtmlAnchor ahyperLink = new HtmlAnchor(); ahyperLink.InnerHtml = calDay.Date.Day > 9 ? "<img src='../image/notify_new.gif' />" : " <img src='../image/notify_new.gif' />"; ahyperLink.Title = "新增个人日程"; ahyperLink.HRef = "CalendarAdd.aspx?day=" + calDay.Date.ToShortDateString(); ahyperLink.ID = "ServerA"; tc.Controls.Add(new LiteralControl(" " + " " + " ")); tc.Controls.Add(ahyperLink); Tunnel.BLL.Tunnel_workplan tw = new Tunnel.BLL.Tunnel_workplan(); List <Tunnel.Model.Tunnel_workplan> wkList = tw.GetModelList("w_user="******" and w_starttime>='" + calDay.Date.ToShortDateString() + "' and w_starttime<'" + calDay.Date.AddDays(1).ToShortDateString() + "'"); if (wkList.Count > 0) { string str = null; foreach (Tunnel.Model.Tunnel_workplan schedule in wkList) { int tmpCount = imgCount++; HtmlAnchor ha = new HtmlAnchor(); ha.Attributes.Add("onmouseover", "javascript:show('img" + tmpCount + "')"); ha.HRef = "CalendarInfo.aspx?id=" + schedule.w_id + "&day=" + calDay.Date.ToShortDateString(); //try //{ // str = schedule.w_title.Substring(0, 3); //} //catch //{ // str = schedule.w_title.ToString(); //} ha.InnerHtml = "<img src='../image/atchm.gif' border=0 />" + schedule.w_starttime.Hour.ToString() + ":" + schedule.w_starttime.Minute.ToString() + " " + str + "..." + "<a href='?id=" + schedule.w_id + "' onClick=\"return confirm('是否删除此条记录?')\">" + "<img alt='删除日程' id=img" + tmpCount + " name=remove src='../image/remove.png' border=0 style='display:none'/></a>"; tc.Controls.Add(new LiteralControl(" " + " " + " ")); tc.Controls.Add(new LiteralControl("<br>")); tc.Controls.Add(ha); } } } catch (Exception) { //Response.Write(ex.ToString()); } e.Cell.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';"; e.Cell.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff'"; } }