protected void Page_Load(object sender, EventArgs e) { DateTime dt = DateTime.Now; DateTime stime = new DateTime(dt.Year, dt.Month, 1); DateTime etime = new DateTime(dt.Year, dt.Month, 1).AddMonths(1).AddSeconds(-1); int type = -1; if (Request["start"] != null) { try { stime = DateTime.Parse(Request["start"]); } catch { } } if (Request["end"] != null) { try { etime = DateTime.Parse(Request["end"]); } catch { } } if (Request["type"] != null) { try { type = Convert.ToInt32(Request["type"]); } catch { } } if (Request["staffid"] != null) { try { staffid = Request["staffid"]; } catch { } } if (Request["deptid"] != null) { try { deptid = Request["deptid"]; } catch { } } if (Request["orgid"] != null) { try { orgid = Request["orgid"]; } catch { } } V_HR_CK_USERINFO con = new V_HR_CK_USERINFO(); decimal staffidd = -1; if (staffid.Trim() != "" && decimal.TryParse(staffid, out staffidd)) { con.STAFF_ID = staffidd; } else if (deptid.Trim() != "") con.Like(V_HR_CK_USERINFO.Attribute.DEPT_ID, deptid); else if (orgid.Trim() != "") con.Like(V_HR_CK_USERINFO.Attribute.ORG_ID, orgid); else con.STAFF_ID = this.userBase.StaffID; //����ת����ʽ ��Ҫ���������ռ䣺using System.Globalization; string fmtDate = "ddd MMM d HH:mm:ss 'UTC'zz'00' yyyy"; CultureInfo ciDate = CultureInfo.CreateSpecificCulture("en-US"); //��C#ʱ��ת����JSʱ���ַ��� //string JSstring = DateTime.Now.ToString(fmtDate, ciDate); //��JSʱ���ַ���ת����C#ʱ�� //DateTime dt = DateTime.ParseExact("Wed Apr 7 14:40:41 UTC+0800 2010", fmtDate, ciDate); DataTable schData = GetWorkViewBodyTable(); Dictionary<DateTime, List<V_SchedulingSchClass>> sch = GetScheduling(stime, etime, type); if (sch != null) { foreach (DateTime date in sch.Keys) { int index = 0; foreach (V_SchedulingSchClass vss in sch[date]) { index++; DataRow dr = schData.NewRow(); dr["date"] = "date" + date.ToString("yyyy_MM_dd");// date.ToString(fmtDate, ciDate); ; dr["id"] = date.ToString("yyyyMMdd") + index.ToString().PadLeft(2, '0'); dr["title"] = vss.SchName + (vss.IsOverTime?"[�Ӱ�]":""); dr["start"] = new DateTime(date.Year, date.Month, date.Day, vss.StartHour, vss.StartMin, 0).ToString("yyyy-MM-dd HH:mm:ss"); dr["end"] = new DateTime(date.Year, date.Month, date.Day, vss.EndHour, vss.EndMin, 0).ToString("yyyy-MM-dd HH:mm:ss"); dr["color"] = vss.Color; dr["type"] = vss.SchType; dr["typename"] = formhelper.GetOptionText(HR_Scheduling.Attribute.SchType, vss.SchType); schData.Rows.Add(dr); } } } Response.Write("<?xml version=\"1.0\" standalone=\"yes\"?>\r\n"); schData.WriteXml(Response.OutputStream); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { DateTime dt = DateTime.Now; DateTime stime = new DateTime(dt.Year, dt.Month, 1); DateTime etime = new DateTime(dt.Year, dt.Month, 1).AddMonths(1).AddSeconds(-1); int type = -1; if (Request["start"] != null) { try { stime = DateTime.Parse(Request["start"]); } catch { } } if (Request["end"] != null) { try { etime = DateTime.Parse(Request["end"]); } catch { } } if (Request["type"] != null) { try { type = Convert.ToInt32(Request["type"]); } catch { } } if (Request["staffid"] != null) { try { staffid = Request["staffid"]; } catch { } } if (Request["deptid"] != null) { try { deptid = Request["deptid"]; } catch { } } if (Request["orgid"] != null) { try { orgid = Request["orgid"]; } catch { } } V_HR_CK_USERINFO con = new V_HR_CK_USERINFO(); decimal staffidd = -1; if (staffid.Trim() != "" && decimal.TryParse(staffid, out staffidd)) { con.STAFF_ID = staffidd; } else if (deptid.Trim() != "") { con.Like(V_HR_CK_USERINFO.Attribute.DEPT_ID, deptid); } else if (orgid.Trim() != "") { con.Like(V_HR_CK_USERINFO.Attribute.ORG_ID, orgid); } else { con.STAFF_ID = this.userBase.StaffID; } //设置转换格式 需要引入命名空间:using System.Globalization; string fmtDate = "ddd MMM d HH:mm:ss 'UTC'zz'00' yyyy"; CultureInfo ciDate = CultureInfo.CreateSpecificCulture("en-US"); //将C#时间转换成JS时间字符串 //string JSstring = DateTime.Now.ToString(fmtDate, ciDate); //将JS时间字符串转换成C#时间 //DateTime dt = DateTime.ParseExact("Wed Apr 7 14:40:41 UTC+0800 2010", fmtDate, ciDate); DataTable schData = GetWorkViewBodyTable(); Dictionary <DateTime, List <V_SchedulingSchClass> > sch = GetScheduling(stime, etime, type); if (sch != null) { foreach (DateTime date in sch.Keys) { int index = 0; foreach (V_SchedulingSchClass vss in sch[date]) { index++; DataRow dr = schData.NewRow(); dr["date"] = "date" + date.ToString("yyyy_MM_dd");// date.ToString(fmtDate, ciDate); ; dr["id"] = date.ToString("yyyyMMdd") + index.ToString().PadLeft(2, '0'); dr["title"] = vss.SchName + (vss.IsOverTime?"[加班]":""); dr["start"] = new DateTime(date.Year, date.Month, date.Day, vss.StartHour, vss.StartMin, 0).ToString("yyyy-MM-dd HH:mm:ss"); dr["end"] = new DateTime(date.Year, date.Month, date.Day, vss.EndHour, vss.EndMin, 0).ToString("yyyy-MM-dd HH:mm:ss"); dr["color"] = vss.Color; dr["type"] = vss.SchType; dr["typename"] = formhelper.GetOptionText(HR_Scheduling.Attribute.SchType, vss.SchType); schData.Rows.Add(dr); } } } Response.Write("<?xml version=\"1.0\" standalone=\"yes\"?>\r\n"); schData.WriteXml(Response.OutputStream); Response.End(); }