コード例 #1
0
        public List <ConfigStationInformation> SelectConfigStationInformation()
        {
            connect();
            List <ConfigStationInformation> StationList = new List <ConfigStationInformation>();
            string          sql = String.Format("SELECT * FROM `config_station_information` WHERE 1;");
            MySqlCommand    cmd = new MySqlCommand(sql, conn);
            MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                ConfigStationInformation Record = new ConfigStationInformation()
                {
                    ID              = (int)rdr["ID"],
                    StationName     = (string)rdr["StationName"],
                    Longitude       = double.Parse((string)rdr["Longitude"]),
                    Latitude        = double.Parse((string)rdr["Latitude"]),
                    BuildTime       = (DateTime)rdr["BuildTime"],
                    VoltageLevel    = double.Parse((string)rdr["VoltageLevel"]),
                    InstallCapacity = double.Parse((string)rdr["InstallCapacity"])
                };
                StationList.Add(Record);
            }
            rdr.Close();
            return(StationList);
        }
コード例 #2
0
 public int AddStationLineInformation(ConfigStationInformation Record)
 {
     connect();
     string sql = String.Format("INSERT INTO `config_station_information` (`StationName`,`Longitude`,`Latitude`,`BuildTime`,`VoltageLevel`,`InstallCapacity`) VALUE ('{0}','{1}','{2}','{3}','{4}','{5}');",
         Record.StationName, Record.Longitude, Record.Latitude, Record.BuildTime.ToString("yyyy-MM-dd HH:mm:ss"), Record.VoltageLevel, Record.InstallCapacity);
     MySqlCommand cmd = new MySqlCommand(sql, conn);
     int result = cmd.ExecuteNonQuery();
     return result;
 }
コード例 #3
0
        public int AddStationLineInformation(ConfigStationInformation Record)
        {
            connect();
            string sql = String.Format("INSERT INTO `config_station_information` (`StationName`,`Longitude`,`Latitude`,`BuildTime`,`VoltageLevel`,`InstallCapacity`) VALUE ('{0}','{1}','{2}','{3}','{4}','{5}');",
                                       Record.StationName, Record.Longitude, Record.Latitude, Record.BuildTime.ToString("yyyy-MM-dd HH:mm:ss"), Record.VoltageLevel, Record.InstallCapacity);
            MySqlCommand cmd    = new MySqlCommand(sql, conn);
            int          result = cmd.ExecuteNonQuery();

            return(result);
        }
コード例 #4
0
        public ConfigStationInformation FindConfigStationInformationByStationName(string StationName)
        {
            connect();
            string sql = String.Format("SELECT * FROM `config_station_information` WHERE `StationName`='{0}';",
                                       StationName);
            MySqlCommand    cmd = new MySqlCommand(sql, conn);
            MySqlDataReader rdr = cmd.ExecuteReader();

            rdr.Read();
            ConfigStationInformation Record = new ConfigStationInformation()
            {
                ID              = (int)rdr["ID"],
                StationName     = (string)rdr["StationName"],
                Longitude       = double.Parse((string)rdr["Longitude"]),
                Latitude        = double.Parse((string)rdr["Latitude"]),
                BuildTime       = (DateTime)rdr["BuildTime"],
                VoltageLevel    = double.Parse((string)rdr["VoltageLevel"]),
                InstallCapacity = double.Parse((string)rdr["InstallCapacity"])
            };

            rdr.Close();
            return(Record);
        }
コード例 #5
0
        public int AddConfigStationInformation(ConfigStationInformation Record)
        {
            DatabaseConnector dc = new DatabaseConnector();

            return(dc.AddStationLineInformation(Record));
        }
コード例 #6
0
 public List<ConfigStationInformation> SelectConfigStationInformation()
 {
     connect();
     List<ConfigStationInformation> StationList = new List<ConfigStationInformation>();
     string sql = String.Format("SELECT * FROM `config_station_information` WHERE 1;");
     MySqlCommand cmd = new MySqlCommand(sql, conn);
     MySqlDataReader rdr = cmd.ExecuteReader();
     while (rdr.Read())
     {
         ConfigStationInformation Record = new ConfigStationInformation()
         {
             ID = (int)rdr["ID"],
             StationName = (string)rdr["StationName"],
             Longitude=double.Parse((string)rdr["Longitude"]),
             Latitude=double.Parse((string)rdr["Latitude"]),
             BuildTime=(DateTime)rdr["BuildTime"],
             VoltageLevel=double.Parse((string)rdr["VoltageLevel"]),
             InstallCapacity=double.Parse((string)rdr["InstallCapacity"])
         };
         StationList.Add(Record);
     }
     rdr.Close();
     return StationList;
 }
コード例 #7
0
 public ConfigStationInformation FindConfigStationInformationByStationName(string StationName)
 {
     connect();
     string sql = String.Format("SELECT * FROM `config_station_information` WHERE `StationName`='{0}';",
         StationName);
     MySqlCommand cmd = new MySqlCommand(sql, conn);
     MySqlDataReader rdr = cmd.ExecuteReader();
     rdr.Read();
     ConfigStationInformation Record = new ConfigStationInformation()
     {
         ID = (int)rdr["ID"],
         StationName = (string)rdr["StationName"],
         Longitude = double.Parse((string)rdr["Longitude"]),
         Latitude = double.Parse((string)rdr["Latitude"]),
         BuildTime = (DateTime)rdr["BuildTime"],
         VoltageLevel = double.Parse((string)rdr["VoltageLevel"]),
         InstallCapacity = double.Parse((string)rdr["InstallCapacity"])
     };
     rdr.Close();
     return Record;
 }
コード例 #8
0
 public int AddConfigStationInformation(ConfigStationInformation Record)
 {
     DatabaseConnector dc = new DatabaseConnector();
     return dc.AddStationLineInformation(Record);
 }