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);
        }
 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;
 }
        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);
        }
        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);
        }
        public int AddConfigStationInformation(ConfigStationInformation Record)
        {
            DatabaseConnector dc = new DatabaseConnector();

            return(dc.AddStationLineInformation(Record));
        }
 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;
 }
 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;
 }
 public int AddConfigStationInformation(ConfigStationInformation Record)
 {
     DatabaseConnector dc = new DatabaseConnector();
     return dc.AddStationLineInformation(Record);
 }