Example #1
0
        public void readAddressFromTXT()
        {
            string CurDiretory = System.Environment.CurrentDirectory;
            //Console.WriteLine(CurDiretory);
            string FilePath = string.Format("{0}\\주소데이터.txt", CurDiretory);

            string line;

            System.IO.StreamReader file = new System.IO.StreamReader(FilePath, Encoding.Default);

            while ((line = file.ReadLine()) != null)
            {
                //System.Console.WriteLine(line);
                string[] split_temp = line.Split(',');

                dataAddress temp = new dataAddress();
                temp.법정동코드     = split_temp[0];
                temp.법정동명      = split_temp[1];
                temp.폐지여부      = split_temp[2];
                temp.법정동코드_5자리 = split_temp[3];

                address_ALL.Add(temp);
            }
            file.Close();
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            //http://openapi.molit.go.kr/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTradeDev?serviceKey=v6UmuoRyMk3IPiiJL315ErO%2FvbVLbs8UI2h%2FQ%2BSSixULwnOXzQZy7yvOcyL%2FrTFfSyJzFUiBLpN3smZrsu1mAg%3D%3D&pageNo=1&numOfRows=10&LAWD_CD=11110&DEAL_YMD=202005&
            string url        = "http://openapi.molit.go.kr/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTradeDev";
            string serviceKey = "v6UmuoRyMk3IPiiJL315ErO%2FvbVLbs8UI2h%2FQ%2BSSixULwnOXzQZy7yvOcyL%2FrTFfSyJzFUiBLpN3smZrsu1mAg%3D%3D";
            string pageNo     = "1";
            string numOfRows  = "100";
            string LAWD_CD    = "";
            string DEAL_YMD   = "";

            string      full_address   = string.Format("{0} {1}", cb_1.Text, cb_2.Text);
            dataAddress selectedRegion = address_ALL.Find(x => x.법정동명 == full_address);

            Console.WriteLine(full_address);
            Console.WriteLine(selectedRegion.법정동코드_5자리);

            LAWD_CD  = selectedRegion.법정동코드_5자리;
            DEAL_YMD = string.Format("{0:yyyyMM}", dateTimePicker1.Value);


            string API_URL = string.Format("{0}?serviceKey={1}&pageNo={2}&numOfRows={3}&LAWD_CD={4}&DEAL_YMD={5}", url, serviceKey, pageNo, numOfRows, LAWD_CD, DEAL_YMD);

            List <dataItem> API_RESULT = CallAPI.callWebRequest(API_URL);

            dataGridView1.Rows.Clear();

            if (API_RESULT.Count > 0)
            {
                foreach (dataItem result in API_RESULT)
                {
                    Console.WriteLine("");
                    Console.WriteLine(result.아파트);
                    Console.WriteLine(string.Format("{0} {1} {2} {3}", cb_1.Text, cb_2.Text, result.도로명, Convert.ToInt32(result.도로명건물본번호코드)));
                    Console.WriteLine(string.Format("{0} {1}", result.법정동.Trim(), Convert.ToInt32(result.법정동본번코드)));
                    Console.WriteLine(string.Format("건축년도 : {0} / 전용면적 : {1}({2:.##}평)", result.건축년도, result.전용면적, (double)(Convert.ToDouble(result.전용면적) / 3.3)));
                    Console.WriteLine(string.Format("거래일 : {0}년 {1}월 {2}일 / 거래금액 : {3}", result.년, result.월, result.일, result.거래금액));
                }


                drawGridView(API_RESULT);
            }
        }