public static DataCreator GetInstance(string namesPath, string statesPath)
        {
            if (_instance == null)
            {
                _instance = new DataCreator(namesPath, statesPath);
            }

            return(_instance);
        }
示例#2
0
        //Gera a ObservableCollection com
        //os dados do arquivo ".txt".
        private void GenerateOrders()
        {
            DataCreator dc = new DataCreator(_namesPath, _statesPath);

            for (int i = 0; i < 100; i++)
            {
                _orders.Add(new OrderInfo(i + 1, dc.names[i], dc.ages[i], dc.states[i]));
            }
        }
示例#3
0
        /// <summary>
        /// Preenche as células da planilha no Excel
        /// </summary>
        /// <param name="worksheet">Representa uma Planilha no workbook</param>
        /// <param name="namesPath">Endereço do arquivo com os nomes</param>
        /// <param name="statesPath">Endereço do arquivo com os Estados</param>
        private static void CompleteWorkSheet(IWorksheet worksheet, string namesPath, string statesPath)
        {
            DataCreator dc = new DataCreator(namesPath, statesPath);

            worksheet.Range["A1"].Text = "ID";
            worksheet.Range["B1"].Text = "Nome";
            worksheet.Range["C1"].Text = "Idade";
            worksheet.Range["D1"].Text = "Estado";

            for (int i = 0; i < 100; i++)
            {
                worksheet.Range["A" + (i + 2).ToString()].Text = (i + 1).ToString();
                worksheet.Range["B" + (i + 2).ToString()].Text = dc.names[i];
                worksheet.Range["C" + (i + 2).ToString()].Text = dc.ages[i].ToString();
                worksheet.Range["D" + (i + 2).ToString()].Text = dc.states[i];
            }
        }