Ejemplo n.º 1
0
        //public int GetPlanCount()
        //{
        //    return 0;
        //}

        //插入一个计划,计划不能重名
        public void InsertPlan(cPlan NewPlan)
        {
            //判断计划文件是否存在,如果不存在则新建
            if (!IsExist())
            {
                NewIndexFile();
            }

            //判断计划是否重名,如果重名则需要进行名称修改
            cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");

            DataView d = xmlConfig.GetData("descendant::Plans");

            if (d != null)
            {
                for (int i = 0; i < d.Count; i++)
                {
                    if (NewPlan.PlanName == d[i].Row["PlanName"].ToString())
                    {
                        xmlConfig = null;
                        throw new cSoukeyException("已经存在此计划,请修改计划名称,计划名称不能重复!");
                    }
                }
            }

            string pXml = CreatePlanXml(NewPlan);


            xmlConfig.InsertElement("Plans", "Plan", pXml);
            xmlConfig.Save();
            xmlConfig = null;
        }
Ejemplo n.º 2
0
        //判断指定的计划是否过期,如果过期则修改计划状态
        public void IfEnabled(Int64 PlanID, bool OnlyState)
        {
            cPlan p = GetSinglePlan(PlanID);

            if (p.IsDisabled == false)
            {
                p = null;
                return;
            }

            if (p.DisabledType == (int)cGlobalParas.PlanDisabledType.RunTime)
            {
                //按运行次数失效
                if (p.DisabledTime < int.Parse(p.RunTimeCount) + 1)
                {
                    //表示失效
                    ModifyPlanState(PlanID, cGlobalParas.PlanState.Disabled);
                }
                else if (OnlyState == false)
                {
                    //表示没有失效,修改运行次数递增1
                    ModifyPlanRunTime(PlanID, int.Parse(p.RunTimeCount) + 1);
                }
            }
            else if (p.DisabledType == (int)cGlobalParas.PlanDisabledType.RunDateTime)
            {
                //按日期失效
                if (DateTime.Compare(DateTime.Now, p.DisabledDateTime) < 0)
                {
                    //修改此任务为失效
                    ModifyPlanState(PlanID, cGlobalParas.PlanState.Disabled);
                }
            }
        }
Ejemplo n.º 3
0
        public void EditPlan(cPlan ePlan)
        {
            //�жϼƻ��Ƿ������������������Ҫ���������޸�
            cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");

            //ɾ���ƻ��ڵ�
            xmlConfig.DeleteChildNodes("Plans", "ID", ePlan.PlanID.ToString ());

            string pXml = CreatePlanXml(ePlan);

            xmlConfig.InsertElement("Plans", "Plan", pXml);
            xmlConfig.Save();
            xmlConfig = null;
        }
Ejemplo n.º 4
0
        public void EditPlan(cPlan ePlan)
        {
            //判断计划是否重名,如果重名则需要进行名称修改
            cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");

            //删除计划节点
            xmlConfig.DeleteChildNodes("Plans", "ID", ePlan.PlanID.ToString());

            string pXml = CreatePlanXml(ePlan);

            xmlConfig.InsertElement("Plans", "Plan", pXml);
            xmlConfig.Save();
            xmlConfig = null;
        }
