public ActionResult UpdateScheduleItem(ScheduleDto scheduleDto)
        {
            ActionResult ActionResult = new ActionResult();
            dynamic      Result       = new ExpandoObject();

            try
            {
                if (scheduleDto.RetryTimeLapse == 0)
                {
                    scheduleDto.RetryTimeLapse = Null.NullInteger;
                }

                if (!SchedulerManager.VerifyValidTimeLapseRetry(scheduleDto.TimeLapse, scheduleDto.TimeLapseMeasurement, scheduleDto.RetryTimeLapse, scheduleDto.RetryTimeLapseMeasurement))
                {
                    ActionResult.AddError("InvalidFrequencyAndRetry", Localization.GetString("InvalidFrequencyAndRetry", Components.Constants.TaskSchedulerResourcesFile));
                }
                else
                {
                    ScheduleItem existingItem = SchedulingProvider.Instance().GetSchedule(scheduleDto.ScheduleID);

                    ScheduleItem updatedItem = _controller.CreateScheduleItem(scheduleDto.TypeFullName, scheduleDto.FriendlyName, scheduleDto.TimeLapse, scheduleDto.TimeLapseMeasurement,
                                                                              scheduleDto.RetryTimeLapse, scheduleDto.RetryTimeLapseMeasurement, scheduleDto.RetainHistoryNum, scheduleDto.AttachToEvent, scheduleDto.CatchUpEnabled,
                                                                              scheduleDto.Enabled, scheduleDto.ObjectDependencies, scheduleDto.ScheduleStartDate, scheduleDto.Servers);
                    updatedItem.ScheduleID = scheduleDto.ScheduleID;


                    if (updatedItem.ScheduleStartDate != existingItem.ScheduleStartDate ||
                        updatedItem.Enabled ||
                        updatedItem.Enabled != existingItem.Enabled ||
                        updatedItem.TimeLapse != existingItem.TimeLapse ||
                        updatedItem.RetryTimeLapse != existingItem.RetryTimeLapse ||
                        updatedItem.RetryTimeLapseMeasurement != existingItem.RetryTimeLapseMeasurement ||
                        updatedItem.TimeLapseMeasurement != existingItem.TimeLapseMeasurement)
                    {
                        SchedulingProvider.Instance().UpdateSchedule(updatedItem);
                        ActionResult.Message = Localization.GetString("ScheduleItemUpdateSuccess", Components.Constants.TaskSchedulerResourcesFile);
                    }
                    else
                    {
                        ActionResult.Message = Localization.GetString("ScheduleItemUpdateSuccess", Components.Constants.TaskSchedulerResourcesFile);
                        SchedulingProvider.Instance().UpdateScheduleWithoutExecution(updatedItem);
                    }
                    Result.Status        = "Success";
                    Result.ScheduleItems = SchedulerManager.GetScheduleItems(0, 14);
                    ActionResult.Data    = Result;
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                Result.Status = exc.Message.ToString();
                ActionResult.AddError("ScheduleItemUpdateError", Localization.GetString("ScheduleItemUpdateError", Components.Constants.TaskSchedulerResourcesFile));
            }
            return(ActionResult);
        }
        internal static List <IUIData> GetData(int PortalID, UserInfo userinfo)
        {
            Dictionary <string, IUIData> Setting = new Dictionary <string, IUIData>
            {
                { "FriendlyName", new UIData {
                      Name = "FriendlyName", Value = ""
                  } },
                { "ObjectDependencies", new UIData {
                      Name = "ObjectDependencies", Value = ""
                  } },
                { "ScheduleStatus", new UIData {
                      Name = "ScheduleStatus", Options = SchedulerFactory.GetScheduleStatus()
                  } },
                { "GetScheduleItems", new UIData {
                      Name = "GetScheduleItems", Options = SchedulerManager.GetScheduleItems()
                  } },
                { "FrequencyPeriod", new UIData {
                      Name = "FrequencyPeriod", Options = SchedulerManager.TimePeriod(), OptionsText = "Text", OptionsValue = "Value", Value = "s"
                  } },
                { "RunTimeLapsePeriod", new UIData {
                      Name = "RunTimeLapsePeriod", Options = SchedulerManager.TimePeriod(), OptionsText = "Text", OptionsValue = "Value", Value = "s"
                  } },
                { "CatchUpTasks", new UIData {
                      Name = "CatchUpTasks", Options = SchedulerManager.CatchUpTask(), OptionsText = "Text", OptionsValue = "Value", Value = "false"
                  } },
                { "RunOnEvent", new UIData {
                      Name = "RunOnEvent", Options = SchedulerManager.RunOnEvent(), OptionsText = "Text", OptionsValue = "Value", Value = "0"
                  } },
                { "RetainScheduleHistory", new UIData {
                      Name = "RetainScheduleHistory", Options = SchedulerManager.RetainScheduleHistory(), OptionsText = "Text", OptionsValue = "Value", Value = "0"
                  } },
                { "EnabledScheduling", new UIData {
                      Name = "EnabledScheduling", Value = "false"
                  } },
                { "ScheduleStartDate", new UIData {
                      Name = "ScheduleStartDate", Value = ""
                  } },
                { "RetryTimeLapse", new UIData {
                      Name = "RetryTimeLapse", Value = ""
                  } },
                { "Server", new UIData {
                      Name = "Server", Value = ""
                  } },
                { "Frequency", new UIData {
                      Name = "Frequency", Value = ""
                  } },
                { "ClassNameAssembly", new UIData {
                      Name = "ClassNameAssembly", Value = ""
                  } }
            };

            return(Setting.Values.ToList());
        }
        public ActionResult GetSchedulerItembyPageing(dynamic Data)
        {
            ActionResult ActionResult = new ActionResult();
            dynamic      Result       = new ExpandoObject();

            try
            {
                Result.Status        = "Success";
                Result.ScheduleItems = SchedulerManager.GetScheduleItems(int.Parse(Data.Skip.Value.ToString()), int.Parse(Data.Take.Value.ToString()));
                ActionResult.Data    = Result;
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                Result.Status = exc.Message.ToString();
            }
            return(ActionResult);
        }
        public ActionResult DeleteSchedule(int ScheduleID)
        {
            ActionResult ActionResult = new ActionResult();
            dynamic      Result       = new ExpandoObject();

            try
            {
                ScheduleItem objScheduleItem = new ScheduleItem {
                    ScheduleID = ScheduleID
                };
                SchedulingProvider.Instance().DeleteSchedule(objScheduleItem);
                Result.Status        = "Success";
                Result.ScheduleItems = SchedulerManager.GetScheduleItems(0, 14);
                ActionResult.Data    = Result;
                ActionResult.Message = Localization.GetString("DeleteSuccess", Components.Constants.TaskSchedulerResourcesFile);
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                Result.Status = exc.Message.ToString();
                ActionResult.AddError("DeleteError", Localization.GetString("DeleteError", Components.Constants.TaskSchedulerResourcesFile));
            }
            return(ActionResult);
        }