1. 소장자료검색에서 더블클릭시 마크편집폼으로 전환 2. 마크편집에서 [저장시각, 작성자, 비고, 등급] 추가로 표시 3. 복본조사 - 특수문자, 괄호안의 문자 제거기능 추가 4. 저자기호 일괄전환 추가 5. 마크목록생성 - 수량분리기능 추가.
620 lines
19 KiB
C#
620 lines
19 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
using System.Windows.Forms;
|
|
using UniMarc.마크;
|
|
|
|
namespace WindowsFormsApp1.Mac
|
|
{
|
|
public partial class Check_copy : Form
|
|
{
|
|
Helper_DB db = new Helper_DB();
|
|
string compidx;
|
|
public string URL;
|
|
public string lib_Category;
|
|
public string Code;
|
|
Main main;
|
|
public Check_copy(Main _main)
|
|
{
|
|
InitializeComponent();
|
|
main = _main;
|
|
compidx = main.com_idx;
|
|
db.DBcon();
|
|
}
|
|
|
|
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
|
{
|
|
Skill_Grid sg = new Skill_Grid();
|
|
sg.Print_Grid_Num(sender, e);
|
|
}
|
|
|
|
private void tb_SearchTarget_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string Target = tb_SearchTarget.Text;
|
|
if (Target == "") { MessageBox.Show("도서관명이 비어있습니다."); return; }
|
|
|
|
string area = "`Province`, `Area`, `LibName`, `Code`, `URL`";
|
|
string cmd = string.Format("SELECT {0} FROM `lib_CopyCheck` WHERE `LibName` LIKE '%{1}%';", area, Target);
|
|
string data = db.self_Made_Cmd(cmd);
|
|
string[] ary = data.Split('|');
|
|
Check_Copy_Sub_Search ccs = new Check_Copy_Sub_Search(this);
|
|
ccs.Init(ary, Target);
|
|
ccs.Show();
|
|
}
|
|
}
|
|
|
|
private void btn_SearchList_Click(object sender, EventArgs e)
|
|
{
|
|
Check_Copy_Sub_List cl = new Check_Copy_Sub_List(this);
|
|
cl.Show();
|
|
}
|
|
|
|
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
Skill_Grid sg = new Skill_Grid();
|
|
sg.Excel_to_DataGridView(sender, e);
|
|
}
|
|
|
|
private void btn_Start_Click(object sender, EventArgs e)
|
|
{
|
|
for (int a = 0; a < dataGridView1.Rows.Count - 1; a++)
|
|
{
|
|
dataGridView1.Rows[a].Cells["Count"].Value =
|
|
CopyCount(dataGridView1.Rows[a].Cells["book_name"].Value.ToString());
|
|
}
|
|
}
|
|
|
|
public string CopyCount(string Text)
|
|
{
|
|
string result = "";
|
|
|
|
string[] Detail = lib_Category.Split('_');
|
|
switch (Detail[0])
|
|
{
|
|
case "광주":
|
|
result = 광주(Detail[1], Text);
|
|
break;
|
|
case "전남":
|
|
result = 전남(Detail[1], Text);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
#region 광주
|
|
string 광주(string detail, string Text)
|
|
{
|
|
string result = "";
|
|
switch (detail)
|
|
{
|
|
case "시립":
|
|
result = 광주시립(Text);
|
|
break;
|
|
case "교육청":
|
|
result = 광주교육청(Text);
|
|
break;
|
|
case "동구":
|
|
break;
|
|
case "서구":
|
|
break;
|
|
case "남구":
|
|
result = 광주남구(Text);
|
|
break;
|
|
case "북구":
|
|
result = 광주북구(Text);
|
|
break;
|
|
case "광산구":
|
|
result = 광주광산구(Text);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
string 광주시립(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
|
|
Delay(3000);
|
|
webBrowser1.Document.GetElementById("searchKeyword").SetAttribute("value", text);
|
|
|
|
webBrowser1.Document.GetElementById("libCode").SetAttribute("value", Code);
|
|
|
|
HtmlElementCollection button = webBrowser1.Document.GetElementsByTagName("button");
|
|
foreach (HtmlElement SearchButton in button)
|
|
{
|
|
if (SearchButton.InnerText == "검색")
|
|
SearchButton.InvokeMember("click");
|
|
}
|
|
Delay(1500);
|
|
|
|
HtmlElementCollection hecDiv = webBrowser1.Document.GetElementsByTagName("div");
|
|
foreach (HtmlElement heDiv in hecDiv)
|
|
{
|
|
if (heDiv.GetAttribute("className").IndexOf("srch_info") > -1)
|
|
{
|
|
HtmlElementCollection hecLi = heDiv.GetElementsByTagName("span");
|
|
foreach (HtmlElement heLi in hecLi)
|
|
{
|
|
if (heLi.GetAttribute("className").IndexOf("heighlight") > -1)
|
|
{
|
|
result = heLi.InnerText;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private string 광주교육청(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(3000);
|
|
|
|
webBrowser1.Document.GetElementById("manage_code").SetAttribute("value", Code);
|
|
|
|
webBrowser1.Document.GetElementById("search_txt").SetAttribute("value", text);
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (Btn.GetAttribute("id").IndexOf("search_txt") > -1)
|
|
Btn.SetAttribute("value", text);
|
|
if (Btn.GetAttribute("className").IndexOf("btn-search") > -1)
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(5000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("span");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.InnerText.IndexOf("전체") > -1)
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private string 광주남구(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(13000);
|
|
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (he.GetAttribute("id").IndexOf(Code) > -1)
|
|
{
|
|
he.InvokeMember("click");
|
|
}
|
|
}
|
|
|
|
webBrowser1.Document.GetElementById("searchWord").SetAttribute("value", text);
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (Btn.GetAttribute("className").IndexOf("btn btn-search") > -1)
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(5000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("strong");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.GetAttribute("className").IndexOf("cyan") > -1)
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private string 광주북구(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(3000);
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (he.Name.IndexOf("libCode") > -1)
|
|
{
|
|
if (!he.Id.Contains(Code))
|
|
{
|
|
he.InvokeMember("click");
|
|
}
|
|
}
|
|
}
|
|
webBrowser1.Document.GetElementById("searchSimple").SetAttribute("value", text);
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("button"))
|
|
{
|
|
if (Btn.GetAttribute("className").IndexOf("btn btn-lg") > -1)
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(5000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("p");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.GetAttribute("className").IndexOf("totalCount") > -1)
|
|
{
|
|
if (heTd.TagName == "P")
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private string 광주광산구(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(3000);
|
|
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (he.Name.IndexOf(Code) > -1)
|
|
{
|
|
he.InvokeMember("click");
|
|
}
|
|
}
|
|
webBrowser1.Document.GetElementById("searchWord").SetAttribute("value", text);
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (Btn.GetAttribute("className").IndexOf("btn btn-search") > -1)
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(5000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("strong");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.GetAttribute("className").IndexOf("cyan") > -1)
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 전남
|
|
string 전남(string detail, string Text)
|
|
{
|
|
string result = "";
|
|
switch (detail)
|
|
{
|
|
case "도립":
|
|
result = 전남도립(Text);
|
|
break;
|
|
case "교육청":
|
|
result = 전남교육청(Text);
|
|
break;
|
|
case "여수":
|
|
result = 전남여수(Text);
|
|
break;
|
|
case "고흥":
|
|
result = 전남고흥(Text);
|
|
break;
|
|
case "완도":
|
|
result = 전남완도(Text);
|
|
break;
|
|
case "진도":
|
|
result = 전남진도(Text);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private string 전남도립(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
|
|
Delay(5000);
|
|
|
|
webBrowser1.Document.GetElementById("value1").SetAttribute("value", text);
|
|
|
|
HtmlElementCollection hBtn = webBrowser1.Document.GetElementsByTagName("button");
|
|
foreach (HtmlElement Btn in hBtn)
|
|
{
|
|
if (Btn.InnerText == "검색")
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(1500);
|
|
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("font"))
|
|
{
|
|
result = Regex.Replace(he.InnerText, @"\D", "");
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private string 전남교육청(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(5000);
|
|
|
|
string msg = "";
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (he.Id != null && he.Id.IndexOf(Code) > -1)
|
|
{
|
|
he.InvokeMember("click");
|
|
}
|
|
if (he.Name.IndexOf("searchWordText") > -1)
|
|
{
|
|
he.SetAttribute("value", text);
|
|
}
|
|
}
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (Btn.GetAttribute("value") == "소장자료 검색")
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(5000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("span");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.GetAttribute("className").IndexOf("txt_bold") > -1)
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
break;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private string 전남여수(string text)
|
|
{
|
|
string result = "";
|
|
|
|
text = HttpUtility.UrlEncode(text);
|
|
|
|
string url = string.Format("https://yslib.yeosu.go.kr/dls_kapi/index.php?" +
|
|
"mod=wdDataSearch" +
|
|
"&act=searchResultList" +
|
|
"&facetManageCode={1}" +
|
|
"&searchWord={0}" +
|
|
"&dataSort=rk+desc", text, Code);
|
|
|
|
webBrowser1.Navigate(url);
|
|
|
|
Delay(8000);
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("strong"))
|
|
{
|
|
if (he.GetAttribute("className").IndexOf("cyan") > -1)
|
|
{
|
|
result = Regex.Replace(he.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private string 전남고흥(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(3000);
|
|
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (he.GetAttribute("id").IndexOf(Code) > -1)
|
|
{
|
|
he.InvokeMember("click");
|
|
}
|
|
}
|
|
|
|
webBrowser1.Document.GetElementById("query").SetAttribute("value", text);
|
|
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("button"))
|
|
{
|
|
if (Btn.InnerText == "검색")
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(3000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("p");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.GetAttribute("className").IndexOf("totalCount") > -1)
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private string 전남완도(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(3000);
|
|
|
|
webBrowser1.Document.GetElementById("value2").SetAttribute("value", text);
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("select"))
|
|
{
|
|
if (Btn.GetAttribute("name").IndexOf("local") > -1)
|
|
Btn.SetAttribute("value", Code);
|
|
}
|
|
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (Btn.GetAttribute("type") == "image")
|
|
Btn.InvokeMember("click");
|
|
}
|
|
|
|
Delay(3000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("td");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.GetAttribute("alrign").IndexOf("left") > -1)
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private string 전남진도(string text)
|
|
{
|
|
string result = "";
|
|
|
|
webBrowser1.Navigate(URL);
|
|
Delay(3000);
|
|
|
|
string msg = "";
|
|
foreach (HtmlElement he in webBrowser1.Document.GetElementsByTagName("input"))
|
|
{
|
|
if (he.GetAttribute("value").IndexOf(Code) > -1)
|
|
{
|
|
he.InvokeMember("click");
|
|
}
|
|
if (he.Name.IndexOf("query") > -1)
|
|
{
|
|
he.SetAttribute("value", text);
|
|
}
|
|
}
|
|
|
|
foreach (HtmlElement Btn in webBrowser1.Document.GetElementsByTagName("button"))
|
|
{
|
|
if (Btn.GetAttribute("className").IndexOf("btn btn-lg") > -1)
|
|
Btn.InvokeMember("click");
|
|
}
|
|
Delay(5000);
|
|
|
|
HtmlElementCollection hecTd = webBrowser1.Document.GetElementsByTagName("p");
|
|
foreach (HtmlElement heTd in hecTd)
|
|
{
|
|
if (heTd.GetAttribute("className").IndexOf("totalCount") > -1)
|
|
{
|
|
result = Regex.Replace(heTd.InnerText, @"\D", "");
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 지연시키는 함수
|
|
/// </summary>
|
|
/// <param name="ms">1000 = 1초</param>
|
|
void Delay(int ms)
|
|
{
|
|
DateTime dateTimeNow = DateTime.Now;
|
|
TimeSpan duration = new TimeSpan(0, 0, 0, 0, ms);
|
|
DateTime dateTimeAdd = dateTimeNow.Add(duration);
|
|
while (dateTimeAdd >= dateTimeNow)
|
|
{
|
|
Application.DoEvents();
|
|
dateTimeNow = DateTime.Now;
|
|
}
|
|
return;
|
|
}
|
|
|
|
private void btn_ApplyFilter_Click(object sender, EventArgs e)
|
|
{
|
|
int count = dataGridView1.Rows.Count;
|
|
if (count <= 1)
|
|
return;
|
|
|
|
// 특수문자 제거
|
|
if (chk_spChar.Checked)
|
|
{
|
|
RemoveSpecialChar(count);
|
|
}
|
|
|
|
// 괄호안의 문자 제거
|
|
if (chk_RemoveBrit.Checked)
|
|
{
|
|
RemoveInBrit(count);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 특수문자 제거
|
|
/// </summary>
|
|
void RemoveSpecialChar(int count)
|
|
{
|
|
for (int a = 0; a < count; a++)
|
|
{
|
|
if (dataGridView1.Rows[a].Cells["book_name"].Value == null)
|
|
break;
|
|
|
|
string Target = dataGridView1.Rows[a].Cells["book_name"].Value.ToString();
|
|
string res = Regex.Replace(Target, @"[^a-zA-Z0-9가-힣_\s()]", "", RegexOptions.Singleline);
|
|
|
|
dataGridView1.Rows[a].Cells["book_name"].Value = res.Trim();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 괄호안의 문자 제거
|
|
/// </summary>
|
|
void RemoveInBrit(int count)
|
|
{
|
|
String_Text st = new String_Text();
|
|
for (int a = 0; a < count; a++)
|
|
{
|
|
if (dataGridView1.Rows[a].Cells["book_name"].Value == null)
|
|
break;
|
|
|
|
string Target = dataGridView1.Rows[a].Cells["book_name"].Value.ToString();
|
|
|
|
dataGridView1.Rows[a].Cells["book_name"].Value = st.RemoveWordInBracket(Target).Trim();
|
|
}
|
|
}
|
|
|
|
private void btn_Close_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|