public ActionResult ScheduleTask(VcssTaskInfoEnum vcssTaskInfoId)
 {
     try
     {
         VcssTaskManager   taskManager = VcssTaskManager.GetTaskSchedulerInstance(vcssTaskInfoId);
         VcssTaskInfoModel taskInfo    = VcssTaskManagerService.GetVcssTask(vcssTaskInfoId);
         bool scheduled = taskManager.CreateTask(taskInfo);
         return(Json(new VcssScheduleTaskResult()
         {
             Success = scheduled, Next = taskInfo.step, TaskInfoId = vcssTaskInfoId
         }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         VcssTaskManagerService.Log(vcssTaskInfoId.ToString(), "ServerTime", DateTime.Now, "Scheduling", ex.Message, DateTime.Now);
         return(Json(new VcssScheduleTaskResult()
         {
             Success = false, Next = 5, TaskInfoId = vcssTaskInfoId
         }, JsonRequestBehavior.AllowGet));
     }
 }
        public ActionResult ScheduleHistoryTask(int stockid, DateTime startdate, DateTime enddate)
        {
            VcssTaskInfoEnum vcssTaskInfoId = VcssTaskInfoEnum.HistoryNASDAQ;

            try
            {
                VcssTaskManager   taskManager = VcssTaskManager.GetTaskSchedulerInstance(vcssTaskInfoId);
                VcssTaskInfoModel taskInfo    = VcssTaskManagerService.GetVcssTask(vcssTaskInfoId);
                bool scheduled = taskManager.CreateTask(taskInfo, stockid.ToString(), startdate.ToString("yyyy-MM-dd"), enddate.ToString("yyyy-MM-dd"));
                return(Json(new VcssScheduleTaskResult()
                {
                    Success = scheduled, TaskInfoId = vcssTaskInfoId
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                VcssTaskManagerService.Log(vcssTaskInfoId.ToString(), "ServerTime", DateTime.Now, "Scheduling", ex.Message, DateTime.Now);
                return(Json(new VcssScheduleTaskResult()
                {
                    Success = false, TaskInfoId = vcssTaskInfoId, Message = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult ScheduleDailyTechnicalReportTask(string batch)
        {
            VcssTaskInfoEnum vcssTaskInfoId = VcssTaskInfoEnum.DailyTechnicalReportARG;

            try
            {
                VcssTaskManager   taskManager = VcssTaskManager.GetTaskSchedulerInstance(vcssTaskInfoId);
                VcssTaskInfoModel taskInfo    = VcssTaskManagerService.GetVcssTask(vcssTaskInfoId);
                bool scheduled = taskManager.CreateTask(taskInfo, batch);
                return(Json(new VcssScheduleTaskResult()
                {
                    Success = scheduled, TaskInfoId = vcssTaskInfoId
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                VcssTaskManagerService.Log(vcssTaskInfoId.ToString(), "ServerTime", DateTime.Now, "Scheduling", ex.Message, DateTime.Now);
                return(Json(new VcssScheduleTaskResult()
                {
                    Success = false, TaskInfoId = vcssTaskInfoId, Message = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }