Exemple #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("ServiceType");

            _serviceType = EServiceTypeUtils.GetEnumType(Body.GetQueryString("ServiceType"));

            if (Body.IsQueryExists("Delete"))
            {
                var taskId = Body.GetQueryInt("TaskID");
                try
                {
                    DataProvider.TaskDao.Delete(taskId);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            if (Body.IsQueryExists("Enabled"))
            {
                var taskId    = Body.GetQueryInt("TaskID");
                var isEnabled = Body.GetQueryBool("IsEnabled");
                var func      = isEnabled ? "启用" : "禁用";

                try
                {
                    DataProvider.TaskDao.UpdateState(taskId, isEnabled);
                    SuccessMessage($"{func}定时任务成功。");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, $"{func}定时任务失败。");
                }
            }

            if (!IsPostBack)
            {
                var taskName = EServiceTypeUtils.GetText(_serviceType);

                if (PublishmentSystemId > 0)
                {
                    BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationTask, taskName + "任务", AppManager.Cms.Permission.WebSite.Configration);
                }
                else
                {
                    BreadCrumbService(AppManager.Service.LeftMenu.Task, taskName + "任务", AppManager.Service.Permission.ServiceTask);
                }

                AddTask.Text = $"添加{taskName}任务";
                AddTask.Attributes.Add("onclick", ModalTaskAdd.GetOpenWindowStringToAdd(_serviceType, PublishmentSystemId));
                BindGrid();
            }
        }
Exemple #2
0
 private string GetEditHtml(int taskId, int publishmentSystemId)
 {
     if (PublishmentSystemId != 0 && publishmentSystemId != PublishmentSystemId)
     {
         return(string.Empty);
     }
     return
         ($"<a href=\"javascript:;\" onClick=\"{ModalTaskAdd.GetOpenWindowStringToEdit(taskId, _serviceType, PublishmentSystemId)}\">修改</a>");
 }