示例#1
0
        public void LoadPlan(Int64 PlanID)
        {
            cPlans ps = new cPlans();

            cPlan p = ps.GetSinglePlan(PlanID);

            this.txtPlanName.Text = p.PlanName;
            this.txtPlanID.Text   = p.PlanID.ToString();
            this.txtPlanDemo.Text = p.PlanRemark;

            this.txtPlanState.Text = cGlobalParas.ConvertName(p.PlanState);

            if (p.IsOverRun == true)
            {
                this.cboxIsRun.Checked = true;
            }
            else
            {
                this.cboxIsRun.Checked = false;
            }

            if (p.IsDisabled == true)
            {
                this.cboxIsDisabled.Checked = true;
            }
            else
            {
                this.cboxIsDisabled.Checked = false;
            }

            if (p.DisabledType == (int)cGlobalParas.PlanDisabledType.RunTime)
            {
                this.raNumber.Checked = true;
            }
            else if (p.DisabledType == (int)cGlobalParas.PlanDisabledType.RunDateTime)
            {
                this.raDateTime.Checked = true;
            }

            this.DisabledRunNum.Value   = p.DisabledTime;
            this.DisabledDateTime.Value = p.DisabledDateTime;

            ListViewItem litem;

            for (int i = 0; i < p.RunTasks.Count; i++)
            {
                litem      = new ListViewItem();
                litem.Text = cGlobalParas.ConvertName(p.RunTasks[i].RunTaskType);
                if (p.RunTasks[i].RunTaskType == (int)cGlobalParas.RunTaskType.DataTask)
                {
                    litem.SubItems.Add(cGlobalParas.ConvertName(int.Parse(p.RunTasks[i].RunTaskName)));
                }
                else
                {
                    litem.SubItems.Add(p.RunTasks[i].RunTaskName);
                }
                litem.SubItems.Add(p.RunTasks[i].RunTaskPara);

                this.listTask.Items.Add(litem);
            }

            this.EnabledDate.Value = DateTime.Parse(p.EnabledDateTime);

            switch (p.RunTaskPlanType)
            {
            case (int)cGlobalParas.RunTaskPlanType.Ones:
                this.raOneTime.Checked = true;
                this.RunOnceTime.Value = DateTime.Parse(p.RunOnesTime);
                break;

            case (int)cGlobalParas.RunTaskPlanType.DayOnes:
                this.raDay.Checked        = true;
                this.raRunones.Checked    = true;
                this.RunDayOnesTime.Value = DateTime.Parse(p.RunDayTime);
                break;

            case (int)cGlobalParas.RunTaskPlanType.DayTwice:
                this.raDay.Checked          = true;
                this.raRuntwice.Checked     = true;
                this.RunDayTwice1Time.Value = DateTime.Parse(p.RunAMTime);
                this.RunDayTwice2Time.Value = DateTime.Parse(p.RunPMTime);
                break;

            case (int)cGlobalParas.RunTaskPlanType.Weekly:
                this.raWeekly.Checked    = true;
                this.RunWeeklyTime.Value = DateTime.Parse(p.RunWeeklyTime);
                string rWeekly = p.RunWeekly;
                foreach (string sc in rWeekly.Split(','))
                {
                    string ss = sc.Trim();
                    switch (ss)
                    {
                    case "0":
                        this.cboxSunday.Checked = true;
                        break;

                    case "1":
                        this.cboxMonday.Checked = true;
                        break;

                    case "2":
                        this.cboxTuesday.Checked = true;
                        break;

                    case "3":
                        this.cboxWednesday.Checked = true;
                        break;

                    case "4":
                        this.cboxThursday.Checked = true;
                        break;

                    case "5":
                        this.cboxFriday.Checked = true;
                        break;

                    case "6":
                        this.cboxSunday.Checked = true;
                        break;

                    default:
                        break;
                    }
                }
                break;

            case (int)cGlobalParas.RunTaskPlanType.Custom:
                this.raCustom.Checked    = true;
                this.FirstRunTime.Value  = DateTime.Parse(p.FirstRunTime);
                this.udRunInterval.Value = decimal.Parse(p.RunInterval);
                break;
            }

            p  = null;
            ps = null;
        }