예제 #1
0
        public static Boolean OneDocument()
        {
            Stream         myStream        = null;
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((myStream = openFileDialog1.OpenFile()) != null)
                    {
                        using (myStream)
                        {
                            Storage sensor_info = new Storage();

                            String[]          file  = File.ReadAllLines(openFileDialog1.FileName);
                            SensorAskingPopup popup = new SensorAskingPopup(sensor_info);
                            popup.ShowDialog();
                            InsertInDataBase.rapport(DataBaseConnect.getInstance(), file, sensor_info);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        public static MySqlDataAdapter ByDate(DateTime startDate, DateTime endDate, String id_sensor)
        {
            String strStartDate = MapToDataBase.MapDate(startDate);
            String strEndDate   = MapToDataBase.MapDate(endDate);

            String sql_query =
                "SELECT * FROM dataline WHERE dataline.dateTime >= '" + strStartDate +
                "' AND dataline.dateTime <= '" + strEndDate + "'" +
                " AND dataline.idSensor = '" + id_sensor + "'";

            MySqlCommand dataFromBase = SelectInDataBase.WithParameter(sql_query, DataBaseConnect.getInstance());

            return(DataBaseToWinForm.Transform(dataFromBase));
        }
예제 #3
0
        public static MySqlDataAdapter all()
        {
            MySqlCommand dataFromBase = SelectAll.Data(DataBaseConnect.getInstance());

            return(DataBaseToWinForm.Transform(dataFromBase));
        }