Ejemplo n.º 1
0
        private void PositionSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (SearchQueryInput?.Text == null)
                {
                    return;
                }

                if (!SearchQueryInput.Text.Equals(string.Empty))
                {
                    compList.Clear();
                    ResultListView.Items.Clear();
                    string   result = Network.Request("https://work.mma.go.kr/caisBYIS/search/byjjecgeomsaek.do?eopjong_gbcd=" + (PositionSelector.SelectedIndex + 1) + "&eopche_nm=" + SearchQueryInput.Text);
                    Document doc    = NSoup.Parse.Parser.Parse(result, "https://work.mma.go.kr");
                    Elements elms   = doc.Select("th.title.t-alignLt.pl20px");
                    foreach (var item in elms)
                    {
                        compData compData = new compData();
                        compData.SetName(item.Text());
                        compData.SetId(GetMiddleString(item.Select("a").Attr("href"), "byjjeopche_cd=", "&"));
                        compList.Add(compData);
                        ResultListView.Items.Add(compData.GetName() + Environment.NewLine + "기업코드: " + compData.GetId());
                    }
                }
            }
            catch { }
        }
Ejemplo n.º 2
0
        private void SearchQueryInput_KeyUp(object sender, KeyEventArgs e)
        {
            if (!SearchQueryInput.Text.Equals(string.Empty) && e.Key.Equals(Key.Enter))
            {
                compList.Clear();
                ResultListView.Items.Clear();

                string   result = Network.Request("https://work.mma.go.kr/caisBYIS/search/byjjecgeomsaek.do?eopjong_gbcd=" + (PositionSelector.SelectedIndex + 1) + "&eopche_nm=" + SearchQueryInput.Text);
                Document doc    = NSoup.Parse.Parser.Parse(result, "https://work.mma.go.kr");
                Elements elms   = doc.Select("th.title.t-alignLt.pl20px");

                if (elms.Count.Equals(0))
                {
                    ResultListView.Items.Add("조회된 기업 없음");
                    LoadImageReady();
                }

                foreach (var item in elms)
                {
                    compData compData = new compData();
                    compData.SetName(item.Text());
                    compData.SetId(GetMiddleString(item.Select("a").Attr("href"), "byjjeopche_cd=", "&"));
                    compList.Add(compData);
                    ResultListView.Items.Add(compData.GetName() + Environment.NewLine + "기업코드 : " + compData.GetId());
                }
            }
        }