Ejemplo n.º 5
0
        //获取一个执行的计划
        public cPlan GetSinglePlan(Int64 PlanID)
        {
            //判断计划文件是否存在,如果不存在则新建
            if (!IsExist())
            {
                NewIndexFile();
            }

            //判断计划是否重名,如果重名则需要进行名称修改
            cXmlIO   xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");
            DataView d         = xmlConfig.GetData("Plans", "ID", PlanID.ToString());
            DataView t         = d[0].CreateChildView("Plan_Tasks")[0].CreateChildView("Tasks_Task");
            cPlan    p         = new cPlan();

            p.PlanID           = Int64.Parse(d[0].Row["ID"].ToString());
            p.PlanName         = d[0].Row["PlanName"].ToString();
            p.PlanRemark       = d[0].Row["PlanRemark"].ToString();
            p.PlanState        = int.Parse(d[0].Row["PlanState"].ToString());
            p.IsOverRun        = d[0].Row["IsOverRun"].ToString() == "True" ? true : false;
            p.IsDisabled       = d[0].Row["IsDisabled"].ToString() == "True" ? true : false;
            p.DisabledType     = int.Parse(d[0].Row["DisabledType"].ToString());
            p.DisabledTime     = int.Parse(d[0].Row["DisabledTime"].ToString());
            p.DisabledDateTime = DateTime.Parse(d[0].Row["DisabledDateTime"].ToString());
            p.RunTaskPlanType  = int.Parse(d[0].Row["RunTaskPlanType"].ToString());
            p.EnabledDateTime  = d[0].Row["EnabledDateTime"].ToString();
            p.RunOnesTime      = d[0].Row["RunOnesTime"].ToString();
            p.RunDayTime       = d[0].Row["RunDayTime"].ToString();
            p.RunAMTime        = d[0].Row["RunAMTime"].ToString();
            p.RunPMTime        = d[0].Row["RunPMTime"].ToString();
            p.RunWeeklyTime    = d[0].Row["RunWeeklyTime"].ToString();
            p.RunWeekly        = d[0].Row["RunWeekly"].ToString();
            p.RunTimeCount     = d[0].Row["RunTimeCount"].ToString();
            p.FirstRunTime     = d[0].Row["FirstRunTime"].ToString();
            p.RunInterval      = d[0].Row["RunInterval"].ToString();


            cTaskPlan tp;

            for (int i = 0; i < t.Count; i++)
            {
                tp             = new cTaskPlan();
                tp.RunTaskType = int.Parse(t[i].Row["RunTaskType"].ToString());
                tp.RunTaskName = t[i].Row["RunTaskName"].ToString();
                tp.RunTaskPara = t[i].Row["RunTaskPara"].ToString();
                p.RunTasks.Add(tp);
            }

            xmlConfig = null;
            return(p);
        }
Ejemplo n.º 6
0
        private string CreatePlanXml(cPlan NewPlan)
        {
            //构造xml文件
            string pXml = "";

            pXml = "<ID>" + NewPlan.PlanID + "</ID>" +
                   "<PlanName>" + NewPlan.PlanName + "</PlanName>" +
                   "<PlanState>" + NewPlan.PlanState + "</PlanState>" +
                   "<PlanRemark>" + NewPlan.PlanRemark + "</PlanRemark>" +
                   "<IsOverRun>" + NewPlan.IsOverRun + "</IsOverRun>" +
                   "<IsDisabled>" + NewPlan.IsDisabled + "</IsDisabled>" +
                   "<DisabledType>" + NewPlan.DisabledType + "</DisabledType>" +
                   "<DisabledTime>" + NewPlan.DisabledTime + "</DisabledTime>" +
                   "<DisabledDateTime>" + NewPlan.DisabledDateTime + "</DisabledDateTime>" +
                   "<RunTaskPlanType>" + NewPlan.RunTaskPlanType + "</RunTaskPlanType>" +
                   "<EnabledDateTime>" + NewPlan.EnabledDateTime + "</EnabledDateTime>" +
                   "<RunOnesTime>" + NewPlan.RunOnesTime + "</RunOnesTime>" +
                   "<RunDayTime>" + NewPlan.RunDayTime + "</RunDayTime>" +
                   "<RunAMTime>" + NewPlan.RunAMTime + "</RunAMTime>" +
                   "<RunPMTime>" + NewPlan.RunPMTime + "</RunPMTime>" +
                   "<RunWeeklyTime>" + NewPlan.RunWeeklyTime + "</RunWeeklyTime>" +
                   "<RunWeekly>" + NewPlan.RunWeekly + "</RunWeekly>" +
                   "<FirstRunTime>" + NewPlan.FirstRunTime + "</FirstRunTime>" +
                   "<RunInterval>" + NewPlan.RunInterval + "</RunInterval>" +

                   //任务运行次数,只要任务进行修改,表示就是一个新任务,则此值修改为零
                   "<RunTimeCount>0</RunTimeCount>" +
                   "<Tasks>";

            for (int i = 0; i < NewPlan.RunTasks.Count; i++)
            {
                pXml += "<Task>";
                pXml += "<RunTaskType>" + NewPlan.RunTasks[i].RunTaskType + "</RunTaskType>";
                pXml += "<RunTaskName>" + NewPlan.RunTasks[i].RunTaskName + "</RunTaskName>";
                pXml += "<RunTaskPara>" + NewPlan.RunTasks[i].RunTaskPara + "</RunTaskPara>";
                pXml += "</Task>";
            }

            pXml += "</Tasks>";

            return(pXml);
        }
