Example #1
0
        private string getworkbook(Customer cust)
        {
            cust.Path += "\\PERMANENT";

            string[] permanentFiles = Directory.GetFiles(cust.Path, "CPT*.xls*");

            if (permanentFiles.Length != 1)
            {
                return null;
            }

            string WBPATH = permanentFiles[0];

            return WBPATH;
        }
Example #2
0
        private void populateClients(ExcelH excel, string path)
        {
            //creates new excel applciation
            app = new Excel.Application();

            string ifcClientDirectory = path;

            string[] temp = Directory.GetDirectories(ifcClientDirectory);

            foreach (string str in temp)
            {
                Customer tempCust = new Customer();
                tempCust.percentage = new string[26];
                tempCust.category = new string[26];
                tempCust.Path = path;
                tempCust.filename = Path.GetFileName(str);

                string[] chunks = tempCust.filename.Split(new char[] { '-' });

                if (chunks.Length < 2)
                {
                    tempCust.CustomerID = "null";
                    tempCust.CustomerName = "null";
                    continue;
                }
                else
                {
                    string tempID = chunks[1].Trim();
                    string tempname = chunks[0].Trim();
                    tempCust.CustomerID = tempID;
                    tempCust.CustomerName = tempname;
                }

                tempCust.Path += "\\" + tempCust.filename;

                excel.OpenSourceWorkbook(this.getworkbook(tempCust));

                transfer(excel, tempCust, tempCust.Path);
                excel.addClient(tempCust);

            }

            closesourcebk();
            app.Quit();
        }
Example #3
0
 private void addClient(Customer cust)
 {
     Clients.Add(cust);
 }
Example #4
0
        private void transfer(ExcelH excel, Customer tempcust, string p)
        {
            int i = 0;
            Excel.Worksheet ws = excel.getSourceWorkSheet("OBJECTIVES & ASSET ALLOCATION");
            while (i < 26)
            {
                if (ws.Cells[13 + i, 4].Value2 != null)
                {

                    tempcust.percentage[i] = ws.Cells[13 + i, 4].Value2.ToString();
                }
                else
                {
                    tempcust.percentage[i] = "0";

                }

                tempcust.category[i] = ws.Cells[13 + i, 3].Value2.ToString();

                i++;

            }
            excel.closesourcebk();
        }