Beispiel #1
0
        public DataTable getNewDevelopers(Wizard wizard)
        {
            //Throws Exception
              DataTable newDevelopersTable;

              DataTable developersTable = getDevelopers();

              //IValidator validator = Validator.GetInstance();
              wizard.validateFile();
              DataView dataView = new DataView(wizard.validator.ExcelTable);
              newDevelopersTable = dataView.ToTable(true, "siccode");
              newDevelopersTable.Columns[0].ReadOnly = true;
              newDevelopersTable.Columns.Add("Name", typeof(String));// System.Type.GetType("System.String"));
              newDevelopersTable.Columns.Add("DefaultPercent", typeof(double));
              DataColumn doImport = new DataColumn(IMPORT);
              doImport.DataType = typeof(Boolean);
              newDevelopersTable.Columns.Add(doImport);
              DataRow row;
              int i = 0;
              String value;
              while (i < newDevelopersTable.Rows.Count) {
            try {
              row = newDevelopersTable.Rows[i];
              row[IMPORT] = true;
              value = getValue(row, "siccode").Trim();
              if (Helper.isBlank(value) || findInTable(developersTable, "code", value))
            newDevelopersTable.Rows[i].Delete();
              else
            i++;
            }
            catch (Exception ex) {

              throw ex;
            }
              }

              return newDevelopersTable;
        }
Beispiel #2
0
        public DataTable getNewIsoReports(Wizard wizard)
        {
            //Throws Exception
              DataTable newIsoTable;

              DataTable isoReportTable = getAccounts();

              //IValidator validator = new Validator(null);
              wizard.validateFile();
              DataView dataView = new DataView(wizard.validator.ExcelTable);
              newIsoTable = dataView.ToTable(true, new String[] { "accountno", "siccode", "dba" });
              //newAccountsTable.Columns[0].ReadOnly = true;
              DataColumn doImport = new DataColumn(IMPORT);
              doImport.DataType = typeof(Boolean);
              newIsoTable.Columns.Add(doImport);

              //Remove the rows where Code/Developer is not found
              DataRow row;
              int i = 0;
              Dictionary<String, object> dic = new Dictionary<String, object>();
              SqlConnection sqlConnection = DB.getSqlConnection();
              while (i < newIsoTable.Rows.Count) {
            row = newIsoTable.Rows[i];
            row[IMPORT] = true;
            dic.Clear();
            ///dic.Add("YearMonth", wizard.YearMonth);
            dic.Add("YearMonth", wizard.YearMonth);
            dic.Add("accountno", row["accountno"]);
            //Todo: Warn the user about rows that are removed because account is not found
            //Todo: Also remove the rows that have been imported
            if (findAccountInIsoReport(sqlConnection, dic))//If the account is not found, delete it
              newIsoTable.Rows[i].Delete();
            else
              i++;
              }
              DB.closeConnection(sqlConnection);

              return newIsoTable;
        }
Beispiel #3
0
        public DataTable getNewAccounts(Wizard wizard)
        {
            //Throws Exception
              DataTable newAccountsTable;

              DataTable accountsTable = getAccounts();

              //IValidator validator = new Validator(null);
              wizard.validateFile();
              DataView dataView = new DataView(wizard.validator.ExcelTable);
              newAccountsTable = dataView.ToTable(true, new String[]{"accountno", "siccode", "dba", Helper.QDR, Helper.MQDR, Helper.NQDR});
              //newAccountsTable.Columns[0].ReadOnly = true;
              DataColumn doImport = new DataColumn(IMPORT);
              doImport.DataType = typeof(Boolean);
              newAccountsTable.Columns.Add(doImport);
              DataRow row;
              int i = 0;
              while (i < newAccountsTable.Rows.Count) {
            row = newAccountsTable.Rows[i];
            row[IMPORT] = true;
            if (findInTable(accountsTable, "code", (String)row["accountno"]))
              newAccountsTable.Rows[i].Delete();
            else
              i++;
              }

              return newAccountsTable;
        }