Ejemplo n.º 7
0
        //加载计划
        //只加载计划的摘要信息,即只会从文件中加载需要列表显示的
        //计划内容,不会完整的加载计划信息
        public void LoadPlans()
        {
            cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");

            DataView d = xmlConfig.GetData("descendant::Plans");

            if (d == null)
            {
                return;
            }

            cPlan p;

            for (int i = 0; i < d.Count; i++)
            {
                p                  = new cPlan();
                p.PlanID           = Int64.Parse(d[i].Row["ID"].ToString());
                p.PlanName         = d[i].Row["PlanName"].ToString();
                p.PlanState        = int.Parse(d[i].Row["PlanState"].ToString());
                p.IsOverRun        = d[i].Row["IsOverRun"].ToString() == "True" ? true : false;
                p.IsDisabled       = d[i].Row["IsDisabled"].ToString() == "True" ? true : false;
                p.DisabledType     = int.Parse(d[i].Row["DisabledType"].ToString());
                p.DisabledTime     = int.Parse(d[i].Row["DisabledTime"].ToString());
                p.DisabledDateTime = DateTime.Parse(d[i].Row["DisabledDateTime"].ToString());
                p.RunTaskPlanType  = int.Parse(d[i].Row["RunTaskPlanType"].ToString());
                p.EnabledDateTime  = d[i].Row["EnabledDateTime"].ToString();
                p.RunOnesTime      = d[i].Row["RunOnesTime"].ToString();
                p.RunDayTime       = d[i].Row["RunDayTime"].ToString();
                p.RunAMTime        = d[i].Row["RunAMTime"].ToString();
                p.RunPMTime        = d[i].Row["RunPMTime"].ToString();
                p.RunWeeklyTime    = d[i].Row["RunWeeklyTime"].ToString();
                p.RunWeekly        = d[i].Row["RunWeekly"].ToString();
                p.RunTimeCount     = d[i].Row["RunTimeCount"].ToString();
                p.FirstRunTime     = d[i].Row["FirstRunTime"].ToString();
                p.RunInterval      = d[i].Row["RunInterval"].ToString();

                m_Plans.Add(p);
            }

            p = null;
        }
