Пример #1
0
    /// <summary>
    /// 页面加载
    /// </summary>
    public override void RenderPage()
    {
        if (PlanID.IsNoNull())
        {
            objWork_Plan = objWorkRule.Work_Plan.First(s => s.PlanID == PlanID);

            ReadXml(objWork_Plan.PlanConfig);
            Page.DataBind();
        }
        else
        {
            panExecute.Enabled                 = false;
            panFrequency.Enabled               = true;
            panDay.Visible                     = false;
            panMonth.Visible                   = false;
            PanExecuteMonthWeek.Enabled        = false;
            panExecuteTimeTimeInterval.Enabled = false;
            txtDayInterval.CheckValueEmpty     = true;
            txtWeekInterval.CheckValueEmpty    = true;
            txtExecuteTime.CheckValueEmpty     = true;;
            txtStartDate.CheckValueEmpty       = true;;
            chkWeek.SelectedValue              = "0";
        }
    }
Пример #2
0
    /// <summary>
    /// 保存信息DateTime.Now.DayOfWeek

    /// </summary>
    public void SaveInfo()
    {
        if (PlanID.IsNull())
        {
            objWork_Plan.WorkInfoID = WorkInfoID;
            //是否启用
            objWork_Plan.IsEnable = false;

            //计划名称
            objWork_Plan.PlanName = txtPlanName.TextCutWord(50);
            //计划配置
            objWork_Plan.PlanConfig = GetConfigXML();

            if (radPlanType.SelectValueInt == 1)
            {
                objWork_Plan.StartDate = txtExecute.TextDateTime.AddDays(-1);
                objWork_Plan.EndDate   = txtExecute.TextDateTime;
            }
            else
            {
                objWork_Plan.StartDate = txtStartDate.TextDateTime.AddDays(-1);
                if (!string.IsNullOrEmpty(txtEndDate.Text))
                {
                    objWork_Plan.EndDate = DateTime.Parse(txtEndDate.Text + " " + (radExecuteTime.Checked ? txtExecuteTime.Text : txtIntervalEndTime.Text));
                }
                else
                {
                    objWork_Plan.EndDate = DateTime.Parse(DateTime.MaxValue.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            }

            objWork_Plan.LastRunDate = DateTime.Parse(DateTime.MaxValue.ToString("yyyy-MM-dd HH:mm:ss"));
            //计划说明
            objWork_Plan.PlanRemark = Remark;
            objWork_Plan.ConfigInfo = txtConfigInfo.Text;
            objWorkRule.InsertPlan(objWork_Plan);

            MessageDialog("新增成功", "PlanList.aspx?WorkInfoID=" + WorkInfoID);
        }
        else
        {
            objWork_Plan = objWorkRule.Work_Plan.First(p => p.PlanID == PlanID);

            //计划名称
            objWork_Plan.PlanName = txtPlanName.TextCutWord(50);

            if (radPlanType.SelectValueInt == 1)
            {
                objWork_Plan.StartDate = txtExecute.TextDateTime.AddDays(-1);
                objWork_Plan.EndDate   = txtExecute.TextDateTime;
            }
            else
            {
                objWork_Plan.StartDate = txtStartDate.TextDateTime.AddDays(-1);
                if (!string.IsNullOrEmpty(txtEndDate.Text))
                {
                    objWork_Plan.EndDate = DateTime.Parse(txtEndDate.Text + " " + (radExecuteTime.Checked ? txtExecuteTime.Text : txtIntervalEndTime.Text));
                }
                else
                {
                    objWork_Plan.EndDate = DateTime.Parse(DateTime.MaxValue.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            }

            objWork_Plan.LastRunDate = DateTime.Parse(DateTime.MaxValue.ToString("yyyy-MM-dd HH:mm:ss"));



            //计划配置
            objWork_Plan.PlanConfig = GetConfigXML();

            //计划说明
            objWork_Plan.PlanRemark = Remark;
            objWork_Plan.ConfigInfo = txtConfigInfo.Text;
            objWorkRule.UpdatePlan(objWork_Plan);
            MessageDialog("修改成功", "PlanList.aspx?WorkInfoID=" + WorkInfoID);
        }
    }