示例#1
0
        //딱한번만 돌려
        public bool InsertData(ChargeStation ch)
        {
            string str = string.Format("if exists(select statId from StationData where statId ='{0}') begin insert into ChgerData Values('{0}',{6},{7},{8},null) end " +
                                       "else begin insert into StationData Values ('{0}','{1}','{2}',{3},{4},'{5}');" +
                                       " insert into ChgerData Values ('{0}',{6},{7},{8},null);   end", ch.StatId, ch.StatNm, ch.AddrDoro, ch.Lat, ch.Lng, ch.UseTime, ch.ChgerId, ch.ChgerType, ch.Stat);

            return(ExSqlCommand(str));
        }
示例#2
0
        public bool UpdateData(ChargeStation ch)
        {
            string str = string.Format("if exists(select * from ChgerData where stat = 2 and 3 ={0} and statId='{1}' and chgerId={2}) begin update ChgerData set stat ={0}" +
                                       ",statTime = SYSDATETIME() where statId = '{1}'and chgerId={2} end else begin update ChgerData set statTime = null, stat ={0}" +
                                       " where statId = '{1}' and not stat ={0} and chgerId={2} end",
                                       ch.Stat, ch.StatId, ch.ChgerId);

            return(ExSqlCommand(str));
        }
示例#3
0
        public List <ChargeStation> SelectAllData()
        {
            string str = string.Format("select * from StationData sd,ChgerData cd where sd.StatId = cd.StatId");
            List <ChargeStation> cslist  = new List <ChargeStation>();
            SqlCommand           command = new SqlCommand(str, conn1);
            SqlDataReader        reader  = command.ExecuteReader();

            while (reader.Read())
            {
                ChargeStation cs = new ChargeStation(reader["statId"].ToString(), reader["statNm"].ToString(), reader["addrDoro"].ToString()
                                                     , double.Parse(reader["lat"].ToString()), double.Parse(reader["lng"].ToString()), reader["useTime"].ToString(),
                                                     int.Parse(reader["chgerId"].ToString()), int.Parse(reader["chgerType"].ToString())
                                                     , int.Parse(reader["stat"].ToString()), (reader["statTime"].ToString()));
                cslist.Add(cs);
            }
            reader.Close();
            command.Dispose();
            return(cslist);
        }
示例#4
0
        public void Searcher()
        {
            XmlString = Find();
            doc       = new XmlDocument();
            doc.LoadXml(XmlString);
            //string name = "data.xml";
            //doc.Save(name);
            ////=====================================================

            XmlNode node = doc.SelectSingleNode("response");
            XmlNode nd   = node.SelectSingleNode("body");
            XmlNode n    = nd.SelectSingleNode("items");

            ChargeStation station = null;

            foreach (XmlNode el in n.SelectNodes("item"))
            {
                station = ChargeStation.MakeStation(el);
                //딱한번만돌려
                //InsertData(station);
                //계속돌려!!
                UpdateData(station);
            }
        }