Ejemplo n.º 8
0
        //��ȡһ��ִ�еļƻ�
        public cPlan GetSinglePlan(Int64 PlanID)
        {
            //�жϼƻ��ļ��Ƿ���ڣ�������������½�
            if (!IsExist())
                NewIndexFile();

            //�жϼƻ��Ƿ������������������Ҫ���������޸�
            cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");
            DataView d= xmlConfig.GetData("Plans", "ID", PlanID.ToString ());
            DataView t = d[0].CreateChildView("Plan_Tasks")[0].CreateChildView("Tasks_Task");
            cPlan p = new cPlan();

            p.PlanID = Int64.Parse(d[0].Row["ID"].ToString());
            p.PlanName = d[0].Row["PlanName"].ToString();
            p.PlanRemark = d[0].Row["PlanRemark"].ToString();
            p.PlanState = int.Parse(d[0].Row["PlanState"].ToString());
            p.IsOverRun = d[0].Row["IsOverRun"].ToString() == "True" ? true : false;
            p.IsDisabled = d[0].Row["IsDisabled"].ToString() == "True" ? true : false;
            p.DisabledType = int.Parse(d[0].Row["DisabledType"].ToString());
            p.DisabledTime = int.Parse(d[0].Row["DisabledTime"].ToString());
            p.DisabledDateTime = DateTime.Parse(d[0].Row["DisabledDateTime"].ToString());
            p.RunTaskPlanType = int.Parse(d[0].Row["RunTaskPlanType"].ToString());
            p.EnabledDateTime = d[0].Row["EnabledDateTime"].ToString();
            p.RunOnesTime =d[0].Row["RunOnesTime"].ToString();
            p.RunDayTime = d[0].Row["RunDayTime"].ToString();
            p.RunAMTime = d[0].Row["RunAMTime"].ToString();
            p.RunPMTime = d[0].Row["RunPMTime"].ToString();
            p.RunWeeklyTime = d[0].Row["RunWeeklyTime"].ToString();
            p.RunWeekly = d[0].Row["RunWeekly"].ToString();
            p.RunTimeCount = d[0].Row["RunTimeCount"].ToString();
            p.FirstRunTime = d[0].Row["FirstRunTime"].ToString();
            p.RunInterval = d[0].Row["RunInterval"].ToString();

            cTaskPlan tp;
            for (int i = 0; i < t.Count; i++)
            {
                tp = new cTaskPlan();
                tp.RunTaskType =int.Parse ( t[i].Row["RunTaskType"].ToString());
                tp.RunTaskName = t[i].Row["RunTaskName"].ToString();
                tp.RunTaskPara = t[i].Row["RunTaskPara"].ToString();
                p.RunTasks.Add(tp);
            }

            xmlConfig = null;
            return p;
        }
Ejemplo n.º 9
0
        private string CreatePlanXml(cPlan NewPlan)
        {
            //����xml�ļ�
            string pXml = "";

            pXml = "<ID>" + NewPlan.PlanID + "</ID>" +
                "<PlanName>" + NewPlan.PlanName + "</PlanName>" +
                "<PlanState>" + NewPlan.PlanState + "</PlanState>" +
                "<PlanRemark>" + NewPlan.PlanRemark + "</PlanRemark>" +
                "<IsOverRun>" + NewPlan.IsOverRun + "</IsOverRun>" +
                "<IsDisabled>" + NewPlan.IsDisabled + "</IsDisabled>" +
                "<DisabledType>" + NewPlan.DisabledType + "</DisabledType>" +
                "<DisabledTime>" + NewPlan.DisabledTime + "</DisabledTime>" +
                "<DisabledDateTime>" + NewPlan.DisabledDateTime + "</DisabledDateTime>" +
                "<RunTaskPlanType>" + NewPlan.RunTaskPlanType + "</RunTaskPlanType>" +
                "<EnabledDateTime>" + NewPlan.EnabledDateTime + "</EnabledDateTime>" +
                "<RunOnesTime>" + NewPlan.RunOnesTime + "</RunOnesTime>" +
                "<RunDayTime>" + NewPlan.RunDayTime + "</RunDayTime>" +
                "<RunAMTime>" + NewPlan.RunAMTime + "</RunAMTime>" +
                "<RunPMTime>" + NewPlan.RunPMTime + "</RunPMTime>" +
                "<RunWeeklyTime>" + NewPlan.RunWeeklyTime + "</RunWeeklyTime>" +
                "<RunWeekly>" + NewPlan.RunWeekly + "</RunWeekly>" +
                "<FirstRunTime>" + NewPlan.FirstRunTime + "</FirstRunTime>" +
                "<RunInterval>" + NewPlan .RunInterval + "</RunInterval>" +

                //�������д�����ֻҪ��������޸ģ���ʾ����һ�����������ֵ�޸�Ϊ��
                "<RunTimeCount>0</RunTimeCount>" +
                "<Tasks>";

            for (int i = 0; i < NewPlan.RunTasks.Count; i++)
            {
                pXml += "<Task>";
                pXml += "<RunTaskType>" + NewPlan.RunTasks[i].RunTaskType + "</RunTaskType>";
                pXml += "<RunTaskName>" + NewPlan.RunTasks[i].RunTaskName + "</RunTaskName>";
                pXml += "<RunTaskPara>" + NewPlan.RunTasks[i].RunTaskPara + "</RunTaskPara>";
                pXml += "</Task>";
            }

            pXml += "</Tasks>";

            return pXml;
        }
