コード例 #1
0
ファイル: Project.cs プロジェクト: haikavn/x.stat
        public bool Execute()
        {
            Stop();

            for (int i = 0; i < projects.Items.Count; i++)
            {
                SyncManager.CurExecProject = (projects.Items[i] as Project);
                (projects.Items[i] as Project).Execute();
            }

            Resume();

            return true;
        }
コード例 #2
0
ファイル: Project.cs プロジェクト: Fitmedia/x.stat
        public bool LoadProjects(SyncManager manager, Project.LoadOptions lo)
        {
            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            if (!System.IO.Directory.Exists(path.Replace("file:\\", "") + "\\projects")) return false;

            string[] files = System.IO.Directory.GetFiles(path.Replace("file:\\", "") + "\\projects", "*.xml");

            if (lo == Project.LoadOptions.All)
                items.Clear();

            for (int i = 0; i < files.Length; i++)
            {
                Project prj = null;
                if (lo == Project.LoadOptions.All)
                {
                    prj = new Project();
                    prj.XmlFileName = files[i];
                    items.Add(prj);
                }
                else
                    for (int j = 0; j < items.Count; j++)
                        if (((Project)items[j]).XmlFileName == files[i])
                            prj = (Project)items[j];

                if (prj == null)
                {
                    prj = new Project();
                    prj.XmlFileName = files[i];
                    items.Add(prj);
                }

                if (!prj.LoadFromXML(files[i], lo))
                {
                    items.Clear();
                    return false;
                }

                prj.Manager = manager;
                prj.DbId = DBModule.AddProject(prj.Name, prj.Id, prj.StartFrom);

                foreach(object k in prj.Coefs.Keys)
                {
                    ProjectCoef pc = (ProjectCoef)prj.Coefs[k.ToString()];
                    if (pc != null)
                    {
                        APIServiceProvider sp = (APIServiceProvider)SyncManager.Providers.ServiceProviders[pc.ProviderName];
                        DBModule.AddCoef(prj.DbId, pc.CoefDate, pc.CoefValue, sp.ServiceProviderType);
                    }
                }
            }

            return true;
        }
コード例 #3
0
ファイル: Project.cs プロジェクト: haikavn/x.stat
        public bool LoadProjects(SyncManager manager)
        {
            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            if (!System.IO.Directory.Exists(path.Replace("file:\\", "") + "\\projects")) return false;

            string[] files = System.IO.Directory.GetFiles(path.Replace("file:\\", "") + "\\projects", "*.xml");

            items.Clear();

            for (int i = 0; i < files.Length; i++)
            {
                Project prj = new Project();
                if (!prj.LoadFromXML(files[i]))
                {
                    items.Clear();
                    return false;
                }

                prj.Manager = manager;
                prj.DbId = DBModule.AddProject(prj.Name, prj.Id, prj.StartFrom);

                items.Add(prj);
            }

            return true;
        }