Ejemplo n.º 1
0
        private bool LoadManagerDataObjects()
        {
            // check root path
            if (!Directory.Exists(this.tbInputDir.Text.Trim()))
            {
                MessageBox.Show("Main Folder " + this.tbInputDir.Text.Trim() + " does not exist. Please enter a valid folder name.");
                return(false);
            }

            // check output path
            if (!Directory.Exists(this.tbInputDir.Text.Trim() + @"\Output Files"))
            {
                MessageBox.Show(@"Output Folder " + this.tbInputDir.Text.Trim() + @"\Output Files" + " does not exist. Please make sure this folder exists.");
                return(false);
            }

            try
            {
                string rootPath            = this.tbInputDir.Text.Trim();
                string sAliasNamesFilePath = rootPath + @"\Alias Names.csv";

                // temp file objects
                tmp_aliasNamesFile = new AliasNamesFile(sAliasNamesFilePath);

                string sDBStatsFilePath = rootPath + @"\Output Files\DB Stats.csv";
                tmp_dbStatsFile = new StatsFile(sDBStatsFilePath);

                string sCITIStatsFilePath = rootPath + @"\Output Files\CITI Stats.csv";
                tmp_citiStatsFile = new StatsFile(sCITIStatsFilePath);

                string sJLSStatsFilePath = rootPath + @"\Output Files\JLS Stats.csv";
                tmp_jlsStatsFile = new StatsFile(sJLSStatsFilePath);

                string sStitchStatsFilePath = rootPath + @"\Output Files\Stitch Stats.csv";
                tmp_stitchStatsFile = new StitchStatsFile(sStitchStatsFilePath);

                // if manager file doesn't exist, create it
                // then open it
                string sManagerFilePath = rootPath + @"\Manager.csv";
                if (File.Exists(sManagerFilePath) == false)
                {
                    ManagerFile.CreateFile(rootPath);
                }
                tmp_managerFile = new ManagerFile(rootPath);

                string sStitchDatabaseFilePath = rootPath + @"\Stitch Database.csv";
                tmp_stitchDatabaseFile = new StitchDatabaseFile(sStitchDatabaseFilePath);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error loading manager data./n" + ex.Message);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static StatsRecord FindManagerInStats(string managerName, StatsFile statsFile)
        {
            StatsRecord statsRecord = null;

            List <StatsRecord> statsRecords = statsFile.StatsRecords();

            foreach (StatsRecord rec in statsRecords)
            {
                if (rec.ManagerName == managerName)
                {
                    statsRecord = rec;
                    break;
                }
            }

            return(statsRecord);
        }
Ejemplo n.º 3
0
        private void LoadInfoFromRootFolder()
        {
            // abandon changes if all is not well

            // Load Managers
            bool ableToLoad = true;

            if (!LoadManagerDataObjects())
            {
                ableToLoad = false;
            }
            if (!ableToLoad)
            {
                MessageBox.Show("Unable to initialize data from folder. Data displayed in UI does not reflect data in folder.");
                return;
            }


            // read existing portfolio building info
            if (!LoadPortfolioBuildingObject())
            {
                ableToLoad = false;
            }
            if (!ableToLoad)
            {
                MessageBox.Show("Unable to initialize data from folder. Data displayed in UI does not reflect data in folder.");
                return;
            }

            // save main
            Properties.Settings.Default.MainFolder = this.tbInputDir.Text.Trim();
            Properties.Settings.Default.Save();

            // managers
            // if all is well, assign temp file objects to globals
            // for display in UI
            m_aliasNamesFile        = tmp_aliasNamesFile;
            m_dbStatsFile           = tmp_dbStatsFile;
            m_citiStatsFile         = tmp_citiStatsFile;
            m_jlsStatsFile          = tmp_jlsStatsFile;
            m_stitchStatsFile       = tmp_stitchStatsFile;
            m_managerFile           = tmp_managerFile;
            m_stitchDatabaseFile    = tmp_stitchDatabaseFile;
            m_portfolioBuildingFile = tmp_portfolioBuildingFile;


            //CreateManagerObjects_FromAliasNamesAndStitch();
            //ShowManagerData();
            //ShowPortfolioBuilding();


            CreateManagerObjects_ManagerFile();

            ShowManagerData();
            ShowPortfolioBuilding();


            // benchmarks
            LoadBenchmarks();

            // manager
            string path = Properties.Settings.Default.MainFolder + @"\Output Files\Stitchdata Brads Format.csv";
        }