Ejemplo n.º 10
0
        //���ؼƻ�
        //ֻ���ؼƻ���ժҪ��Ϣ����ֻ����ļ��м�����Ҫ�б���ʾ��
        //�ƻ����ݣ����������ļ��ؼƻ���Ϣ
        public void LoadPlans()
        {
            cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");

            DataView d = xmlConfig.GetData("descendant::Plans");

            if (d == null)
            {
                return;
            }

            cPlan p;

            for (int i = 0; i < d.Count; i++)
            {
                p = new cPlan();
                p.PlanID =Int64.Parse ( d[i].Row["ID"].ToString());
                p.PlanName = d[i].Row["PlanName"].ToString();
                p.PlanState =int.Parse (d[i].Row["PlanState"].ToString());
                p.IsOverRun = d[i].Row["IsOverRun"].ToString() == "True" ? true : false;
                p.IsDisabled = d[i].Row["IsDisabled"].ToString() == "True" ? true : false;
                p.DisabledType =int.Parse ( d[i].Row["DisabledType"].ToString());
                p.DisabledTime = int.Parse ( d[i].Row["DisabledTime"].ToString());
                p.DisabledDateTime = DateTime.Parse ( d[i].Row["DisabledDateTime"].ToString());
                p.RunTaskPlanType = int.Parse ( d[i].Row["RunTaskPlanType"].ToString());
                p.EnabledDateTime = d[i].Row["EnabledDateTime"].ToString();
                p.RunOnesTime = d[i].Row["RunOnesTime"].ToString();
                p.RunDayTime =d[i].Row["RunDayTime"].ToString();
                p.RunAMTime = d[i].Row["RunAMTime"].ToString();
                p.RunPMTime =d[i].Row["RunPMTime"].ToString();
                p.RunWeeklyTime = d[i].Row["RunWeeklyTime"].ToString();
                p.RunWeekly = d[i].Row["RunWeekly"].ToString();
                p.RunTimeCount = d[i].Row["RunTimeCount"].ToString();
                p.FirstRunTime = d[i].Row["FirstRunTime"].ToString();
                p.RunInterval = d[i].Row["RunInterval"].ToString();

                m_Plans.Add(p);

            }

            p = null;
        }
Ejemplo n.º 11
0
        //public int GetPlanCount()
        //{
        //    return 0;
        //}
        //����һ���ƻ�,�ƻ���������
        public void InsertPlan(cPlan NewPlan)
        {
            //�жϼƻ��ļ��Ƿ���ڣ�������������½�
            if (!IsExist())
                NewIndexFile();

            //�жϼƻ��Ƿ������������������Ҫ���������޸�
            cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");

            DataView d = xmlConfig.GetData("descendant::Plans");

            if (d != null)
            {
                for (int i = 0; i < d.Count; i++)
                {
                    if (NewPlan.PlanName == d[i].Row["PlanName"].ToString())
                    {
                        xmlConfig = null;
                        throw new cSoukeyException("�Ѿ����ڴ˼ƻ������޸ļƻ����ƣ��ƻ����Ʋ����ظ���");
                    }
                }
            }

            string pXml = CreatePlanXml(NewPlan);

            xmlConfig.InsertElement("Plans", "Plan", pXml);
            xmlConfig.Save();
            xmlConfig = null;
        }
