Beispiel #1
0
        public DataTable getDataTable(String selectString)
        {
            log.Info("GetDataTable selectString: " + selectString);

            SqlCommand command = new SqlCommand(selectString, cnn);

            SqlDataAdapter sda = new SqlDataAdapter();

            sda.SelectCommand = command;
            DataTable dataTable = new DataTable();

            sda.Fill(dataTable);

            if (MainApp.GetConsole())
            {
                BindingSource bsource = new BindingSource();
                bsource.DataSource = dataTable;

                MainApp.getMainForm().GetDataGridView().DataSource = bsource;
                sda.Update(dataTable);
            }

            log.Info("Found: " + dataTable.Rows.Count);

            return(dataTable);
        }
Beispiel #2
0
        public static void insertAllStats()
        {
            String message = "Inserting all stats from " + start + " to " + end;

            log.Info(message);

            if (MainApp.GetConsole())
            {
                MessageBox.Show(message);
            }

            InfluxdbClient.dropDB();
            InfluxdbClient.createDB();
            //System.Threading.Thread.Sleep(2000);

            insertInvoiceStats();
            log.Info("Finished invoices.");
            insertWorkOrderStats();
            log.Info("Finished wo.");
            insertProposalStats();
            log.Info("Finished props.");
            insertPurchaseOrders();
            log.Info("Finished po.");
            insertPayrollStats();
            log.Info("Finished pay.");
            insertARStats();
            log.Info("Finished ar.");
            insertItems();
            log.Info("Finished items.");
        }
Beispiel #3
0
        public String connectToDB(String server, String db, String user, String password)
        {
            string connectionString = null;

            connectionString = "Server=" + server + ";Database=" + db + ";User ID=" + user + ";Password="******"Connecting to the DB: " + connectionString);
            cnn = new SqlConnection(connectionString);
            try
            {
                cnn.Open();
                log.Info("Connection was successful!");
                return("Connection was successful! ");
            }
            catch (Exception ex)
            {
                log.Error("Can not open connection !", ex);
                if (MainApp.GetConsole())
                {
                    MessageBox.Show("Can not open connection ! " + ex);
                }
            }
            return(null);
        }