using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; using WindowsFormsApp1; namespace ExcelTest { public partial class Marc : Form { public string find; public string change; public string call = ""; private string data008 = string.Empty; string tbName = ""; public int checkCout = 0; public bool gridViewChk = false; // True / False Helper_DB db = new Helper_DB(); Help008Tag tag008 = new Help008Tag(); Skill_Search_Text search_Text = new Skill_Search_Text(); public Marc() { InitializeComponent(); } private void Marc_Load(object sender, EventArgs e) { // ComboBox Item Setting // 이용자 9 string[] combo1 = { "일반", "유아", "아동", "초등", "중학생", "고등학생", "성인용 19금", "특수계층", "미상" }; comboBox1.Items.AddRange(combo1); // 자료형식 3 string[] combo2 = { "해당무", "큰 글자", "점자" }; comboBox2.Items.AddRange(combo2); // 내용형식 28 string[] combo3 = { "해당무", "만화/그래픽노블", "사전", "백과사전", "평론", "통계자료", "명감", "연감", "족보", "조약, 협정문", "학위논문", "법률논문", "법령집", "판례집 및 판례요약집", "판결보도 및 판결 평석", "별쇄본", "역서(전체)", "음반목록", "영화작품목록", "초록", "서지", "목록", "편람", "색인", "조사보고", "기술보고서", "프로그램화된 텍스트", "표준/표준해설자료"}; comboBox3.Items.AddRange(combo3); comboBox7.Items.AddRange(combo3); // 문학형식 16 string[] combo4 = { "해당무", "소설", "추리소설", "단편소설", "시", "수필", "희곡/시나리오", "문집", "기행문/일기문/수기", "평론", "논픽션", "연설문", "논설문", "향가/시조", "풍자문학", "서간문학" }; comboBox4.Items.AddRange(combo4); // 전기 5 string[] combo5 = { "해당무", "자서전", "개인전기서", "전기물의 합저서", "전기적 정보가 포함된 자료" }; comboBox5.Items.AddRange(combo5); comboBox5.SelectedIndex = 0; // 언어 36 string[] combo6 = { "한국어", "영어", "일본어", "중국어", "독일어", "프랑스어", "러시아어", "스페인어", "이탈리아어", "네덜란드어", "핀란드어", "스웨덴어", "포르투갈어", "노르웨이어", "그리스어", "체코어", "폴란드어", "다국어", "말레이시아어", "몽골어", "미얀마(버마어)", "베트남어", "슬로베니아어", "아랍어", "아프리카어", "에스토니아어", "우즈베키스탄어", "우크라이나어", "인도(마라티어)", "캄보디아어", "태국어", "터키어", "투르크메니스탄어", "티베르어", "필리핀(타갈로그어)", "헝가리어" }; comboBox6.Items.AddRange(combo6); comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; comboBox3.SelectedIndex = 0; comboBox7.SelectedIndex = 0; comboBox4.SelectedIndex = 0; comboBox6.SelectedIndex = 0; radioButton1.Checked = true; // 기본표목 라디오박스 초기값설정 (개인명) GridView020.Rows.Add(200); GridView246.Rows.Add(200); GridView710.Rows.Add(30); GridView910.Rows.Add(30); GridView440.Rows.Add(10); GridView490.Rows.Add(10); GridView505.Rows.Add(200); } /// /// 가져온 목록을 책목록과 연동하여 Grid에 집어넣음. /// /// 목록idx /// 목록명 public void input_list(string date, string value) { db.DBcon(); string Area = "`idx`, `isbn`, `book_name`, `author`, `book_comp`, `pay`"; string[] sear_tbl = { "date", "list_name" }; string[] sear_col = { date, value }; string tmp_data = db.More_DB_Search("Obj_List_Book", sear_tbl, sear_col, Area); string[] db_data = tmp_data.Split('|'); string[] grid = { "", "", "", "", "", "", "", "" }; for(int a = 0; a < db_data.Length; a++) { if (a % 6 == 0) { grid[0] = db_data[a]; } if (a % 6 == 1) { grid[1] = db_data[a]; } if (a % 6 == 2) { grid[2] = db_data[a]; } if (a % 6 == 3) { grid[3] = db_data[a]; } if (a % 6 == 4) { grid[4] = db_data[a]; } if (a % 6 == 5) { grid[5] = db_data[a]; List_Book.Rows.Add(grid); } } chk_Marc(); } /// /// 마크 체크하는 함수 /// void chk_Marc() { for(int a= 0; a < List_Book.Rows.Count; a++) { string[] sear_tbl = { "ISBN" }; string[] sear_col = { List_Book.Rows[a].Cells["ISBN13"].Value.ToString() }; string Marc = db.More_DB_Search("Marc", sear_tbl, sear_col, "`idx`, `marc`, `grade`"); string[] db_data = Marc.Split('|'); if (db_data.Length < 2) { List_Book.Rows[a].DefaultCellStyle.BackColor = Color.LightGray; } else { switch (db_data[2]) { case "0": // A List_Book.Rows[a].DefaultCellStyle.ForeColor = Color.Blue; break; case "1": // B List_Book.Rows[a].DefaultCellStyle.ForeColor = Color.Red; break; case "2": // C List_Book.Rows[a].DefaultCellStyle.ForeColor = Color.Black; break; case "3": // D List_Book.Rows[a].DefaultCellStyle.ForeColor = Color.Gray; break; } List_Book.Rows[a].Cells["marc_idx"].Value = db_data[0]; List_Book.Rows[a].Cells["db_marc"].Value = db_data[1]; List_Book.Rows[a].Cells["grade"].Value = db_data[2]; } } } private void button2_Click(object sender, EventArgs e) { string result = ""; richTextBox1.Text = ""; string mid = "\t--\t"; string Sort = "▼"; string End = "▲\n"; string dlatl = ""; DataGridView data020 = GridView020; DataGridView data246 = GridView246; DataGridView data710 = GridView710; DataGridView data910 = GridView910; DataGridView data440 = GridView440; DataGridView data490 = GridView490; DataGridView data505 = GridView505; string[] data020a = { "", "", "" }; string[] data246a = { "", "", "", "", "" }; string[] data710a = { "", "" }; string[] data910a = { "", "" }; string[] data440a = { "", "", "", "", "", "" }; string[] data490a = { "", "" }; string[] data505a = { "", "", "", "" }; int count = 0, a = 0, b = 0; result = "메모장\n008\t\t200604s20192020ulk b 000a kor "; # region richTextBox1에 마크를 만드는 코드 { // 020 Tag for (a = 0; a < data020.RowCount - 1; a++) { gridViewChk = Convert.ToBoolean(data020.Rows[a].Cells[0].Value); for (b = 0; b < 3; b++) { if (b == 0) { data020a[b] = Sort + "a" + data020.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (b == 1) { data020a[b] = Sort + "g" + data020.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (b == 2) { data020a[b] = Sort + "c" + data020.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (data020.Rows[a].Cells[b + 1].FormattedValue.ToString() != "" && count == 0) { if (gridViewChk == false) { result += "020\t--\t"; } else if (gridViewChk == true) { result += "020\t1-\t"; } count = 1; } if (data020.Rows[a].Cells[b + 1].FormattedValue.ToString() != "") { result += data020a[b]; } } result += End; count = 0; } // 041 Tag if (text041a.Text != "" && text041a.Text != "041a" || text041k.Text != "" && text041k.Text != "041k" || text041h.Text != "" && text041h.Text != "041h" || text041b.Text != "" && text041b.Text != "041b") { result += "041" + mid; if (text041a.Text != "" && text041a.Text != "041a") { result += Sort + "a" + text041a.Text; } if (text041b.Text != "" && text041b.Text != "041b") { result += Sort + "b" + text041b.Text; } if (text041h.Text != "" && text041h.Text != "041h") { result += Sort + "h" + text041h.Text; } if (text041k.Text != "" && text041k.Text != "041k") { result += Sort + "k" + text041k.Text; } result += End; } // 056 Tag _ KDC if (textKDC4.Text != "" && textKDC4.Text != "KDC 4") { if (textKDC4.Text != "" && textKDC4.Text != "KDC 4") { result += "056" + mid + Sort + "a" + textKDC4.Text + Sort + "24" + End; } } if (textKDC5.Text != "" && textKDC5.Text != "KDC 5") { if (textKDC5.Text != "" && textKDC5.Text != "KDC 5") { result += "056" + mid + Sort + "a" + textKDC5.Text + Sort + "25" + End; } } if (textKDC6.Text != "" && textKDC6.Text != "KDC 6") { if (textKDC6.Text != "" && textKDC6.Text != "KDC 6") { result += "056" + mid + Sort + "a" + textKDC6.Text + Sort + "26" + End; } } // 082 Tag _ DDC if (textDDC21.Text != "" && textDDC21.Text != "DDC 21") { if (textDDC21.Text != "" && textDDC21.Text != "DDC 21") { result += "082" + mid + Sort + "a" + textDDC21.Text + Sort + "221" + End; } } if (textDDC22.Text != "" && textDDC22.Text != "DDC 22") { if (textDDC22.Text != "" && textDDC22.Text != "DDC 22") { result += "082" + mid + Sort + "a" + textDDC22.Text + Sort + "222" + End; } } if (textDDC23.Text != "" && textDDC23.Text != "DDC 23") { if (textDDC23.Text != "" && textDDC23.Text != "DDC 23") { result += "082" + mid + Sort + "a" + textDDC23.Text + Sort + "223" + End; } } // 100 Tag 개인명 if (radioButton1.Checked == true) { if (basicHeadBox.Text != "" && basicHeadBox.Text != "기본표목") { result += "100" + mid + Sort + "a" + basicHeadBox.Text + End; } } // 110 Tag 단체명 if (radioButton2.Checked == true) { if (basicHeadBox.Text != "" && basicHeadBox.Text != "기본표목") { result += "110" + mid + Sort + "a" + basicHeadBox.Text + End; } } // 111 Tag 회의명 if (radioButton3.Checked == true) { if (basicHeadBox.Text != "" && basicHeadBox.Text != "기본표목") { result += "111" + mid + Sort + "a" + basicHeadBox.Text + End; } } // 245 Tag if (text245a.Text != "" && text245a.Text != "245a 서명" || text245b.Text != "" && text245b.Text != "245b" || text245d.Text != "" && text245d.Text != "245d" || text245e.Text != "" && text245e.Text != "245e" || text245n.Text != "" && text245n.Text != "245n" || text245p.Text != "" && text245p.Text != "245p" || text245x.Text != "" && text245x.Text != "245x") { result += "245" + mid; if (text245a.Text != "" && text245a.Text != "245a 서명") { result += Sort + "a" + text245a.Text; } if (text245b.Text != "" && text245b.Text != "245b") { result += Sort + "b" + text245b.Text; } if (text245d.Text != "" && text245d.Text != "245d") { result += Sort + "d" + text245d.Text; } if (text245e.Text != "" && text245e.Text != "245e") { result += Sort + "e" + text245e.Text; } if (text245n.Text != "" && text245n.Text != "245n") { result += Sort + "n" + text245n.Text; } if (text245p.Text != "" && text245p.Text != "245p") { result += Sort + "p" + text245p.Text; } if (text245x.Text != "" && text245x.Text != "245x") { result += Sort + "x" + text245x.Text; } result += End; } // 246 Tag for (a = 0; a < data246.RowCount - 1; a++) { for (b = 0; b < 5; b++) { if (b == 1) { data246a[b] = Sort + "a" + data246.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (b == 2) { data246a[b] = Sort + "b" + data246.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (b == 0) { data246a[b] = Sort + "i" + data246.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (b == 3) { data246a[b] = Sort + "n" + data246.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (b == 4) { data246a[b] = Sort + "p" + data246.Rows[a].Cells[b + 1].FormattedValue.ToString(); } if (data246.Rows[a].Cells[b + 1].FormattedValue.ToString() != "" && count == 0) { dlatl = data246.Rows[a].Cells[0].FormattedValue.ToString(); result += "246"; if (dlatl == "A") { result += mid; } else { result += "\t" + dlatl + " \t"; } count = 1; } if (data246.Rows[a].Cells[b + 1].FormattedValue.ToString() != "") { result += data246a[b]; } } result += End; count = 0; } // 250 Tag if (text250a.Text != "" && text250a.Text != "250a") { result += "250" + mid + Sort + "a" + text250a.Text + End; } // 260 Tag if (text260a.Text != "" && text260a.Text != "260a" || text260b.Text != "" && text260b.Text != "260b" || text260c.Text != "" && text260c.Text != "260c" || text260g.Text != "" && text260g.Text != "260g") { result += "260" + mid; if (text260a.Text != "" && text260a.Text != "260a") { result += Sort + "a" + text260a.Text; } if (text260b.Text != "" && text260b.Text != "260b") { if (text260b.Text.Contains(Sort) == true) { dlatl = text260b.Text.Replace(Sort, Sort + "b"); result += dlatl; } else { result += Sort + "b" + text260b.Text; } } if (text260c.Text != "" && text260c.Text != "260c") { result += Sort + "c" + text260c.Text; } if (text260g.Text != "" && text260g.Text != "260g") { result += Sort + "g" + text260g.Text; } result += End; } // 300 Tag if (text300a.Text != "" && text300a.Text != "300a" || text300b.Text != "" && text300b.Text != "300b" || text300c1.Text != "" && text300c1.Text != "c세로" || text300c2.Text != "" && text300c2.Text != "c가로" || text300e.Text != "" && text300e.Text != "300e") { result += "300" + mid; if (text300a.Text != "" && text300a.Text != "300a") { result += Sort + "a" + text300a.Text; } if (text300b.Text != "" && text300b.Text != "300b") { result += Sort + "b" + text300b.Text; } if (text300c1.Text != "" && text300c1.Text != "c세로") { result += Sort + "c" + text300c1.Text; } if (text300c2.Text != "" && text300c2.Text != "c가로") { result += "x" + text300c2.Text; } if (text300e.Text != "" && text300e.Text != "300e") { result += Sort + "e" + text300e.Text; } result += End; } // 440 Tag for (a = 0; a < data440.RowCount - 1; a++) { for (b = 0; b < 6; b++) { if (b == 0) { data440a[b] = Sort + "a" + data440.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 1) { data440a[b] = Sort + "n" + data440.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 2) { data440a[b] = Sort + "p" + data440.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 3) { data440a[b] = Sort + "v" + data440.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 4) { if (data440.Rows[a].Cells[3].FormattedValue.ToString() == "") { data440a[b] = Sort + "v" + data440.Rows[a].Cells[b].FormattedValue.ToString(); } else { data440a[b] = " - " + data440.Rows[a].Cells[b].FormattedValue.ToString(); } } if (b == 5) { data440a[b] = Sort + "x" + data440.Rows[a].Cells[b].FormattedValue.ToString(); } if (data440.Rows[a].Cells[b].FormattedValue.ToString() != "" && count == 0) { result += "440" + mid; count = 1; } if (data440.Rows[a].Cells[b].FormattedValue.ToString() != "") { result += data440a[b]; } } result += End; count = 0; } // 490 Tag for (a = 0; a < data490.RowCount - 1; a++) { for (b = 0; b < 2; b++) { if (b == 0) { data490a[b] = Sort + "a" + data490.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 1) { data490a[b] = Sort + "v" + data490.Rows[a].Cells[b].FormattedValue.ToString(); } if (data490.Rows[a].Cells[b].FormattedValue.ToString() != "" && count == 0) { result += "490" + mid; count = 1; } if (data490.Rows[a].Cells[b].FormattedValue.ToString() != "") { result += data490a[b]; } } result += End; count = 0; } // 500 Tag if (text500a.Text != "" && text500a.Text != "500a") { string delEnt = text500a.Text.Replace("\r\n", ""); result += "500" + mid + Sort + "a" + delEnt + End; } // 504 Tag if (text504a.Text != "" && text504a.Text != "504a") { result += "504" + mid + Sort + "a" + text504a.Text + End; } // 505 Tag if (text505a.Text != "" && text505a.Text != "505a") { string delEnt = text505a.Text.Replace("\r\n", ""); result += "505" + mid + Sort + "a" + delEnt; count = 505; } for (a = 0; a < data505.RowCount - 1; a++) { for (b = 0; b < 4; b++) { if (b == 0) { data505a[b] = Sort + "n" + data505.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 1) { data505a[b] = Sort + "t" + data505.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 2) { data505a[b] = Sort + "d" + data505.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 3) { data505a[b] = Sort + "e" + data505.Rows[a].Cells[b].FormattedValue.ToString(); } if (data505.Rows[a].Cells[b].FormattedValue.ToString() != "" && count == 0) { result += "505" + mid + data505a[b]; count = 1; } else if (data505.Rows[a].Cells[b].FormattedValue.ToString() != "") { result += data505a[b]; } } result += End; count = 0; } // 507 Tag if (text507a.Text != "" && text507a.Text != "507a") { result += "507" + mid + Sort + "a" + text507a.Text + End; } // 520 Tag if (text520a.Text != "" && text520a.Text != "520a") { string delEnt = text520a.Text.Replace("\r\n", ""); result += "520" + mid + Sort + "a" + delEnt + End; } // 521 Tag if (text521a.Text != "" && text521a.Text != "521a") { result += "521" + mid + Sort + "a" + text521a.Text + End; } // 525 Tag if (text525a.Text != "" && text525a.Text != "525a") { result += "525" + mid + Sort + "a" + text525a.Text + End; } // 536 Tag if (text536a.Text != "" && text536a.Text != "536a") { result += "536" + mid + Sort + "a" + text536a.Text + End; } // 546 Tag if (text546a.Text != "" && text546a.Text != "546a 언어주기") { if(text546a.Text.Contains("\r\n") == true) { string[] temp546a = text546a.Text.Split('\n'); for (a = 0; a < temp546a.Length; a++) { temp546a[a] = temp546a[a].Replace("\r", ""); result += "546" + mid + Sort + "a" + temp546a[a] + End; } } else { result += "546" + mid + Sort + "a" + text546a.Text + End; } } // 586 Tag if (text586a.Text != "" && text586a.Text != "586a") { result += "586" + mid + Sort + "a" + text586a.Text + End; } // 650 Tag if (text650a.Text != "" && text650a.Text != "650a") { result += "650" + mid + Sort + "a" + text650a.Text + End; } // 653 Tag if (text653a.Text != "" && text653a.Text != "653a") { result += "653" + mid + Sort + "a" + text653a.Text + End; } // 700 Tag if (text700a.Text != "" && text700a.Text != "700a") { result += "700" + mid + Sort + "a" + text700a.Text + End; } // 710 Tag for (a = 0; a < data710.RowCount - 1; a++) { for (b = 0; b < 2; b++) { if (b == 0) { data710a[b] = Sort + "a" + data710.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 1) { data710a[b] = Sort + "b" + data710.Rows[a].Cells[b].FormattedValue.ToString(); } if (data710.Rows[a].Cells[b].FormattedValue.ToString() != "" && count == 0) { result += "710" + mid; count = 1; } if (data710.Rows[a].Cells[b].FormattedValue.ToString() != "") { result += data710a[b]; } } result += End; count = 0; } // 900 Tag if (text900a.Text != "" && text900a.Text != "900a") { result += "900" + mid + Sort + "a" + text900a.Text + End; } // 910 Tag for (a = 0; a < data910.RowCount - 1; a++) { for (b = 0; b < 2; b++) { if (b == 0) { data910a[b] = Sort + "a" + data910.Rows[a].Cells[b].FormattedValue.ToString(); } if (b == 1) { data910a[b] = Sort + "b" + data910.Rows[a].Cells[b].FormattedValue.ToString(); } if (data910.Rows[a].Cells[b].FormattedValue.ToString() != "" && count == 0) { result += "910" + mid; count = 1; } if (data910.Rows[a].Cells[b].FormattedValue.ToString() != "") { result += data910a[b]; } } result += End; count = 0; } // 940 Tag if (text940a.Text != "" && text940a.Text != "940a 로컬서명") { result += "940" + mid + Sort + "a" + text940a.Text + End; } } #endregion richTextBox1.Text = result.Replace("\n▲", ""); Color_change("▲"); Color_change("▼"); } private void button3_Click(object sender, EventArgs e) { etc1.Text = ""; etc2.Text = ""; List mynum = new List(); List symbol = new List(); List tempList = new List(); List mylist = new List(); string richBox = richTextBox1.Text.Replace("\n", ""); string tempname = ""; string tempsymbol = ""; char[] delimiter = { '▲', '\n', '\t' }; string[] ss; string[] arr = richBox.Split(delimiter); int count = 0, a = 0, b = 0, c = 0, d = 0, namecout = 0, symcout = 0, gridcout=0; foreach (string element in arr) { if (count != 0) { etc1.Text += '\n'; } etc1.Text += count + " : [" + element + "]"; if (count == 0 || count % 3 == 0) { mynum.Add(element); if (a == 0) { tempname = mynum[0]; } else if (mynum[a] != element) { tempname = element; } a++; } if (count == 1 || count % 3 == 1) { symbol.Add(element); if (b == 0) { tempsymbol = symbol[0]; } else if (symbol[b] != element) { tempsymbol = element; } b++; } if (count == 2 || count % 3 == 2) { tempList.Add(element); if(tempname == "020" || tempname == "246" || tempname == "440" || tempname == "490" || tempname == "505" || tempname == "710" || tempname == "910") { GridReturn(tempname, tempsymbol, element, gridcout); gridcout++; } ss = tempList[0].Split('▼'); if (c == 0) { } else if (tempList[c] != tempList[c - 1]) { ss = tempList[c].Split('▼'); } foreach (string dlatl in ss) { if (dlatl == "") { } else { if (mynum[d] != tempname || namecout == 0) { mynum.Insert(d, tempname); namecout++; } else if (mynum[d] == tempname) { mynum.Add(tempname); namecout = 0; } if (symbol[d] != tempsymbol || symcout == 0) { symbol.Insert(d, tempsymbol); symcout++; } else if (symbol[d] == tempsymbol) { symbol.Add(tempsymbol); symcout = 0; } mylist.Add(dlatl); d++; } } c++; } count++; } count = 0; for (int num = 0; num < mylist.Count; num++) { etc2.Text += num + " : [" + mynum[num] + "] [" + symbol[num] + "] [" + mylist[num] + "] ["+a+"]\n"; if(mynum[num] == "056" || mynum[num] == "082") { if (count == 1) { ReturnToBox(mynum[num], symbol[num], mylist[num-1], mylist[num]); count = 0; } else { count = 1; } } else { ReturnToBox(mynum[num], symbol[num], mylist[num]); } } Color_change("▲"); Color_change("▼"); } // TODO: Alt+x 입력 시 "▼78"이 출력됨. 아스키코드의 문제로 보여지나 정확한 원인은 확인불가. + 색상이 파란색으로 고정됨. private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { call = ((RichTextBox)sender).Name; richTextBox1.LanguageOption = 0; if (e.Alt) { if (e.KeyValue == 48 || e.KeyValue == 96) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼0"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 49 || e.KeyValue == 97) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼1"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 50 || e.KeyValue == 98) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼2"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 51 || e.KeyValue == 99) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼3"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 52 || e.KeyValue == 100) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼4"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 53 || e.KeyValue == 101) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼5"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 54 || e.KeyValue == 102) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼6"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 55 || e.KeyValue == 103) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼7"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 56 || e.KeyValue == 104) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼8"; richTextBox1.SelectionColor = Color.Black; } else if (e.KeyValue == 57 || e.KeyValue == 105) { richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼9"; richTextBox1.SelectionColor = Color.Black; } switch (e.KeyValue) { case 65: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼a"; richTextBox1.SelectionColor = Color.Black; break; case 66: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼b"; richTextBox1.SelectionColor = Color.Black; break; case 67: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼c"; richTextBox1.SelectionColor = Color.Black; break; case 68: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼d"; richTextBox1.SelectionColor = Color.Black; break; case 69: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼e"; richTextBox1.SelectionColor = Color.Black; break; case 70: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼f"; richTextBox1.SelectionColor = Color.Black; break; case 71: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼g"; richTextBox1.SelectionColor = Color.Black; break; case 72: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼h"; richTextBox1.SelectionColor = Color.Black; break; case 73: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼i"; richTextBox1.SelectionColor = Color.Black; break; case 74: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼j"; richTextBox1.SelectionColor = Color.Black; break; case 75: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼k"; richTextBox1.SelectionColor = Color.Black; break; case 76: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼l"; richTextBox1.SelectionColor = Color.Black; break; case 77: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼m"; richTextBox1.SelectionColor = Color.Black; break; case 78: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼n"; richTextBox1.SelectionColor = Color.Black; break; case 79: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼o"; richTextBox1.SelectionColor = Color.Black; break; case 80: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼p"; richTextBox1.SelectionColor = Color.Black; break; case 81: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼q"; richTextBox1.SelectionColor = Color.Black; break; case 82: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼r"; richTextBox1.SelectionColor = Color.Black; break; case 83: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼s"; richTextBox1.SelectionColor = Color.Black; break; case 84: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼t"; richTextBox1.SelectionColor = Color.Black; break; case 85: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼u"; richTextBox1.SelectionColor = Color.Black; break; case 86: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼v"; richTextBox1.SelectionColor = Color.Black; break; case 87: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼w"; richTextBox1.SelectionColor = Color.Black; break; case 88: // TODO: 입력시 코드값?이 출력됨 X쪽의 문제인지 아스키코드의 문제인지 확인 불가. richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼x"; richTextBox1.SelectionColor = Color.Black; break; case 89: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼y"; richTextBox1.SelectionColor = Color.Black; break; case 90: richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "▼z"; richTextBox1.SelectionColor = Color.Black; break; default: break; } } if (e.KeyCode == Keys.Enter) { richTextBox1.SelectionColor = Color.Red; richTextBox1.SelectedText = "▲"; richTextBox1.SelectionColor = Color.Black; } if (e.Control) { switch (e.KeyValue) { case 70: // f string value = ""; if(search_Text.InputBox("찾을 단어를 입력해주세요.", "찾기(Ctrl+F)", ref value) == DialogResult.OK) { Color_change(value); } break; case 72: // h findNchange fnc = new findNchange(this); fnc.Show(); break; default: break; } } } private void comboBox1_MouseClick(object sender, MouseEventArgs e) { ((ComboBox)sender).DroppedDown = true; } private void invertCheck_MouseClick(object sender, MouseEventArgs e) { string tmpStr = text245d.Text; if (tmpStr[tmpStr.Length-1] != ',') { tmpStr = basic_Replace(tmpStr); } else { tmpStr = tmpStr.Remove(tmpStr.Length - 1); } basicHeadBox.Text = tmpStr; string[] invert = basicHeadBox.Text.Split(' '); for(int a = 0; a < invert.Length; a++) { if (invert[a][invert[a].Length - 1] == ',') { invert[a] = invert[a].Substring(0, invert[a].Length - 1); } } if (invertCheck.Checked == true) { for(int a = 0; a < invert.Length; a++) { if (a == 0) { if(invert[a][invert[a].Length-1] != ',') { invert[a] += ","; } basicHeadBox.Text = invert[a] + " "; if(invert[a][invert[a].Length-1] == ',') { invert[a] = invert[a].Substring(0, invert.Length - 1); } } else { if (invert[a][invert[a].Length - 1] != ',') { invert[a] += ","; } basicHeadBox.Text += invert[a] + " "; if (invert[a][invert[a].Length - 1] == ',') { invert[a] = invert[a].Substring(0, invert.Length - 1); } } } } else if (invertCheck.Checked == false) { for (int a = invert.Length-1; a >= 0; a--) { if (a == invert.Length - 1) { if (invert[a][invert[a].Length - 1] != ',') { invert[a] += ","; } basicHeadBox.Text = invert[a] + " "; if (invert[a][invert[a].Length - 1] == ',') { invert[a] = invert[a].Substring(0, invert.Length - 1); } } else { if (invert[a][invert[a].Length - 1] != ',') { invert[a] += ","; } basicHeadBox.Text += invert[a] + " "; if (invert[a][invert[a].Length - 1] == ',') { invert[a] = invert[a].Substring(0, invert.Length - 1); } } } } if(basicHeadBox.Text[basicHeadBox.Text.Length-1]==' ') { basicHeadBox.Text = basicHeadBox.Text.Substring(0, basicHeadBox.Text.Length - 1); } if (basicHeadBox.Text[basicHeadBox.Text.Length - 1] == ',') { basicHeadBox.Text = basicHeadBox.Text.Substring(0, basicHeadBox.Text.Length - 1); } } /// /// 245d에서 " 역할어,"를 잘라내는 함수 /// /// /// public string basic_Replace(string strValue) { basicHeadBox.Text = ""; string result = strValue + ","; string[] Role = { "글", "그림", "지음", "글·그림", "편", "엮음", "저", "씀" }; string[] gl = { "글.그림", "글그림", "그림글", "그림.글" }; for(int a = 0; a < gl.Length; a++) { result = result.Replace(gl[a], "글·그림"); } for(int a = 0; a < Role.Length; a++) { result = result.Replace(" "+Role[a]+",", ""); } return result; } private void text008col_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { tbName = ((TextBox)sender).Name; call = ((TextBox)sender).Text; Helper008 helper = new Helper008(this); helper.Who_Call(tbName, call); helper.Show(); } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { string name = ((CheckBox)sender).Name; if (((CheckBox)sender).Checked == true) { switch (name) { case "checkBox1": ((CheckBox)sender).Text = "회의간행물o"; break; case "checkBox2": ((CheckBox)sender).Text = "기념논문집o"; break; } } else if (((CheckBox)sender).Checked == false) { switch (name) { case "checkBox1": ((CheckBox)sender).Text = "회의간행물x"; break; case "checkBox2": ((CheckBox)sender).Text = "기념논문집x"; break; } } switch (name) { case "checkBox1": Publication(checkBox1.Checked, 29); break; case "checkBox2": Publication(checkBox2.Checked, 30); break; } } void Publication(bool check, int idx) { if(text008.Text == "") { return; } char[] ArrayChar = text008.Text.ToCharArray(); if (check == false) { ArrayChar[idx] = '0'; } else if(check == true) { ArrayChar[idx] = '1'; } text008.Text = new string(ArrayChar); Apply_Main_marc(); } /// /// 색상 변경함수 /// /// public void Color_change(string strTarget) { Regex regex = new Regex(strTarget); MatchCollection mc = regex.Matches(richTextBox1.Text); richTextBox1.Select(0, richTextBox1.Text.Length); richTextBox1.SelectionBackColor = Color.White; int ICursorPosition = richTextBox1.SelectionStart; foreach (Match m in mc) { int istartidx = m.Index; int istopidx = m.Length + 1; int istopidx1 = m.Length; if (strTarget == "▼" || strTarget == "▲") { richTextBox1.Select(istartidx, istopidx); } else { richTextBox1.Select(istartidx, istopidx1); } if (strTarget == "▼") { richTextBox1.SelectionColor = Color.Blue; } else if (strTarget == "▲") { richTextBox1.SelectionColor = Color.Red; } else { richTextBox1.SelectionBackColor = Color.Orange; } // TODO: 색상 변경될수 있음. richTextBox1.SelectionStart = ICursorPosition; if (strTarget == "▼" || strTarget == "▲") { richTextBox1.SelectionColor = Color.Black; } else { richTextBox1.SelectionBackColor = Color.Empty; } } } private void Btn_interlock_Click(object sender, EventArgs e) { // 언어 36 string[] combo6 = { "한국어", "영어", "일본어", "중국어", "독일어", "프랑스어", "러시아어", "스페인어", "이탈리아어", "네덜란드어", "핀란드어", "스웨덴어", "포르투갈어", "노르웨이어", "그리스어", "체코어", "폴란드어", "다국어", "말레이시아어", "몽골어", "버마어", "베트남어", "슬로베니아어", "아랍어", "아프리카어", "에스토니아어", "우즈베키스탄어", "우크라이나어", "마라티어", "캄보디아어", "태국어", "터키어", "투르크메니스탄어", "티베르어", "타갈로그어", "헝가리어" }; string[] combo6_res = { "kor", "eng", "jpn", "chi", "ger", "fre", "rus", "spa", "ita", "dut", "fin", "swe", "por", "nor", "grc", "cze", "pol", "mul", "may", "mon", "bur", "vie", "slv", "ara", "afr", "est", "uzb", "ukr", "mar", "cam", "tha", "tur", "tuk", "tib", "tag", "hun" }; string result = ""; string[] tempStr = { text041a.Text, "", ""}; if (text041h.Text != "" && text041h.Text != "041h" && text041a.Text != "" && text041a.Text != "041a") { int tmpcout = tempStr[0].IndexOf(','); tempStr[1] = tempStr[0].Substring(0, tmpcout); tempStr[2] = tempStr[0].Substring(tmpcout); for (int a = 0; a < combo6.Length; a++) { if (text041h.Text.Contains(combo6_res[a]) == true) { result = combo6[a]+" 원작을 "; } } if (text041a.Text.Contains(',') == true) { for (int a = 0; a < combo6.Length; a++) { if (tempStr[1].Contains(combo6_res[a]) == true) { result += combo6[a] + "로 번역\r\n"; } } for (int a = 0; a < combo6.Length; a++) { if (tempStr[1].Contains(combo6_res[a]) == true) { result += "본문은 " + combo6[a] + ", "; } } for (int a = 0; a < combo6.Length; a++) { if (tempStr[2].Contains(combo6_res[a]) == true) { result += combo6[a] + "로 혼합수록되어 있음"; } } } else { for (int a = 0; a < combo6.Length; a++) { if (text041a.Text.Contains(combo6_res[a]) == true) { result += combo6[a] + "로 번역"; } } } text546a.Text = result; } else if (text041h.Text != "" && text041h.Text != "041h" && text041a.Text != "" && text041a.Text != "041a" && text041k.Text != "" && text041a.Text != "041k") { for (int a = 0; a < combo6.Length; a++) { if (text041k.Text.Contains(combo6_res[a]) == true) { result = combo6[a] + "로 번역된 "; } } for (int a = 0; a < combo6.Length; a++) { if (text041h.Text.Contains(combo6_res[a]) == true) { result += combo6[a] + " 원작을 "; } } for (int a = 0; a < combo6.Length; a++) { if (text041a.Text.Contains(combo6_res[a]) == true) { result += combo6[a] + "로 중역"; } } text546a.Text = result; } else if (text041a.Text != "" && text041a.Text != "041a" && text041a.Text.Contains(',') == true) { int tmpcout = tempStr[0].IndexOf(','); tempStr[1] = tempStr[0].Substring(0, tmpcout); tempStr[2] = tempStr[0].Substring(tmpcout); for (int a = 0; a < combo6.Length; a++) { if (tempStr[1].Contains(combo6_res[a]) == true) { richTextBox1.Text = "\n" + tempStr[1]; result = "본문은 " + combo6[a] + ", "; break; } } for (int a = 0; a < combo6.Length; a++) { if (tempStr[2].Contains(combo6_res[a]) == true) { richTextBox1.Text = "\n" + tempStr[2]; result += combo6[a] + "로 혼합수록되어 있음"; break; } } text546a.Text = result; } } private void Btn_Helper_Click(object sender, EventArgs e) { // TODO: 폼 새로 추가해서 메모장 단축키 및 기타 편의기능 설명추가할것. } private void Btn_Save_Click(object sender, EventArgs e) { // TODO: 마크DB에 저장이 되어야 함. 새로 만든 마크의 경우 INSERT / 기존 마크 수정의 경우 UPDATE string table_name = "Marc"; int row_idx = List_Book.CurrentCell.RowIndex; string[] grid_data = { List_Book.Rows[row_idx].Cells["ISBN13"].Value.ToString(), List_Book.Rows[row_idx].Cells["book_name"].Value.ToString(), List_Book.Rows[row_idx].Cells["author"].Value.ToString(), List_Book.Rows[row_idx].Cells["book_comp"].Value.ToString(), List_Book.Rows[row_idx].Cells["pay"].Value.ToString() }; if (List_Book.Rows[row_idx].Cells["db_marc"].Value.ToString() != "") { string[] Edit_tbl = { "`marc`", "`비고1`", "`비고2`"}; string[] Edit_col = { made_Ori_marc(), etc1.Text, etc2.Text }; string[] Sear_tbl = { "`ISBN`", "`서명`", "`저자`", "`출판사`", "`가격`" }; string[] Sear_col = { grid_data[0], grid_data[1], grid_data[2], grid_data[3], grid_data[4] }; db.More_Update(table_name, Edit_tbl, Edit_col, Sear_tbl, Sear_col); } else { string[] Insert_tbl = { "`ISBN`", "`서명`", "`저자`", "`출판사`", "`가격`", "`marc`", "`비고1`", "`비고2`" }; string[] Insert_col = { grid_data[0], grid_data[1], grid_data[2], grid_data[3], grid_data[4], made_Ori_marc(), etc1.Text, etc2.Text }; db.DB_INSERT(table_name, Insert_col, Insert_tbl); } } private void List_Book_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } int row_idx = e.RowIndex; richTextBox1.Text = ""; if (!click_Marc(row_idx)) { richTextBox1.Text = Make_Empty(); } Create_008(); Color_change("▼"); Color_change("▲"); } private string Make_Empty() { // 입력일자 (00-05) // 발행년유형 (6) // 발행년1 (07-10) // 발행년2 (11-14) // 발행국 (15-17) // 삽화표시 (18-21) // 이용대상자수준 (22) v // 개별자료형태 (23) v // 내용형식1 (24) v // 내용형식2 (25) v // 한국대학부호 (26-27) // 수정레코드 (28) // 회의간행물 (29) c // 기념논문집 (30) c // 색인 (31) // 목록전거 (32) // 문학형식 (33) v // 전기 (34) v // 언어 (35-37) v // 한국정부기관부호 (38-39) string yyMMdd = DateTime.Now.ToString("yyMMdd"); string yyyy = DateTime.Now.ToString("yyyy"); string Empty_008 = yyMMdd + "s" + yyyy + " 000 kor ▲"; text008.Text = Empty_008.Replace("▲", ""); data008 = text008.Text; string Empty_text = "008\t \t" + Empty_008 + "\n020\t \t▲\n" + "056\t \t▲\n" + "100\t \t▲\n" + "245\t \t▲\n" + "260\t \t▲\n" + "300\t \t▲\n" + "653\t \t▲\n" + "700\t \t▲\n" + "950\t \t▲\n"; return Empty_text; } bool click_Marc(int row) { string Marc_data = List_Book.Rows[row].Cells["db_marc"].Value.ToString(); if (Marc_data.Length < 3) { return false; } List TagNum = new List(); List field = new List(); Marc_data = Marc_data.Replace("", "▼"); Marc_data = Marc_data.Replace("", "▲"); // string leader = Marc_data.Substring(0, 24); int startidx = 0; string[] data = Marc_data.Substring(24).Split('▲'); // List에 필요한 데이터 집어넣는 작업. for (int a = 1; a < data.Length - 1; a++) { TagNum.Add(data[0].Substring(startidx, 12)); startidx += 12; field.Add(data[a] + "▲"); } // List에 들어간 데이터를 메모장에 출력시키는 작업. for (int a = 0; a < TagNum.Count; a++) { string result = TagNum[a].Substring(0, 3); if (TagNum[a].Substring(0,3) == "008") { text008.Text = field[a].Replace("▲", ""); data008 = text008.Text; } else { } if (field[a].IndexOf("▼") == -1) { result += "\t \t" + field[a]; } else { string temp = field[a].Insert(2, "\t"); result += "\t" + temp; } richTextBox1.Text += result + "\n"; } return true; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (text008.Text.Length < 3) { return; } string text = text008.Text; string comboName = ((ComboBox)sender).Name; int comboIdx = ((ComboBox)sender).SelectedIndex; text008.Text = tag008.Combo_Change(text, comboName, comboIdx); Apply_Main_marc(); } /// /// 008text가 메인 텍스트박스에 적용됨. /// private void Apply_Main_marc() { string text = text008.Text; richTextBox1.Text = richTextBox1.Text.Replace(data008, text); data008 = text; } private void col008res_TextChanged(object sender, EventArgs e) { if (text008.Text.Length < 3) { return; } string text = text008.Text; string iText = ((Label)sender).Text; if (iText.Length < 1) { return; } char[] textArray = text.ToCharArray(); char[] inputArray = iText.ToCharArray(); switch (((Label)sender).Name) { case "col008res": textArray[26] = inputArray[0]; textArray[27] = inputArray[1]; break; case "gov008res": textArray[38] = inputArray[0]; textArray[39] = inputArray[1]; break; } text = new string(textArray); text008.Text = text; Apply_Main_marc(); } private void input_date_ValueChanged(object sender, EventArgs e) { if (text008.Text.Length < 3) { return; } string date = input_date.Value.ToString(); date = date.Substring(0, 10); date = date.Replace("-", ""); date = date.Remove(0, 2); text008.Text = text008.Text.Remove(0, 6); text008.Text = date + text008.Text; Apply_Main_marc(); } private void Btn_Close_Click(object sender, EventArgs e) { this.Close(); } string made_Ori_marc() { string result = string.Empty; string 디렉토리 = string.Empty; string 가변길이 = string.Empty; string text = richTextBox1.Text.Replace("\t", ""); string[] array_text = text.Split('\n'); // num+count+total = 디렉토리 List num = new List(); List count = new List(); List total = new List(); for(int a= 0; a < array_text.Length - 1; a++) { num.Add(array_text[a].Substring(0, 3)); if (array_text[a][5] == '▼') { array_text[a] = array_text[a].Remove(0, 3); } else { array_text[a] = array_text[a].Remove(0, 5); } 가변길이 += array_text[a] + "\n"; int textLength = Encoding.Default.GetBytes(array_text[a]).Length - WordCheck(array_text[a], "▲") - WordCheck(array_text[a], "▼"); count.Add(insert_Zero(textLength, 4)); } for(int a = 0; a < array_text.Length; a++) { if (a == 0) { total.Add("0"); } else if (a > 1) { int b = Convert.ToInt32(total[total.Count - 1]); int c = Convert.ToInt32(Encoding.Default.GetBytes(array_text[a - 2]).Length.ToString()) - WordCheck(array_text[a - 2], "▲") - WordCheck(array_text[a - 2], "▼"); int res = b + c; total.Add(res.ToString()); } } string[] str_num = num.ToArray(); for(int a = 0; a < str_num.Length; a++) { if (total[a].Length == 4) { total[a] = total[a].Insert(0, "0"); } else if (total[a].Length == 3) { total[a] = total[a].Insert(0, "00"); } else if (total[a].Length == 2) { total[a] = total[a].Insert(0, "000"); } else if (total[a].Length == 1) { total[a] = total[a].Insert(0, "0000"); } 디렉토리 += str_num[a] + count[a] + total[a] + "\n"; } string[] 리더부 = { "00000","n", "a", "m", " ", " ", "2", "2", "00000", " ", "k", " ", "4", "5", "0", "0" }; 디렉토리 += "▲"; 디렉토리 = 디렉토리.Replace("\n", ""); 가변길이 += "↔"; 가변길이 = 가변길이.Replace("\n", ""); string dp = 가변길이 + 디렉토리; int recode = Encoding.Default.GetBytes(dp).Length - WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔"); 리더부[0] = insert_Zero(recode + 24, 5); int data_addr = 24 + Encoding.Default.GetBytes(디렉토리).Length - WordCheck(디렉토리, "▲"); 리더부[8] = insert_Zero(data_addr, 5); for(int a = 0; a < 리더부.Length; a++) { result += 리더부[a]; } result += 디렉토리 + 가변길이; return result; } int WordCheck(string String, string Word) { string[] StringArray = String.Split(new string[] { Word }, StringSplitOptions.None); return StringArray.Length - 1; } string insert_Zero(int value, int count) { string result = string.Empty; switch (count) { case 5: if (value < 10) { result = "0000"; } else if (value < 100) { result = "000"; } else if (value < 1000) { result = "00"; } else if (value < 10000) { result = "0"; } break; case 6: if (value < 10) { result = "000"; } else if (value < 100) { result = "00"; } else if (value < 1000) { result = "0"; } break; default: break; } result += value.ToString(); return result; } private void dataGridView2_DataError(object sender, DataGridViewDataErrorEventArgs e) { // ((System.Windows.Forms.DataGridView)sender).Rows.Add(); } /// /// 008 만드는 함수 /// /// public void Create_008() { string data = text008.Text; if (data == "" || data == null) { return; } string[] Tag008 = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; /* 입력일자 발행년유형 발행년1 발행년2 발행국 * 삽화표시 이용대상자수준 개별자료형태 내용형식1 내용형식2 * 한국대학부호 수정레코드 회의간행물 기념논문집 색인 * 목록전거 문학형식 전기 언어 한국정부기관부호 */ // 사전에 선언된 string배열에 맞는 데이터를 배정. int tmp_years = Convert.ToInt32(data.Substring(0, 2)); int now_years = Convert.ToInt32(DateTime.Now.ToString("yy")); string century = "20"; if (tmp_years > now_years) century = "19"; Tag008[0] = century + data.Substring(0, 6); // 입력일자 (00-05) Tag008[1] = data.Substring(6, 1); // 발행년유형 (6) Tag008[2] = data.Substring(7, 4); // 발행년1 (07-10) Tag008[3] = data.Substring(11, 4); // 발행년2 (11-14) Tag008[4] = data.Substring(15, 3); // 발행국 (15-17) Tag008[5] = data.Substring(18, 4); // 삽화표시 (18-21) Tag008[6] = data.Substring(22, 1); // 이용대상자수준 (22) v Tag008[7] = data.Substring(23, 1); // 개별자료형태 (23) v Tag008[8] = data.Substring(24, 1); // 내용형식1 (24) v Tag008[9] = data.Substring(25, 1); // 내용형식2 (25) v Tag008[10] = data.Substring(26, 2); // 한국대학부호 (26-27) Tag008[11] = data.Substring(28, 1); // 수정레코드 (28) Tag008[12] = data.Substring(29, 1); // 회의간행물 (29) c Tag008[13] = data.Substring(30, 1); // 기념논문집 (30) c Tag008[14] = data.Substring(31, 1); // 색인 (31) Tag008[15] = data.Substring(32, 1); // 목록전거 (32) Tag008[16] = data.Substring(33, 1); // 문학형식 (33) v Tag008[17] = data.Substring(34, 1); // 전기 (34) v Tag008[18] = data.Substring(35, 3); // 언어 (35-37) v Tag008[19] = data.Substring(38, 2); // 한국정부기관부호 (38-39) // 배열에 들어간 데이터로 콤보박스를 꾸미는 작업. int year = Convert.ToInt32(Tag008[0].Substring(0, 4)); int month = Convert.ToInt32(Tag008[0].Substring(4, 2)); int day = Convert.ToInt32(Tag008[0].Substring(6, 2)); input_date.Value = new DateTime(year, month, day); // 입력일자 comboBox1.SelectedIndex = tag008.User_008(Tag008[6]); // 이용대상자수준 comboBox2.SelectedIndex = tag008.DataType_008(Tag008[7]); // 개별자료형태 comboBox3.SelectedIndex = tag008.Format_008(Tag008[8]); // 내용형식1 comboBox7.SelectedIndex = tag008.Format_008(Tag008[9]); // 내용형식2 comboBox4.SelectedIndex = tag008.Literary_008(Tag008[16]); // 문학형식 comboBox5.SelectedIndex = tag008.Biography_008(Tag008[17]); // 전기 comboBox6.SelectedIndex = tag008.Language_008(Tag008[18]); // 언어 checkBox1.Checked = tag008.CheckBox_008(Tag008[12]); // 회의간행물 checkBox2.Checked = tag008.CheckBox_008(Tag008[13]); // 기념논문집 col008res.Text = Tag008[10]; gov008res.Text = Tag008[19]; return; } /// /// GridView에 다시 집어넣는거 /// /// /// /// public void GridReturn(string tag, string sym, string list, int count = 0) { if (tag == "020") { if (sym.Contains("1") == true) { GridView020.Rows[count].Cells[0].Value = true; } else { GridView020.Rows[count].Cells[0].Value = false; } int a020 = list.IndexOf("▼"); int c020 = list.IndexOf("▼", a020 + 1); int g020 = 0; string[] text020 = { "", "", "" }; if (c020 < 0) { c020 = list.IndexOf("▼", list.Length); g020 = -1; } else { g020 = list.IndexOf("▼", c020 + 1); } if (c020 < 0) { text020[0] = list.Substring(a020 + 1); } else { text020[0] = list.Substring(a020 + 1, c020 - 1); } if (g020 < 0) { text020[1] = list.Substring(c020 + 1); } else { text020[1] = list.Substring(c020 + 1, g020 - 1 - c020); text020[2] = list.Substring(g020 + 1); } for (int i = 0; i < 3; i++) { if (text020[i] == "") { GridView020.Rows[count].Cells[i].Value = ""; break; } if (text020[i][0] == 'a') { GridView020[1,count].Value = text020[i].Substring(1); } if (text020[i][0] == 'g') { GridView020[2,count].Value = text020[i].Substring(1); } if (text020[i][0] == 'c') { GridView020[3,count].Value = text020[i].Substring(1); } } } if (tag == "246") { if (sym.Contains("B") == true) { GridView246.Rows[count].Cells[0].Value = "B"; } else if (sym.Contains("C") == true) { GridView246.Rows[count].Cells[0].Value = "C"; } else if (sym.Contains("D") == true) { GridView246.Rows[count].Cells[0].Value = "D"; } else if (sym.Contains("E") == true) { GridView246.Rows[count].Cells[0].Value = "E"; } else { GridView246.Rows[count].Cells[0].Value = "A"; } int i246 = list.IndexOf("▼"); int a246 = list.IndexOf("▼", i246 + 1); int b246 = 0, n246 = 0, p246 = 0; string[] text246 = { "", "", "", "", "" }; if (a246 < 0) { a246 = list.IndexOf("▼", list.Length); b246 = -1; } else { b246 = list.IndexOf("▼", a246 + 1); } if (b246 < 0) { b246 = list.IndexOf("▼", list.Length); n246 = -1; } else { n246 = list.IndexOf("▼", b246 + 1); } if (n246 < 0) { n246 = list.IndexOf("▼", list.Length); p246 = -1; } else { p246 = list.IndexOf("▼", n246 + 1); } if (a246 < 0) { text246[0] = list.Substring(i246 + 1); } else { text246[0] = list.Substring(i246 + 1, a246 - 1); } if (b246 < 0) { text246[1] = list.Substring(a246 + 1); } else { text246[1] = list.Substring(a246 + 1, b246 - 1 - a246); } if (n246 < 0) { text246[2] = list.Substring(b246 + 1); } else { text246[2] = list.Substring(b246 + 1, n246 - 1 - b246); } if (p246 < 0) { text246[3] = list.Substring(n246 + 1); } else { text246[3] = list.Substring(n246 + 1, p246 - 1 - n246); text246[4] = list.Substring(p246 + 1); } for (int i = 0; i < 5; i++) { if (text246[i] == "") { GridView246.Rows[count].Cells[i].Value = ""; break; } if (text246[i][0] == 'i') { GridView246.Rows[count].Cells[1].Value = text246[i].Substring(1); } if (text246[i][0] == 'a') { GridView246.Rows[count].Cells[2].Value = text246[i].Substring(1); } if (text246[i][0] == 'b') { GridView246.Rows[count].Cells[3].Value = text246[i].Substring(1); } if (text246[i][0] == 'n') { GridView246.Rows[count].Cells[4].Value = text246[i].Substring(1); } if (text246[i][0] == 'p') { GridView246.Rows[count].Cells[5].Value = text246[i].Substring(1); } } } if (tag == "440") { int a440 = list.IndexOf("▼"); int n440 = list.IndexOf("▼", a440 + 1); int p440 = 0, v440 = 0, x440 = 0; string[] text440 = { "", "", "", "", "" }; if (n440 < 0) { n440 = list.IndexOf("▼", list.Length); p440 = -1; } else { p440 = list.IndexOf("▼", n440 + 1); } if (p440 < 0) { p440 = list.IndexOf("▼", list.Length); v440 = -1; } else { v440 = list.IndexOf("▼", p440 + 1); } if (v440 < 0) { v440 = list.IndexOf("▼", list.Length); x440 = -1; } else { x440 = list.IndexOf("▼", v440 + 1); } if (n440 < 0) { text440[0] = list.Substring(a440 + 1); } else { text440[0] = list.Substring(a440 + 1, n440 - 1); } if (p440 < 0) { text440[1] = list.Substring(n440 + 1); } else { text440[1] = list.Substring(n440 + 1, p440 - 1 - n440); } if (v440 < 0) { text440[2] = list.Substring(p440 + 1); } else { text440[2] = list.Substring(p440 + 1, v440 - 1 - p440); } if (x440 < 0) { text440[3] = list.Substring(v440 + 1); } else { text440[3] = list.Substring(v440 + 1, x440 - 1 - v440); text440[4] = list.Substring(x440 + 1); } for (int i = 0; i < 5; i++) { if (text440[i] == "") { if (i != 4) { GridView440.Rows[count].Cells[i].Value = ""; } break; } if (text440[i][0] == 'a') { GridView440.Rows[count].Cells[0].Value = text440[i].Substring(1); } if (text440[i][0] == 'n') { GridView440.Rows[count].Cells[1].Value = text440[i].Substring(1); } if (text440[i][0] == 'p') { GridView440.Rows[count].Cells[2].Value = text440[i].Substring(1); } if (text440[i][0] == 'v') { if (text440[i].Contains(" - ") == true) { int str440 = text440[i].IndexOf(" - "); string[] v440a = { text440[i].Substring(0, str440), text440[i].Substring(str440 + 3) }; GridView440.Rows[count].Cells[3].Value = v440a[0].Substring(1); GridView440.Rows[count].Cells[4].Value = v440a[1].Substring(0); } else { GridView440.Rows[count].Cells[3].Value = text440[i].Substring(1); } } if (text440[i][0] == 'x') { GridView440.Rows[count].Cells[5].Value = text440[i].Substring(1); } } } if (tag == "490") { int a490 = list.IndexOf("▼"); int b490 = list.IndexOf("▼", a490 + 1); string[] text490 = { "", "" }; if (b490 < 0) { text490[0] = list.Substring(a490 + 1); } else { text490[0] = list.Substring(a490 + 1, b490 - 1 - a490); text490[1] = list.Substring(b490 + 1); } for (int i = 0; i < 2; i++) { if (text490[i] == "") { GridView490.Rows[count].Cells[i].Value = ""; break; } if (text490[i][0] == 'a') { GridView490.Rows[count].Cells[0].Value = text490[i].Substring(1); } if (text490[i][0] == 'b') { GridView490.Rows[count].Cells[1].Value = text490[i].Substring(1); } } } if (tag == "505") { int n505 = list.IndexOf("▼"); int t505 = list.IndexOf("▼", n505 + 1); int d505 = 0; int e505 = 0; string[] text505 = { "", "", "", "" }; if (t505 < 0) { t505 = list.IndexOf("▼", list.Length); d505 = -1; } else { d505 = list.IndexOf("▼", t505 + 1); } if (d505 < 0) { d505 = list.IndexOf("▼", list.Length); e505 = -1; } else { e505 = list.IndexOf("▼", d505 + 1); } if (t505 < 0) { text505[0] = list.Substring(n505 + 1); } else { text505[0] = list.Substring(n505 + 1, t505 - 1); } if (d505 < 0) { text505[1] = list.Substring(t505 + 1); } else { text505[1] = list.Substring(t505 + 1, d505 - 1 - t505); } if (e505 < 0) { text505[2] = list.Substring(d505 + 1); } else { text505[2] = list.Substring(d505 + 1, e505 - 1 - d505); text505[3] = list.Substring(e505 + 1); } for (int i = 0; i < 4; i++) { if (text505[i] == "") { GridView505.Rows[count].Cells[i].Value = ""; break; } if (text505[i][0] == 'n') { GridView505.Rows[count].Cells[0].Value = text505[i].Substring(1); } else if (text505[i][0] == 't') { GridView505.Rows[count].Cells[1].Value = text505[i].Substring(1); } else if (text505[i][0] == 'd') { GridView505.Rows[count].Cells[2].Value = text505[i].Substring(1); } else if (text505[i][0] == 'e') { GridView505.Rows[count].Cells[3].Value = text505[i].Substring(1); } } } if (tag == "710") { int a710 = list.IndexOf("▼"); int b710 = list.IndexOf("▼", a710 + 1); string[] text710 = { "", "" }; if (b710 < 0) { text710[0] = list.Substring(a710 + 1); } else { text710[0] = list.Substring(a710 + 1, b710 - 1 - a710); text710[1] = list.Substring(b710 + 1); } for (int i = 0; i < 2; i++) { if (text710[i] == "") { GridView710.Rows[count].Cells[i].Value = ""; break; } if (text710[i][0] == 'a') { GridView710.Rows[count].Cells[0].Value = text710[i].Substring(1); } if (text710[i][0] == 'b') { GridView710.Rows[count].Cells[1].Value = text710[i].Substring(1); } } } if (tag == "910") { int a910 = list.IndexOf("▼"); int b910 = list.IndexOf("▼", a910 + 1); string[] text910 = { "", "" }; if (b910 < 0) { text910[0] = list.Substring(a910 + 1); } else { text910[0] = list.Substring(a910 + 1, b910 - 1 - a910); text910[1] = list.Substring(b910 + 1); } for (int i = 0; i < 2; i++) { if (text910[i] == "") { GridView910.Rows[count].Cells[i].Value = ""; break; } if (text910[i][0] == 'a') { GridView910.Rows[count].Cells[0].Value = text910[i].Substring(1); } if (text910[i][0] == 'b') { GridView910.Rows[count].Cells[1].Value = text910[i].Substring(1); } } } } /// /// 메모장에서 수정한 마크를 텍스트박스로 전달하는 함수 /// /// /// /// public void ReturnToBox(string num, string sym, string list, string list2 = "") { #region 이 안에 태그있다 { // 041 Tag if (num == "041") { if (list[0] == 'a') { text041a.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'k') { text041k.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'h') { text041h.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'b') { text041b.Text = list.Substring(1, list.Length - 1); } } // 056 Tag _ KDC if (num == "056") { if (list2[list2.Length - 1] == '4') { textKDC4.Text = list.Substring(1, list.Length - 1); } if (list2[list2.Length - 1] == '5') { textKDC5.Text = list.Substring(1, list.Length - 1); } if (list2[list2.Length - 1] == '6') { textKDC6.Text = list.Substring(1, list.Length - 1); } } // 082 Tag _ DDC if (num == "082") { if (list2[list2.Length - 1] == '1') { textDDC21.Text = list.Substring(1, list.Length - 1); } if (list2[list2.Length - 1] == '2') { textDDC22.Text = list.Substring(1, list.Length - 1); } if (list2[list2.Length - 1] == '3') { textDDC23.Text = list.Substring(1, list.Length - 1); } } // 100 Tag if (num == "100") { if(list[0] == 'a') { basicHeadBox.Text = list.Substring(1, list.Length - 1); } radioButton1.Checked = true; } // 110 Tag if (num == "110") { if(list[0] == 'a') { basicHeadBox.Text = list.Substring(1, list.Length - 1); } radioButton2.Checked = true; } // 111 Tag if (num == "111") { if(list[0] == 'a') { basicHeadBox.Text = list.Substring(1, list.Length - 1); } radioButton3.Checked = true; } // 245 Tag if (num == "245") { if (list[0] == 'a') { text245a.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'b') { text245b.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'd') { text245d.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'e') { text245e.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'n') { text245n.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'p') { text245p.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'x') { text245x.Text = list.Substring(1, list.Length - 1); } } // 250 Tag if (num == "250") { if (list[0] == 'a') { text250a.Text = list.Substring(1, list.Length - 1); } } // 260 Tag if (num == "260") { if (list[0] == 'a') { text260a.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'b') { text260b.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'c') { text260c.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'g') { text260g.Text = list.Substring(1, list.Length - 1); } } // 300 Tag if (num == "300") { string[] tmpStr; if (list[0] == 'a') { text300a.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'b') { text300b.Text = list.Substring(1, list.Length - 1); } if (list[0] == 'c') { if (list.Contains("x") == true) { tmpStr = list.Split('x'); text300c1.Text = tmpStr[0].Substring(1, tmpStr[0].Length - 1); text300c2.Text = tmpStr[1]; } else { text300a.Text = list.Substring(1, list.Length - 1); } } if (list[0] == 'e') { text300e.Text = list.Substring(1, list.Length - 1); } } // 500 Tag if (num == "500") { if (list[0] == 'a') { text500a.Text = list.Substring(1, list.Length - 1); } } // 504 Tag if (num == "504") { if (list[0] == 'a') { text504a.Text = list.Substring(1, list.Length - 1); } } // 505 Tag if (num == "505") { if (list[0] == 'a') { text505a.Text = list.Substring(1, list.Length - 1); } } // 507 Tag if (num == "507") { if (list[0] == 'a') { text507a.Text = list.Substring(1, list.Length - 1); } } // 520 Tag if (num == "520") { if (list[0] == 'a') { text520a.Text = list.Substring(1, list.Length - 1); } } // 521 Tag if (num == "521") { if (list[0] == 'a') { text521a.Text = list.Substring(1, list.Length - 1); } } // 525 Tag if (num == "525") { if (list[0] == 'a') { text525a.Text = list.Substring(1, list.Length - 1); } } // 536 Tag if (num == "536") { if (list[0] == 'a') { text536a.Text = list.Substring(1, list.Length - 1); } } // 546 Tag if (num == "546") { if (list[0] == 'a') { text546a.Text = list.Substring(1, list.Length - 1); } } // 586 Tag if (num == "586") { if (list[0] == 'a') { text586a.Text = list.Substring(1, list.Length - 1); } } // 650 Tag if (num == "650") { if (list[0] == 'a') { text650a.Text = list.Substring(1, list.Length - 1); } } // 653 Tag if (num == "653") { if (list[0] == 'a') { text653a.Text = list.Substring(1, list.Length - 1); } } // 700 Tag if (num == "700") { if (list[0] == 'a') { text700a.Text = list.Substring(1, list.Length - 1); } } // 900 Tag if (num == "900") { if (list[0] == 'a') { text900a.Text = list.Substring(1, list.Length - 1); } } // 940 Tag if (num == "940") { if (list[0] == 'a') { text940a.Text = list.Substring(1, list.Length - 1); } } } #endregion Color_change("▲"); Color_change("▼"); } private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { Rectangle rect = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, ((DataGridView)sender).RowHeadersWidth - 4, e.RowBounds.Height); TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), ((DataGridView)sender).RowHeadersDefaultCellStyle.Font, rect, ((DataGridView)sender).RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right); } private Rectangle dragBoxFromMouseDown; private int rowIndexFromMouseDown; private int rowIndexOfItemUnderMouseToDrop; private void dataGridView_MouseMove(object sender, MouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) { if(dragBoxFromMouseDown!=Rectangle.Empty && !dragBoxFromMouseDown.Contains(e.X, e.Y)) { DragDropEffects dropEffects = ((DataGridView)sender).DoDragDrop(((DataGridView)sender).Rows[rowIndexFromMouseDown], DragDropEffects.Move); } } } private void dataGridView_MouseDown(object sender, MouseEventArgs e) { rowIndexFromMouseDown = ((DataGridView)sender).HitTest(e.X, e.Y).RowIndex; if (rowIndexFromMouseDown != -1) { Size dragSize = SystemInformation.DragSize; dragBoxFromMouseDown = new Rectangle(new Point(e.X - (dragSize.Width / 2), e.Y - (dragSize.Height / 2)), dragSize); } else { dragBoxFromMouseDown = Rectangle.Empty; } } private void dataGridView_DragOver(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Move; } private void dataGridView_DragDrop(object sender, DragEventArgs e) { Point clientPoint = ((DataGridView)sender).PointToClient(new Point(e.X, e.Y)); rowIndexOfItemUnderMouseToDrop = ((DataGridView)sender).HitTest(clientPoint.X, clientPoint.Y).RowIndex; if (e.Effect == DragDropEffects.Move) { DataGridViewRow rowToMove = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow; ((DataGridView)sender).Rows.RemoveAt(rowIndexFromMouseDown); ((DataGridView)sender).Rows.Insert(rowIndexOfItemUnderMouseToDrop, rowToMove); } } private void dataGridView8_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { for (int a = 0; a < List_Book.Rows.Count - 1; a++) { if(List_Book.Rows[a].Selected == true) { List_Book.Rows.Remove(List_Book.Rows[a]); break; } } } } private void Marc_Shown(object sender, EventArgs e) { GridView020.CurrentCell = null; GridView246.CurrentCell = null; GridView710.CurrentCell = null; GridView910.CurrentCell = null; GridView440.CurrentCell = null; GridView490.CurrentCell = null; GridView505.CurrentCell = null; } } }