Ejemplo n.º 12
0
        private Int64 SaveTaskPlan()
        {
            cPlan NewPlan = new cPlan();

            Int64 Nid = GetNewID();

            if (Nid == 0)
            {
                throw new cSoukeyException(rm.GetString ("Error21"));
            }

            NewPlan.PlanID = Nid;
            NewPlan.PlanName = this.txtPlanName.Text;
            NewPlan.PlanRemark = this.txtPlanDemo.Text;

            //ϵͳ�Զ��жϵ�ǰ�����״̬
            if (this.cboxIsDisabled.Checked == true)
            {
                if (this.raNumber.Checked == true)
                {
                    if (this.DisabledRunNum.Value == 1 && DateTime.Compare(DateTime.Now,this.RunOnceTime.Value) > 0)
                        NewPlan.PlanState =(int) cGlobalParas.PlanState.Disabled;
                    else
                        NewPlan.PlanState = (int)cGlobalParas.PlanState.Enabled;

                }
                else if (this.raDateTime.Checked == true)
                {
                    if (DateTime.Compare(DateTime.Now, this.DisabledDateTime.Value) < 0)
                        NewPlan.PlanState = (int)cGlobalParas.PlanState.Disabled;
                    else
                        NewPlan.PlanState = (int)cGlobalParas.PlanState.Enabled;
                }
            }
            else
            {
                NewPlan.PlanState = (int)cGlobalParas.PlanState.Enabled;
            }

            if (this.cboxIsRun.Checked == true)
                NewPlan.IsOverRun = true;
            else
                NewPlan.IsOverRun = false;

            if (this.cboxIsDisabled.Checked ==true )
                NewPlan.IsDisabled =true ;
            else
                NewPlan .IsDisabled =false ;

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

            NewPlan.DisabledTime =int.Parse (this.DisabledRunNum .Value.ToString () );
            NewPlan.DisabledDateTime = this.DisabledDateTime.Value;

            cTaskPlan tp;
            for (int i = 0; i < this.listTask.Items.Count; i++)
            {
                tp = new cTaskPlan();
                tp.RunTaskType = cGlobalParas.ConvertID(this.listTask.Items[i].Text);

                if (cGlobalParas.ConvertID(this.listTask.Items[i].Text)==(int)cGlobalParas.RunTaskType.DataTask )
                    tp.RunTaskName = cGlobalParas.ConvertID ( this.listTask.Items[i].SubItems[1].Text.ToString()).ToString ();
                else
                    tp.RunTaskName =this.listTask.Items[i].SubItems[1].Text.ToString();

                tp.RunTaskPara = this.listTask.Items[i].SubItems[2].Text.ToString();

                NewPlan.RunTasks.Add(tp);
            }

            if (this.raOneTime.Checked == true)
                NewPlan.RunTaskPlanType = (int) cGlobalParas.RunTaskPlanType.Ones;
            else if (this.raDay.Checked == true)
            {
                if (this.raRunones.Checked == true)
                    NewPlan.RunTaskPlanType = (int)cGlobalParas.RunTaskPlanType.DayOnes;
                else if (this.raRuntwice.Checked == true)
                    NewPlan.RunTaskPlanType = (int)cGlobalParas.RunTaskPlanType.DayTwice;
            }
            else if (this.raWeekly.Checked == true)
            {
                NewPlan.RunTaskPlanType = (int)cGlobalParas.RunTaskPlanType.Weekly;
            }
            else if (this.raCustom.Checked == true)
            {
                NewPlan.RunTaskPlanType = (int)cGlobalParas.RunTaskPlanType.Custom;
            }

            NewPlan.EnabledDateTime = this.EnabledDate.Value.ToLongDateString ();
            NewPlan.RunOnesTime = this.RunOnceTime.Value.ToString () ;
            NewPlan.RunDayTime = this.RunDayOnesTime.Value.ToLongTimeString();
            NewPlan.RunAMTime = this.RunDayTwice1Time.Value.ToLongTimeString();
            NewPlan.RunPMTime = this.RunDayTwice2Time.Value.ToLongTimeString();
            NewPlan.RunWeeklyTime = this.RunWeeklyTime.Value.ToLongTimeString();
            NewPlan.FirstRunTime = this.FirstRunTime.Value.ToLongTimeString();
            NewPlan.RunInterval = this.udRunInterval.Value.ToString();

            string runWeekly = "";

            if (this.cboxSunday.Checked ==true )
                runWeekly ="0";
            if (this.cboxMonday.Checked == true)
                runWeekly += ",1";
            if (this.cboxTuesday.Checked == true)
                runWeekly += ",2";
            if (this.cboxWednesday.Checked == true)
                runWeekly += ",3";
            if (this.cboxThursday.Checked == true)
                runWeekly += ",4";
            if (this.cboxFriday.Checked == true)
                runWeekly += ",5";
            if (this.cboxSturday.Checked == true)
                runWeekly += ",6";

            NewPlan.RunWeekly = runWeekly;

            cPlans p = new cPlans();

            if (this.FormState == cGlobalParas.FormState.New )
            {
                p.InsertPlan(NewPlan);
            }
            else if (this.FormState == cGlobalParas.FormState.Edit)
            {
                p.EditPlan(NewPlan);
            }

            p = null;

            return Nid;
        }
