public static IList<IDictionary> GetNearSchedules(int ProjectId, int UserId, int Type)
 {
     //IList<Schedule> List = new List<Schedule>();
     ScheduleDao SchDao = new ScheduleDao();
     DateTime Now = DateTime.Now;
     if (Type == 1)
     {
         DateTime StartTime = Now.AddDays(-7);
         return SchDao.GetDateSchedule<IDictionary>(ProjectId, UserId, StartTime, Now);
     }
     else
     {
         DateTime EndTime = Now.AddDays(7);
         return SchDao.GetDateScheduleNext<IDictionary>(ProjectId, UserId, Now, EndTime);
     }
     //return List;
 }
        public FileResult SurveyExport(string ExportType, FormCollection FormData)
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            int UserId = Convert.ToInt32(sitemaster["userid"]);
            Dictionary<string, string> FormDict = ParmHelper.Analysis(FormData);
            ProjectDao ProjectD = new ProjectDao();
            ScheduleDao SchDao = new ScheduleDao();
            IList<IDictionary> ProjectList = ProjectD.ProjectExport<IDictionary>(FormDict);
            DateTime Now = DateTime.Now;
            DateTime DateStart = Now;
            DateTime DateEnd = Now;
            switch (ExportType)
            {
                case "day":
                    DateStart = Convert.ToDateTime(Now.ToShortDateString() + " 00:00");
                    DateEnd = Convert.ToDateTime(Now.ToShortDateString() + " 23:59");

                    break;
                case "week":
                    DateStart = Now.AddDays(1 - Convert.ToInt32(Now.DayOfWeek.ToString("d")));
                    DateEnd = DateStart.AddDays(6);

                    break;
                case "month":
                    DateStart = Now.AddDays(1 - Now.Day);
                    DateEnd = Now.AddMonths(1).AddDays(-1);

                    break;
                default:
                    break;
            }

            string result = string.Empty;
            foreach (var Project in ProjectList)
            {
                IList<IDictionary> DayScheduleList = SchDao.GetDateSchedule<IDictionary>(Convert.ToInt32(Project["Id"]), UserId, DateStart, DateEnd);
                //if (DayScheduleList.Count > 0)
                //{
                result += ExportStr(Project, DayScheduleList);
                //}
            }
            byte[] data = Encoding.UTF8.GetBytes(result.ToString());
            return File(data, "application/ms-excel", "export.xls");
        }
        public ActionResult Schedule(Int32? id)
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;

            StringBuilder sb = new StringBuilder();
            ScheduleDao dao = new ScheduleDao();
            IList<Schedule> List = dao.FindByProjectId(id);
            foreach (Schedule m in List)
            {
                sb.Append("{");
                sb.Append("id: " + m.Id + ",");
                sb.Append("title: '" + m.Title + "',");
                sb.Append("start: new Date(" + m.StartDate.Value.Year + "," + (m.StartDate.Value.Month - 1) + "," + m.StartDate.Value.Day + "," + m.StartDate.Value.Hour + "," + m.StartDate.Value.Minute + "),");
                sb.Append("end: new Date(" + m.EndDate.Value.Year + "," + (m.EndDate.Value.Month - 1) + "," + m.EndDate.Value.Day + "," + m.EndDate.Value.Hour + "," + m.EndDate.Value.Minute + "),");
                sb.Append("url: '" + m.Url + "',");
                sb.Append("allDay: " + m.AllDay.ToString().ToLower());
                sb.Append("},");
            }
            ViewData["ShowDate"] = sb.ToString().Trim(',');
            return View();
        }
        public ActionResult AllSchedule(DateTime? Date, int? Page)
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;

            ScheduleDao dao = new ScheduleDao();
            DateTime TheDate = Date ?? DateTime.Now;
            //if (!CheckDate(TheDate))
            //    Response.Write("<script>alert('只能查询未来七天内数据!');history.go(-1);</script>");

            int PageNo = Page ?? 1;
            int PageSize = 1000;
            int PageCount = 0;

            IList<IDictionary> ProjectList = dao.GetScheduleList(PageNo, PageSize, out PageCount, TheDate, Int32.Parse(CurrentUserInfo.UserID));
            PagedList<IDictionary> List = new PagedList<IDictionary>(ProjectList, PageNo, PageSize, PageCount);
            //ViewData["Count"] = PageCount;
            ViewData["TheDate"] = string.Format("{0:D}", TheDate);
            //ViewData["PreBtn"] = "<a href=\"" + (CheckDate(TheDate.AddDays(-1)) ? Url.Action("AllSchedule", new { Date = string.Format("{0:yyyy-MM-dd}", TheDate.AddDays(-1)) }) : "#") + "\" style=\"margin-right: 20px;\">上一天</a>";
            //ViewData["NextBtn"] = "<a href=\"" + (CheckDate(TheDate.AddDays(1)) ? Url.Action("AllSchedule", new { Date = string.Format("{0:yyyy-MM-dd}", TheDate.AddDays(1)) }) : "#") + "\" style=\"margin-right: 20px;\">下一天</a>";
            ViewData["PreBtn"] = "<a href=\"" + Url.Action("AllSchedule", new { Date = string.Format("{0:yyyy-MM-dd}", TheDate.AddDays(-1)) }) + "\" style=\"margin-right: 20px;\">上一天</a>";
            ViewData["NextBtn"] = "<a href=\"" + Url.Action("AllSchedule", new { Date = string.Format("{0:yyyy-MM-dd}", TheDate.AddDays(1)) }) + "\" style=\"margin-right: 20px;\">下一天</a>";
            return View(List);
        }
 public ScheduledItem Update(ScheduledItem scheduledItem, bool isRunNow)
 {
     ScheduleDao.Save(scheduledItem, isRunNow);
     return(scheduledItem);
 }
 public void UpdateScheduleStatus(string scheduleId, ScheduleExecuteStatus status)
 {
     ScheduleDao.UpdateScheduleStatus(scheduleId, status);
 }
 /// <summary>
 /// Update the scheduled item.
 /// </summary>
 public ScheduledItem CreateRunOnceLocalServiceSchedule(string scheduleName, string serviceName, DateTime nextRuntime,
                                                        ByIndexOrNameDictionary <string> parameters)
 {
     return(ScheduleDao.CreateRunOnceLocalServiceSchedule(scheduleName, serviceName, nextRuntime, parameters));
 }
 /// <summary>
 /// Update the scheduled item.
 /// </summary>
 public ScheduledItem Update(ScheduledItem scheduledItem)
 {
     ScheduleDao.Save(scheduledItem);
     return(scheduledItem);
 }
 public ScheduledItemExecuteInfo GetTransactionLastExecuteInfo(string transactionId)
 {
     return(ScheduleDao.GetTransactionLastExecuteInfo(transactionId));
 }
 public ScheduledItemExecuteInfo GetScheduleLastExecuteInfo(string activityId)
 {
     return(ScheduleDao.GetScheduleLastExecuteInfo(activityId));
 }
 public ScheduledItem GetScheduledItem(string inScheduledItemId, out bool isRunNow)
 {
     return(ScheduleDao.GetScheduledItem(inScheduledItemId, out isRunNow));
 }