Ejemplo n.º 13
0
        //���ؼƻ�,���ؼƻ���ʱ����Ҫ�Լƻ���״̬����ά��
        private void IniCheckPlan()
        {
            try
            {
                cXmlIO xmlConfig = new cXmlIO(Program.getPrjPath() + "tasks\\plan\\plan.xml");

                DataView d = xmlConfig.GetData("descendant::Plans");

                if (d == null)
                {
                    return;
                }

                cPlan p;

                for (int i = 0; i < d.Count; i++)
                {
                    p = new cPlan();

                    if (int.Parse(d[i].Row["PlanState"].ToString()) == (int)cGlobalParas.PlanState.Enabled)
                    {
                        p.PlanID = Int64.Parse(d[i].Row["ID"].ToString());
                        p.PlanName = d[i].Row["PlanName"].ToString();
                        p.PlanState = int.Parse(d[i].Row["PlanState"].ToString());
                        p.IsOverRun = d[i].Row["IsOverRun"].ToString() == "True" ? true : false;
                        p.IsDisabled = d[i].Row["IsDisabled"].ToString() == "True" ? true : false;
                        p.DisabledType = int.Parse(d[i].Row["DisabledType"].ToString());
                        p.DisabledTime = int.Parse(d[i].Row["DisabledTime"].ToString());
                        p.DisabledDateTime = DateTime.Parse(d[i].Row["DisabledDateTime"].ToString());
                        p.RunTaskPlanType = int.Parse(d[i].Row["RunTaskPlanType"].ToString());
                        p.EnabledDateTime = d[i].Row["EnabledDateTime"].ToString();
                        p.RunOnesTime = d[i].Row["RunOnesTime"].ToString();
                        p.RunDayTime = d[i].Row["RunDayTime"].ToString();
                        p.RunAMTime = d[i].Row["RunAMTime"].ToString();
                        p.RunPMTime = d[i].Row["RunPMTime"].ToString();
                        p.RunWeeklyTime = d[i].Row["RunWeeklyTime"].ToString();
                        p.RunWeekly = d[i].Row["RunWeekly"].ToString();
                        p.RunTimeCount = d[i].Row["RunTimeCount"].ToString();
                        p.FirstRunTime = d[i].Row["FirstRunTime"].ToString();
                        p.RunInterval = d[i].Row["RunInterval"].ToString();

                        cTaskPlan tp;
                        DataView t = d[i].CreateChildView("Plan_Tasks")[0].CreateChildView("Tasks_Task");

                        for (int j = 0; j < t.Count; j++)
                        {
                            tp = new cTaskPlan();
                            tp.RunTaskType = int.Parse(t[j].Row["RunTaskType"].ToString());
                            tp.RunTaskName = t[j].Row["RunTaskName"].ToString();
                            tp.RunTaskPara = t[j].Row["RunTaskPara"].ToString();
                            p.RunTasks.Add(tp);
                        }

                        m_runTasks.Add(p);
                    }
                }

                p = null;

                xmlConfig = null;

                //�Զ�ά���ƻ�״̬
                AutoState();
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }