diff --git a/.gitignore b/.gitignore index ee898da..78e2593 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ ## 파일무시 -Helper_DB.cs -Skill.cs ## 다음과 같은 확장자는 전체 무시 *.pub diff --git a/ExcelTest/ExcelTest/Helper_DB.cs b/ExcelTest/ExcelTest/Helper_DB.cs new file mode 100644 index 0000000..95fbea5 --- /dev/null +++ b/ExcelTest/ExcelTest/Helper_DB.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MySql.Data.MySqlClient; + +namespace ServerText +{ + /// + /// DB접속을 도와주는 클래스 + /// + class Helper_DB + { + // 접속 + MySqlConnection conn = new MySqlConnection(); + + // 쿼리 + MySqlCommand sqlcmd = new MySqlCommand(); + MySqlDataReader sd; + + /// + /// DB를 사용하고 싶을 때 미리 저장된 DB의 기본 접속정보를 이용하여 DB에 접근한다. + /// + public void DBcon() // DB접속 함수 + { + try + { + // DB 접속 정보 + string connectionString = "Server = 192.168.123.191;" + + "database=unimarc;" + + "uid=root;" + + "pwd=Admin21234;"; + + // 접속정보 적용 + conn.ConnectionString = connectionString; + } + catch (Exception) + { + sqlcmd.Connection.Close(); + } + } + + /// + /// DBcon이 선진행되어야함. + /// + /// + /// 검색된 결과값이 반환됨. + public string DB_Search(string DB_Table_Name) // DB + { + string cmd = "SELECT * FROM "; + cmd += DB_Table_Name; + string result = ""; + + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + + // 한줄씩 불러오기 + while (sd.Read()) + { + // user_id, user_pw 순의 컬럼이 있다고 가정 + // 첫 컬럼 sd[0]으로 불러오기 + result = sd[0].ToString(); + // 다음 컬럼은 컬럼명으로 불러오기 + result += "|" + sd["RATING"].ToString(); + } + return result; + } + } +} diff --git a/ISBN_Check_test/Helper_DB.cs b/ISBN_Check_test/Helper_DB.cs new file mode 100644 index 0000000..5f5dde5 --- /dev/null +++ b/ISBN_Check_test/Helper_DB.cs @@ -0,0 +1,576 @@ +using System; +using System.Collections.Generic; +using System.IO.Ports; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using MySql.Data.MySqlClient; +using Renci.SshNet; + +namespace WindowsFormsApp1 +{ + /// + /// DB접속을 도와주는 클래스 + /// + class Helper_DB + { + // 접속 + MySqlConnection conn; + + // 쿼리 + MySqlCommand sqlcmd = new MySqlCommand(); + MySqlDataReader sd; + + public string comp_idx { get; internal set; } + + /// + /// DB를 사용하고 싶을 때 미리 저장된 DB의 기본 접속정보를 이용하여 DB에 접근한다. + /// + public void DBcon() // DB접속 함수 + { + PasswordConnectionInfo connectionInfo = new PasswordConnectionInfo("1.215.250.130", 815, "gloriabook", "admin@!@#$"); + connectionInfo.Timeout = TimeSpan.FromSeconds(30); + using (var client = new SshClient(connectionInfo)) + { + client.Connect(); + if (client.IsConnected) + { + string strConnection = "Server=1.215.250.130;" + + "Port=3306;" + + "Database=unimarc;" + + "uid=root;" + + "pwd=Admin21234;"; + conn = new MySqlConnection(strConnection); + } + } + } + /// + /// 국중DB를 사용하고 싶을 때 미리 저장된 DB의 기본 접속정보를 이용하여 DB에 접근한다. + /// + public void DBcon_cl() // DB접속 함수 + { + PasswordConnectionInfo connectionInfo = new PasswordConnectionInfo("1.215.250.130", 815, "gloriabook", "admin@!@#$"); + connectionInfo.Timeout = TimeSpan.FromSeconds(30); + using (var client = new SshClient(connectionInfo)) + { + client.Connect(); + if (client.IsConnected) + { + string strConnection = "Server=1.215.250.130;" + + "Port=3306;" + + "Database=cl_marc;" + + "uid=root;" + + "pwd=Admin21234;"; + conn = new MySqlConnection(strConnection); + } + } + } + /// + /// DBcon이 선진행되어야함. + /// SELECT * FROM [DB_Table_Name] WHERE [DB_Where_Table] LIKE \"%DB_Search_Data%\" + /// + /// 이용자 회사의 idx번호 단.none일 경우 다른 DB를 가져옴 + /// 테이블명 + /// 검색할 테이블 + /// 검색할 텍스트 + /// 검색된 결과값이 반환됨. + public string DB_Contains(string DB_Table_Name, string compidx, + string DB_Where_Table = "", string DB_Search_Data = "", + string Search_col = "", + string DB_Where_Table1 = "", string DB_Search_Data1 = "" ) + { + string cmd = "SELECT "; + if (Search_col == "") { cmd += "*"; } + else { cmd += Search_col; } + cmd += " FROM "; + cmd += DB_Table_Name; + if (DB_Table_Name == "Obj_List") { cmd += " WHERE `comp_num` = \"" + compidx + "\""; } + else if (DB_Table_Name == "Client") { cmd += " WHERE `campanyidx` = \"" + compidx + "\""; } + else if (DB_Table_Name == "Purchase") { cmd += " WHERE `comparyidx` = \"" + compidx + "\""; } + else if(compidx == "none") { cmd += " WHERE `grade` = \"2\""; } + else { cmd += " WHERE `compidx` = \"" + compidx + "\""; } + + if(DB_Search_Data != "") + { + cmd += " AND "+ DB_Where_Table + " LIKE\"%" + DB_Search_Data + "%\""; + } + if(DB_Search_Data1 != "") + { + cmd += " AND "+ DB_Where_Table1 + " LIKE\"%" + DB_Search_Data1 + "%\""; + } + cmd += ";"; + string result = ""; + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + string change = ""; + // 한줄씩 불러오기 + while (sd.Read()) + { + for(int cout = 0;cout < sd.FieldCount; cout++) + { + change = sd[cout].ToString().Replace("|",""); + result += change + "|"; + } + } + conn.Close(); + return result; + } + /// + /// DBcon이 선진행되어야함. / SELECT * FROM DB_Table_Name WHERE DB_Where_Table = \"DB_Search_Data\"; + /// + /// 가져올 데이터의 위치 + /// 테이블명 + /// 검색할 테이블 + /// 검색할 텍스트 + /// 검색된 결과값이 반환됨. + public string DB_Select_Search(string Search_Area, string DB_Table_Name, + string DB_Where_Table = "", string DB_Search_Data = "", + string DB_Where_Table1 = "", string DB_Search_Data1 = "") + { + string cmd = "SELECT "+Search_Area+" FROM "; + cmd += DB_Table_Name; + if(DB_Where_Table != "" && DB_Search_Data != "") + { + cmd += " WHERE `" + DB_Where_Table + "` = \"" + DB_Search_Data + "\""; + } + if(DB_Where_Table1 != "" && DB_Search_Data1 != "") + { + cmd += " AND `" + DB_Where_Table1 + "` = \"" + DB_Search_Data1 + "\""; + } + cmd += ";"; + string result = ""; + + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + // 한줄씩 불러오기 + while (sd.Read()) + { + for(int cout = 0;cout< sd.FieldCount; cout++) + { + result += sd[cout].ToString() + "|"; + } + } + conn.Close(); + return result; + } + /// + /// DBcon이 선진행되어야함. / SELECT * FROM DB_Table_Name WHERE DB_Where_Table = \"DB_Search_Data\"; + /// + /// 테이블명 + /// 검색할 테이블 + /// 검색할 텍스트 + /// 검색된 결과값이 반환됨. + public string DB_Search(string DB_Table_Name, + string DB_Where_Table = "", string DB_Search_Data = "", + string DB_Where_Table1 = "", string DB_Search_Data1 = "") + { + string cmd = "SELECT * FROM "; + cmd += DB_Table_Name;// + " where id=\"id\""; + if(DB_Search_Data != "") + { + cmd += " WHERE "+ DB_Where_Table + "=\"" + DB_Search_Data +"\""; + } + if (DB_Where_Table1 != "" && DB_Search_Data1 != "") + { + cmd += " AND `" + DB_Where_Table1 + "` =\"" + DB_Search_Data1 + "\""; + } + cmd += ";"; + string result = ""; + + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + // 한줄씩 불러오기 + while (sd.Read()) + { + for(int cout = 0;cout< sd.FieldCount; cout++) + { + result += sd[cout].ToString() + "|"; + } + } + conn.Close(); + return result; + } + /// + /// 여러 조건이 있을때 사용 (단, Where_Table과 Search_Date의 배열길이는 같아야함) + /// + /// + /// + /// + /// 추출할 열의 이름."`num1`, `num2`" 이런식으로 + /// + public string More_DB_Search(String DB_Table_Name, String[] DB_Where_Table, + String[] DB_Search_Data, String Search_Table = "") + { + if(DB_Where_Table.Length != DB_Search_Data.Length) { return "오류발생"; } + string result = ""; + string cmd = "SELECT "; + if(Search_Table == "") { cmd += "*"; } + else { cmd += Search_Table; } + cmd += " FROM " + DB_Table_Name + " WHERE "; + for(int a = 0; a < DB_Where_Table.Length; a++) + { + cmd += "`" + DB_Where_Table[a] + "` = \"" + DB_Search_Data[a] + "\" "; + if(a == DB_Where_Table.Length - 1) { cmd += " LIMIT 1000;"; } + else { cmd += " AND "; } + } + + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + // 한줄씩 불러오기 + while (sd.Read()) + { + for(int cout = 0; cout < sd.FieldCount; cout++) + { + result += sd[cout].ToString() + "|"; + } + } + conn.Close(); + return result; + } + /// + /// DB상의 날짜의 사이값을 가져오기 위한 함수 + /// + /// 가져올 테이블의 이름 + /// 프로그램상으로 가져올 DB데이터 + /// DB상의 날짜가 저장된 컬럼명 + /// 시작할 날짜 0000-00-00 + /// 끝낼 날짜 0000-00-00 + /// 회사 인덱스 main.com_idx + /// + public string Search_Date(string Table_name, string Search_Table, string Search_date, + string start_date, string end_date, string compidx) + { + string result = ""; + if (Search_Table == "") { Search_Table = "*"; } + // select * from `table_name` where `날짜 컬럼` between date('start_date') and date('end_date')+1; + string cmd = "SELECT " + Search_Table + " FROM `" + Table_name + "` " + + "WHERE `comp_num` = '" + compidx + "' AND `" + + Search_date + "` >= '" + start_date + "'"; + if(Table_name != "Obj_List") { cmd = cmd.Replace("`comp_num`", "`compidx`"); } + if (end_date != "") { cmd += " AND `" + Search_date + "` <= '" + end_date + "';"; } + else { cmd += ";"; } + conn.Open(); + sqlcmd.CommandText = cmd; + sqlcmd.Connection = conn; + sd = sqlcmd.ExecuteReader(); + while (sd.Read()){ + for(int cout = 0; cout < sd.FieldCount; cout++) + { + result += sd[cout].ToString() + "|"; + } + } + conn.Close(); + return result; + } + public void DB_INSERT(String DB_Table_name, String[] DB_col_name, String[] setData) + { + string cmd = "INSERT INTO " + DB_Table_name + "("; + for(int a = 0; a < DB_col_name.Length; a++) + { + if (a == DB_col_name.Length - 1) { cmd += "`" + DB_col_name[a] + "`) "; } + else { cmd += "`" + DB_col_name[a] + "`, "; } + } + cmd += "values("; + for(int a = 0; a < setData.Length; a++) + { + if (a == setData.Length - 1) { cmd += "\"" + setData[a] + "\")"; } + else { cmd += "\"" + setData[a] + "\", "; } + } + cmd += ";"; + cmd = cmd.Replace("|", ""); + using (conn) + { + conn.Open(); + MySqlTransaction tran = conn.BeginTransaction(); + sqlcmd.Connection = conn; + sqlcmd.Transaction = tran; + try + { + sqlcmd.CommandText = cmd; + sqlcmd.ExecuteNonQuery(); + tran.Commit(); + } + catch(Exception ex) + { + tran.Rollback(); + MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + /// + /// 대상 컬럼 삭제 / DELETE FROM "DB_Table_Name" WHERE "target_idx"="comp_idx" AND "target_area"="target"; + /// + /// 삭제할 대상이 있는 테이블명 + /// 인덱스 대상이 있는 열명 + /// 삭제할 대상의 인덱스 + /// 삭제할 대상이 있는 열명 + /// 삭제할 대상 + public void DB_Delete(string DB_Table_Name, + string target_idx, string comp_idx, + string target_area, string target) + { + string cmd = "DELETE FROM " + DB_Table_Name + " WHERE " + + "`" + target_idx + "`=\"" + comp_idx + "\" AND" + + "`" + target_area + "`=\"" + target + "\" LIMIT 1;"; + using (conn) + { + conn.Open(); + MySqlTransaction tran = conn.BeginTransaction(); + sqlcmd.Connection = conn; + sqlcmd.Transaction = tran; + try + { + sqlcmd.CommandText = cmd; + sqlcmd.ExecuteNonQuery(); + + tran.Commit(); + } + catch(Exception ex) + { + tran.Rollback(); + MessageBox.Show(ex.ToString()); + } + } + } + /// + /// 대상 컬럼 삭제(리미트 없음) / DELETE FROM "DB_Table_Name" WHERE "target_idx"="comp_idx" AND "target_area"="target"; + /// + /// 대상 테이블명 + /// 회사 인덱스 컬럼명 + /// 회사 인덱스 + /// 삭제 대상의 컬럼명 + /// 삭제 대상 + public void DB_Delete_No_Limit(string DB_Table, + string target_idx, string comp_idx, + string[] target_area, string[] target) + { + string cmd = string.Format("DELETE FROM {0} WHERE `{1}`= \"{2}\" AND", DB_Table, target_idx, comp_idx); + for(int a= 0; a < target_area.Length; a++) + { + cmd += string.Format("`{0}`=\"{1}\"", target_area[a], target[a]); + if (a != target_area.Length - 1) { cmd += " AND"; } + } + cmd += ";"; + using (conn) + { + conn.Open(); + MySqlTransaction tran = conn.BeginTransaction(); + sqlcmd.Connection = conn; + sqlcmd.Transaction = tran; + try + { + sqlcmd.CommandText = cmd; + sqlcmd.ExecuteNonQuery(); + + tran.Commit(); + } + catch(Exception e) + { + tran.Rollback(); + MessageBox.Show(e.ToString(), "Error"); + } + } + } + /// + /// 대상 컬럼 삭제 / DELETE FROM "DB_Table_Name" WHERE "target_idx"="comp_idx" AND "target_area"="target"; + /// + public void DB_Delete_More_term(string DB_Table_Name, + string target_idx, string comp_idx, + string[] target_area, string[] target) + { + string cmd = "DELETE FROM " + DB_Table_Name + " WHERE " + + "`" + target_idx + "`=\"" + comp_idx + "\" AND"; + for(int a = 0; a < target_area.Length; a++) + { + cmd += " `" + target_area[a] + "`=\"" + target[a] + "\" "; + if (a == target_area.Length - 1) { cmd += "LIMIT 1;"; } + else { cmd += "AND"; } + } + using (conn) + { + conn.Open(); + MySqlTransaction tran = conn.BeginTransaction(); + sqlcmd.Connection = conn; + sqlcmd.Transaction = tran; + try + { + sqlcmd.CommandText = cmd; + sqlcmd.ExecuteNonQuery(); + + tran.Commit(); + } + catch(Exception ex) + { + tran.Rollback(); + MessageBox.Show(ex.ToString(), "Error"); + } + } + } + /// + /// "UPDATE \"" + DB_Tabel_Name + "\" SET \"" + Edit_colum + "\"=\"" + Edit_Name + "\" WHERE \""+Search_Name+"\"=\"" + Search_Data + "\";" + /// + /// 테이블명 + /// 수정할 컬럼명 + /// 수정하고 싶은 문구 + /// 검색할 컬럼명 + /// 검색할 데이터 + public string DB_Update(string DB_Tabel_Name, string Edit_colum, string Edit_Name, string Search_Name, string Search_Data) + { + string cmd = "UPDATE `" + DB_Tabel_Name + "` SET `" + Edit_colum + "`=\"" + Edit_Name + "\" WHERE `"+Search_Name+"`=\"" + Search_Data + "\";"; + cmd = cmd.Replace("|", ""); + using (conn) + { + conn.Open(); + MySqlTransaction tran = conn.BeginTransaction(); + sqlcmd.Connection = conn; + sqlcmd.Transaction = tran; + + try + { + sqlcmd.CommandText = cmd; + sqlcmd.ExecuteNonQuery(); + + tran.Commit(); + } + catch(Exception ex) + { + tran.Rollback(); + MessageBox.Show(ex.ToString()); + } + } + return cmd; + } + /// + /// 많은 곳의 데이터를 변화시키고 싶을때. 테이블명을 제외하곤 다 배열. Edit와 Search끼리의 배열 인덱스값이 각자 서로 같아야함. + /// + /// 바꿀 데이터가 있는 테이블명 + /// Edit_name인덱스와 같아야함 + /// Edit_col인덱스와 같아야함 + /// Search_Name인덱스와 같아야함 + /// Search_col인덱스와 같아야함 + public void More_Update(String DB_Table_Name, + String[] Edit_col, String[] Edit_name, + String[] Search_col, String[] Search_Name) + { + string cmd = "UPDATE `" + DB_Table_Name + "` SET "; + for(int a = 0; a < Edit_col.Length; a++) + { + cmd += "`" + Edit_col[a] + "` = \"" + Edit_name[a] + "\""; + if (a != Edit_col.Length - 1) { cmd += ", "; } + else { cmd += " "; } + } + cmd += "WHERE "; + for(int a = 0; a < Search_col.Length; a++) + { + cmd += "`" + Search_col[a] + "` = \"" + Search_Name[a] + "\" "; + if (a != Search_col.Length - 1) { cmd += "AND "; } + } + cmd += ";"; + cmd = cmd.Replace("|", ""); + + using (conn) + { + conn.Open(); + MySqlTransaction tran = conn.BeginTransaction(); + sqlcmd.Connection = conn; + sqlcmd.Transaction = tran; + try + { + sqlcmd.CommandText = cmd; + sqlcmd.ExecuteNonQuery(); + tran.Commit(); + } + catch(Exception ex) + { + tran.Rollback(); + MessageBox.Show(ex.ToString()); + } + } + } + /// + /// DB에 회사이름을 검색하여 만약 있는 회사일 경우 False 반환 / 없을경우 True반환 + /// + /// 검색할 회사 명 + /// + public bool chk_comp(string Search_Data) + { + string cmd = "SELECT `comp_name` FROM `Comp`;"; + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + // 한줄씩 불러오기 + while (sd.Read()) + { + for (int cout = 0; cout < sd.FieldCount; cout++) + { + if(sd[cout].ToString() == Search_Data) { conn.Close(); return false; } + } + } + conn.Close(); + return true; + } + /// + /// SQL문을 직접 만들어서 작성하여 사용해야함. (단, DELETE문/UPDATE문은 사용하지말 것!) + /// + /// 등록할 SQL문 + /// + public string self_Made_Cmd(string cmd) + { + cmd = cmd.Replace("|", ""); + + string result = ""; + if(cmd.Contains("DELETE")==true || cmd.Contains("UPDATE") == true) { return ""; } + conn.Open(); + try + { + sqlcmd.CommandText = cmd; + sqlcmd.Connection = conn; + sd = sqlcmd.ExecuteReader(); + while (sd.Read()) + { + for (int cout = 0; cout < sd.FieldCount; cout++) + { + result += sd[cout].ToString() + "|"; + } + } + } + catch(Exception e) + { + MessageBox.Show("{0} Exception caught.\n"+ e.ToString()); + MessageBox.Show(cmd); + } + conn.Close(); + return result; + } + } +} diff --git a/ISBN_Check_test/Skill.cs b/ISBN_Check_test/Skill.cs new file mode 100644 index 0000000..39c1fc7 --- /dev/null +++ b/ISBN_Check_test/Skill.cs @@ -0,0 +1,613 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Net; +using System.IO; +using System.Web; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Script.Serialization; +using System.Xml; +using System.Windows.Forms; +using System.Reflection; +using Excel = Microsoft.Office.Interop.Excel; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using System.Text.RegularExpressions; + +namespace WindowsFormsApp1 +{ + /// + /// 여러 기능들이 추가될 예정. + /// Excel_to_DataGridView + /// + class Skill_Grid + { + /// + /// * Row헤더에 체크박스를 넣는 기능* + /// 사용불가. 복사해서 가져가고 사양에 맞춰 수정할 것. + /// + /// + /// + /// 체크박스를 넣을 컬럼 위치 + public void Add_Row_CheckBox(object sender, DataGridViewCellPaintingEventArgs e, int colCount) + { + if (e.ColumnIndex == colCount && e.RowIndex == -1) + { + string ori_name = ((DataGridView)sender).Name; + ((DataGridView)sender).Name = "Add_chkBox"; + e.PaintBackground(e.ClipBounds, false); + + Point pt = e.CellBounds.Location; + + int nChkBoxWidth = 15; + int nChkBoxHeight = 15; + int offsetX = (e.CellBounds.Width - nChkBoxWidth) / 2; + int offsetY = (e.CellBounds.Height - nChkBoxHeight) / 2; + + pt.X += offsetX; + pt.Y += offsetY; + + CheckBox cb = new CheckBox(); + cb.Size = new Size(nChkBoxWidth, nChkBoxHeight); + cb.Location = pt; + cb.CheckedChanged += new EventHandler(datagridview_checkBox_Click); + ((DataGridView)sender).Controls.Add(cb); + + e.Handled = true; + } + } + private void datagridview_checkBox_Click(object sender, EventArgs e) + { + foreach(DataGridViewRow r in ((DataGridView)sender).Rows) + { + r.Cells["chkbox"].Value = ((CheckBox)sender).Checked; + } + } + /// + /// 엑셀에서 복사한 데이터를 DataGirdView에 붙여넣어주는 코드 (단, KeyDown에 넣어야함!!!!) + /// 사전에 if ((e.Shift && e.KeyCode == Keys.Insert) || (e.Control && e.KeyCode == Keys.V))안에 들어가야함. + /// + /// KeyDown의 object "sender" + /// KeyDown의 KeyEventArgs "e" + public void Excel_to_DataGridView(object sender, KeyEventArgs e) + { + //if user clicked Shift+Ins or Ctrl+V (paste from clipboard) + if ((e.Shift && e.KeyCode == Keys.Insert) || (e.Control && e.KeyCode == Keys.V)) + { + char[] rowSplitter = { '\r', '\n' }; + char[] columnSplitter = { '\t' }; + + //get the text from clipboard + IDataObject dataInClipboard = Clipboard.GetDataObject(); + + string stringInClipboard = (string)dataInClipboard.GetData(DataFormats.Text); + //split it into lines + string[] rowsInClipboard = stringInClipboard.Split(rowSplitter, StringSplitOptions.RemoveEmptyEntries); + //get the row and column of selected cell in dataGridView1 + int r = ((DataGridView)sender).SelectedCells[0].RowIndex; + int c = ((DataGridView)sender).SelectedCells[0].ColumnIndex; + //add rows into dataGridView1 to fit clipboard lines + if (((DataGridView)sender).Rows.Count < (r + rowsInClipboard.Length)) + { + ((DataGridView)sender).Rows.Add(r + rowsInClipboard.Length - ((DataGridView)sender).Rows.Count); + } + // loop through the lines, split them into cells and place the values in the corresponding cell. + for (int iRow = 0; iRow < rowsInClipboard.Length; iRow++) + { + //split row into cell values + string[] valuesInRow = rowsInClipboard[iRow].Split(columnSplitter); + //cycle through cell values + for (int iCol = 0; iCol < valuesInRow.Length; iCol++) + { + //assign cell value, only if it within columns of the dataGridView1 + if (((DataGridView)sender).ColumnCount - 1 >= c + iCol) + { + ((DataGridView)sender).Rows[r + iRow].Cells[c + iCol].Value = valuesInRow[iCol]; + } + } + } + } + } + /// + /// DataGirdView의 활성화된 셀값을 삭제하는 코드 (단, KeyDown에 넣어야함!!!!) + /// 사전에 if(e.KeyCode == Keys.Delete)안에 들어가야함. + /// + /// KeyDown의 object "sender" + /// KeyDown의 KeyEventArgs "e" + public void DataGrid_to_Delete(object sender, KeyEventArgs e) + { + int rowIndex = ((DataGridView)sender).CurrentCell.RowIndex; + int columnIndex = ((DataGridView)sender).CurrentCell.ColumnIndex; + ((DataGridView)sender).Rows[rowIndex].Cells[columnIndex].Value = ""; + } + /// + /// 그리드 앞 머리말에 넘버를 표시 + /// + /// + /// + public void Print_Grid_Num(Object sender, DataGridViewRowPostPaintEventArgs e) + { + // RowPostPaint 이벤트 핸들러 + // 행헤더 열영역에 행번호를 위해 장방형으로 처리 + + 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); + } + /// + /// Grid에서 복사시 클립보드 글자깨짐방지 + /// 현재 효과없음 + /// + /// + /// + public void clipboard_not_crack(object sender, KeyEventArgs e) + { + Clipboard.SetDataObject(((DataGridView)sender).GetClipboardContent().GetText()); + } + /// + /// 엑셀 내보내기 + /// + /// 사용할 데이터 그리드뷰 + public void ExportToExcel(DataGridView datagridview) + { + Excel.Application excelApplication; + Excel._Workbook workbook; + Excel._Worksheet worksheet; + + excelApplication = new Excel.Application(); + + if (excelApplication == null) { + MessageBox.Show("엑셀이 설치되지 않았습니다"); + return; + } + + excelApplication.Visible = false; + + workbook = excelApplication.Workbooks.Add(Missing.Value); + worksheet = workbook.ActiveSheet as Excel._Worksheet; + + object[,] headerValueArray = new object[1, datagridview.ColumnCount]; + + int gap = 0; // 숨김처리된 컬럼 격차 줄이기 위한 변수 + // 헤더 출력 + for (int a = 0; a < datagridview.Columns.Count; a++) + { + if (datagridview.Columns[a].Visible == false) { gap++; continue; } + + headerValueArray[0, a - gap] = datagridview.Columns[a].HeaderText; + } + + Excel.Range startHeaderCell = worksheet.Cells[1, 1]; + Excel.Range endHeaderCell = worksheet.Cells[1, datagridview.ColumnCount - gap]; + + worksheet.get_Range( + startHeaderCell as object, endHeaderCell as object).Font.Bold = true; + worksheet.get_Range( + startHeaderCell as object, endHeaderCell as object).VerticalAlignment=Excel.XlVAlign.xlVAlignCenter; + worksheet.get_Range( + startHeaderCell as object, endHeaderCell as object).Value2 = headerValueArray; + + object[,] cellValueArray = new object[datagridview.RowCount, datagridview.ColumnCount]; + + gap = 0; + // 내용 출력 + for(int a = 0; a < datagridview.RowCount; a++) + { + for(int b = 0; b < datagridview.ColumnCount; b++) + { + if (datagridview.Columns[b].Visible == false) { gap++; continue; } + if (datagridview.Rows[a].Cells[b].ValueType.Name == "String") { + cellValueArray[a, b-gap] = "'" + datagridview.Rows[a].Cells[b].Value.ToString(); + } + else { + cellValueArray[a, b] = datagridview.Rows[a].Cells[b].Value; + } + } + } + + Excel.Range startCell = worksheet.Cells[2, 1]; + Excel.Range endCell = worksheet.Cells[datagridview.RowCount + 1, datagridview.ColumnCount-gap]; + worksheet.get_Range(startCell as object, endCell as object).Value2 = cellValueArray; + + excelApplication.Visible = true; + excelApplication.UserControl = true; + } + } + /// + /// 텍스트 관련 함수. + /// + class String_Text + { + /// + /// 텍스트박스 숫자만 입력받는 함수. KeyPress함수에 적용 + /// + /// + /// + public void Only_Int(object sender, KeyPressEventArgs e) + { + if(!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back))) + { + e.Handled = true; + } + } + /// + /// TextChanged이벤트 - 천단위 콤마찍어주기 + /// + /// object sender + /// EventArgs + public void Int_Comma(object sender, EventArgs e) + { + if (((TextBox)sender).Text != "") { + string text; + text = ((TextBox)sender).Text.Replace(",", ""); + ((TextBox)sender).Text = String.Format("{0:#,###}", Convert.ToInt32(text)); + ((TextBox)sender).SelectionStart = ((TextBox)sender).TextLength; + ((TextBox)sender).SelectionLength = 0; + } + } + /// + /// 문자열 내에 한글이 들어가는지 체크 + /// + /// 대상 문자열 + /// 한글 포함시 true + public bool isContainHangul(string value) + { + char[] charArr = value.ToCharArray(); + foreach(char c in charArr) + { + if (char.GetUnicodeCategory(c) == System.Globalization.UnicodeCategory.OtherLetter) + return true; + + } + return false; + } + /// + /// 대상 문자열안에 찾고 싶은 문자 찾기 + /// + /// 대상 문자열 + /// 찾고 싶은 문자 + /// 있을 경우 True반환 + public bool CheckString(string value, string chkString) + { + int index = value.IndexOf(chkString); + if (index < 0) + return false; + + return true; + } + public int Char_count(string value, char chkString) + { + string[] res = value.Split(chkString); + int count = res.Length; + return count - 1; + } + /// + /// 문자와 문자사이의 값 가져오기 + /// + /// 대상 문자열 + /// 시작 문자열 + /// 마지막 문자열 + /// 문자 사이값 + public string GetMiddelString(string str, string begin, string end) + { + if (string.IsNullOrEmpty(str)) + { + return null; + } + + string result = null; + if (str.IndexOf(begin) > -1) + { + str = str.Substring(str.IndexOf(begin) + begin.Length); + if (str.IndexOf(end) > -1) result = str.Substring(0, str.IndexOf(end)); + else result = str; + } + return result; + } + } + public class API + { + /// + /// https://blog.aladin.co.kr/openapi 참고 + /// + /// + /// + /// + /// + public string Aladin(string Query, string QueryType, string[] Param) + { + string result = string.Empty; + // 쿼리 생성 + string key = "ttbgloriabook1512001"; + string site = "http://www.aladin.co.kr/ttb/api/ItemSearch.aspx"; + string query = string.Format("{0}?query={1}&TTBKey={2}&output=xml&querytype={3}&MaxResults={4}", + site, Query, key, QueryType, 30.ToString()); + + // 쿼리를 입력인자로 WebRequest 개채 생성 + WebRequest request = WebRequest.Create(query); + + // WebRequest개체의 헤더에 인증키 포함시키기. + // request.Headers.Add("Authorization", header); + + // WebResponse개체를 통해 서비스 요청. + WebResponse response = request.GetResponse(); + + // 결과문자열 확인 + Stream stream = response.GetResponseStream(); + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + String xml = reader.ReadToEnd(); + stream.Close(); + // xml형식을 json형식으로 변환 + XmlDocument doc = new XmlDocument(); + doc.LoadXml(xml); + var json = JsonConvert.SerializeXmlNode(doc); + + // json형식 분석을 위해 JavaScriptSerializer 개체 생성 + JavaScriptSerializer js = new JavaScriptSerializer(); + + // 런타임에 개체를 확인하여 사용할수 있는 dynamic을 이용해 역직렬화 + dynamic dob = js.Deserialize(json); + + // "object"내에 있는것을 얻어오기 위해 다시 dynamic변수에 참조 + dynamic docs = ""; + try + { + docs = dob["object"]["item"]; + } + catch + { + return ""; + } + int length = 0; + int ID_length = Param.Length; + + // 검색 결과가 1개 이하일 경우, 오류가 발생하여 try/catch문 사용. + try + { + // docs는 요소 컬렉션으로 object로 변환. + object[] buf = docs; + length = buf.Length; + } + catch + { + object buf = docs; + length = 1; + } + for (int a = 0; a < length; a++) + { + List tmp_data = new List(); + for (int b = 0; b < ID_length; b++) + { + if (length == 1) + { + tmp_data.Add(docs[Param[b]]); + } + else + { + tmp_data.Add(docs[a][Param[b]]); + } + result += tmp_data[b] + "|"; + } + result += "\n"; + } + return result; + } + public string Naver(string[] Query, string[] QueryType, string[] Param) + { + string result = string.Empty; + string json = string.Empty; + // url 생성 + string url = "https://openapi.naver.com/v1/search/book_adv?"; + + for (int a = 0; a < Query.Length; a++) + { + url += string.Format("{0}={1}&", QueryType[a], Query[a]); + } + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + + request.Headers.Add("X-Naver-Client-Id", "wYr0JczCBoDopq1NKTyQ"); // 클라이언트 아이디 + request.Headers.Add("X-Naver-Client-Secret", "QHzeXadtO7"); // 클라이언트 시크릿 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + string status = response.StatusCode.ToString(); + if (status == "OK") + { + Stream stream = response.GetResponseStream(); + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + json = reader.ReadToEnd(); + } + else + { + MessageBox.Show(status, "Error"); + return "Error"; + } + + // json형식 분석을 위해 JavaScriptSerializer 개체 생성 + JavaScriptSerializer js = new JavaScriptSerializer(); + + // 런타임에 개체를 확인하여 사용할수 있는 dynamic을 이용해 역직렬화 + dynamic dob = js.Deserialize(json); + + // "object"내에 있는것을 얻어오기 위해 다시 dynamic변수에 참조 + dynamic docs = ""; + try + { + // docs = dob["object"]["item"]; + docs = dob["items"]; + } + catch + { + return ""; + } + int length = 0; + int ID_length = Param.Length; + + // 검색 결과가 1개 이하일 경우, 오류가 발생하여 try/catch문 사용. + try + { + // docs는 요소 컬렉션으로 object로 변환. + object[] buf = docs; + length = buf.Length; + } + catch + { + object buf = docs; + length = 1; + } + for (int a = 0; a < length; a++) + { + List tmp_data = new List(); + for (int b = 0; b < ID_length; b++) + { + tmp_data.Add(docs[a][Param[b]]); + result += tmp_data[b] + "|"; + } + result += "\n\t"; + } + return result; + } + public string Daum(string Query, string Type, string[] Param) + { + string result = string.Empty; + + // url생성 + string url = "https://dapi.kakao.com/v3/search/book"; + string query = string.Format("{0}?query={1}&target={2}&", url, Query, Type); + WebRequest request = WebRequest.Create(query); + + string rKey = "e3935565b731a2a6f32880c90d76403a"; + string header = "KakaoAK " + rKey; + + request.Headers.Add("Authorization", header); + + WebResponse response = request.GetResponse(); + Stream stream = response.GetResponseStream(); + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + string json = reader.ReadToEnd(); + stream.Close(); + + JavaScriptSerializer js = new JavaScriptSerializer(); + dynamic dob = js.Deserialize(json); + dynamic docs = dob["documents"]; + object[] buf = docs; + + int length = buf.Length; + int ID_length = Param.Length; + + for (int a = 0; a < length; a++) + { + List tmp_data = new List(); + for (int b = 0; b < ID_length; b++) + { + if (Param[b] == "authors") + { + object[] tmp = docs[a][Param[b]]; + string tmp_str = string.Empty; + for (int j = 0; j < tmp.Length; j++) + { + tmp_str += tmp[j]; + if (j < tmp.Length - 1) + { + tmp_str += ", "; + } + } + tmp_data.Add(tmp_str); + result += tmp_data[b] + "|"; + tmp_str = ""; + } + else + { + tmp_data.Add(docs[a][Param[b]]); + result += tmp_data[b] + "|"; + } + } + result += "\n"; + } + return result; + } + } + public class Skill_Search_Text + { + /// + /// 검색용 박스 제작 + /// + /// 제목 + /// 내용 + /// 검색할 문자열 + /// + public DialogResult InputBox(string title, string promptText, ref string value) + { + Form form = new Form(); + Label label = new Label(); + TextBox textBox = new TextBox(); + Button btnOk = new Button(); + Button btnCancel = new Button(); + form.Text = title; + label.Text = promptText; + textBox.Text = value; + btnOk.Text = "OK"; + btnCancel.Text = "Cancel"; + btnOk.DialogResult = DialogResult.OK; + btnCancel.DialogResult = DialogResult.Cancel; + label.SetBounds(9, 20, 372, 13); + textBox.SetBounds(12, 36, 372, 20); + btnOk.SetBounds(228, 72, 75, 23); + btnCancel.SetBounds(309, 72, 75, 23); + label.AutoSize = true; + textBox.Anchor = textBox.Anchor | AnchorStyles.Right; + btnOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + form.ClientSize = new Size(396, 107); + form.Controls.AddRange(new Control[] { label, textBox, btnOk, btnCancel }); + form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); + form.FormBorderStyle = FormBorderStyle.FixedDialog; + form.StartPosition = FormStartPosition.CenterScreen; + form.MinimizeBox = false; + form.MaximizeBox = false; + form.AcceptButton = btnOk; + form.CancelButton = btnCancel; + DialogResult dialogResult = form.ShowDialog(); + value = textBox.Text; + return dialogResult; + } + /// + /// 색상 변경함수(richTextBox에만 적용) + /// + /// + public void Color_change(string strTarget, RichTextBox richText) + { + Regex regex = new Regex(strTarget); + MatchCollection mc = regex.Matches(richText.Text); + richText.Select(0, richText.Text.Length); + richText.SelectionBackColor = Color.White; + + int ICursorPosition = richText.SelectionStart; + foreach (Match m in mc) + { + int istartidx = m.Index; + int istopidx = m.Length + 1; + int istopidx1 = m.Length; + + if (strTarget == "▼" || strTarget == "▲") { richText.Select(istartidx, istopidx); } + else { richText.Select(istartidx, istopidx1); } + + if (strTarget == "▼") { richText.SelectionColor = Color.Blue; } + else if (strTarget == "▲") { richText.SelectionColor = Color.Red; } + else { richText.SelectionBackColor = Color.Orange; } // TODO: 색상 변경될수 있음. + + richText.SelectionStart = ICursorPosition; + if (strTarget == "▼" || strTarget == "▲") { richText.SelectionColor = Color.Black; } + else { richText.SelectionBackColor = Color.Empty; } + } + } + } +} diff --git a/unimarc/.vs/unimarc/v16/.suo b/unimarc/.vs/unimarc/v16/.suo index efc38c1..4fc9683 100644 Binary files a/unimarc/.vs/unimarc/v16/.suo and b/unimarc/.vs/unimarc/v16/.suo differ diff --git a/unimarc/unimarc/Helper_DB.cs b/unimarc/unimarc/Helper_DB.cs new file mode 100644 index 0000000..d869c32 --- /dev/null +++ b/unimarc/unimarc/Helper_DB.cs @@ -0,0 +1,524 @@ +using System; +using System.Collections.Generic; +using System.IO.Ports; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using MySql.Data.MySqlClient; +using Renci.SshNet; + +namespace WindowsFormsApp1 +{ + /// + /// DB접속을 도와주는 클래스 + /// + class Helper_DB + { + // 접속 + MySqlConnection conn; + + // 쿼리 + MySqlCommand sqlcmd = new MySqlCommand(); + MySqlDataReader sd; + + public string comp_idx { get; internal set; } + + /// + /// DB를 사용하고 싶을 때 미리 저장된 DB의 기본 접속정보를 이용하여 DB에 접근한다. + /// + public void DBcon() // DB접속 함수 + { + PasswordConnectionInfo connectionInfo = new PasswordConnectionInfo("1.215.250.130", 815, "gloriabook", "admin@!@#$"); + connectionInfo.Timeout = TimeSpan.FromSeconds(30); + using (var client = new SshClient(connectionInfo)) + { + client.Connect(); + if (client.IsConnected) + { + string strConnection = "Server=1.215.250.130;" + + "Port=3306;" + + "Database=unimarc;" + + "uid=root;" + + "pwd=Admin21234;"; + conn = new MySqlConnection(strConnection); + } + } + } + /// + /// 국중DB를 사용하고 싶을 때 미리 저장된 DB의 기본 접속정보를 이용하여 DB에 접근한다. + /// + public void DBcon_cl() // DB접속 함수 + { + PasswordConnectionInfo connectionInfo = new PasswordConnectionInfo("1.215.250.130", 815, "gloriabook", "admin@!@#$"); + connectionInfo.Timeout = TimeSpan.FromSeconds(30); + using (var client = new SshClient(connectionInfo)) + { + client.Connect(); + if (client.IsConnected) + { + string strConnection = "Server=1.215.250.130;" + + "Port=3306;" + + "Database=cl_marc;" + + "uid=root;" + + "pwd=Admin21234;"; + conn = new MySqlConnection(strConnection); + } + } + } + public string DB_Send_CMD_Search(string cmd) + { + // DB 연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + string result = ""; + string change; + // 한줄씩 불러와 한개의 값으로 변환 + while (sd.Read()) + { + for (int count = 0; count < sd.FieldCount; count++) + { + change = sd[count].ToString().Replace("|", ""); + result += change + "|"; + } + } + conn.Close(); + return result; + } + public void DB_Send_CMD_reVoid(string cmd) + { + using (conn) + { + conn.Open(); + MySqlTransaction tran = conn.BeginTransaction(); + sqlcmd.Connection = conn; + sqlcmd.Transaction = tran; + try + { + sqlcmd.CommandText = cmd; + sqlcmd.ExecuteNonQuery(); + tran.Commit(); + } + catch (Exception ex) + { + tran.Rollback(); + MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + /// + /// DBcon이 선진행되어야함. + /// SELECT * FROM [DB_Table_Name] WHERE [DB_Where_Table] LIKE \"%DB_Search_Data%\" + /// + /// 이용자 회사의 idx번호 단.none일 경우 다른 DB를 가져옴 + /// 테이블명 + /// 검색할 테이블 + /// 검색할 텍스트 + /// 검색된 결과값이 반환됨. + public string DB_Contains(string DB_Table_Name, string compidx, + string DB_Where_Table = "", string DB_Search_Data = "", + string Search_col = "", + string DB_Where_Table1 = "", string DB_Search_Data1 = "" ) + { + string cmd = "SELECT "; + if (Search_col == "") { cmd += "*"; } + else { cmd += Search_col; } + cmd += " FROM "; + cmd += DB_Table_Name; + if (DB_Table_Name == "Obj_List") { cmd += " WHERE `comp_num` = \"" + compidx + "\""; } + else if (DB_Table_Name == "Client") { cmd += " WHERE `campanyidx` = \"" + compidx + "\""; } + else if (DB_Table_Name == "Purchase") { cmd += " WHERE `comparyidx` = \"" + compidx + "\""; } + else if(compidx == "none") { cmd += " WHERE `grade` = \"2\""; } + else { cmd += " WHERE `compidx` = \"" + compidx + "\""; } + + if(DB_Search_Data != "") + { + cmd += " AND "+ DB_Where_Table + " LIKE\"%" + DB_Search_Data + "%\""; + } + if(DB_Search_Data1 != "") + { + cmd += " AND "+ DB_Where_Table1 + " LIKE\"%" + DB_Search_Data1 + "%\""; + } + cmd += ";"; + return cmd; + } + /// + /// DBcon이 선진행되어야함. / SELECT * FROM DB_Table_Name WHERE DB_Where_Table = \"DB_Search_Data\"; + /// + /// 가져올 데이터의 위치 + /// 테이블명 + /// 검색할 테이블 + /// 검색할 텍스트 + /// 검색된 결과값이 반환됨. + public string DB_Select_Search(string Search_Area, string DB_Table_Name, + string DB_Where_Table = "", string DB_Search_Data = "", + string DB_Where_Table1 = "", string DB_Search_Data1 = "") + { + string cmd = string.Format("SELECT {0} FROM ", Search_Area); + cmd += DB_Table_Name; + if(DB_Where_Table != "" && DB_Search_Data != "") + { + cmd += string.Format(" WHERE `{0}` = \"{1}\"", DB_Where_Table, DB_Search_Data); + } + if(DB_Where_Table1 != "" && DB_Search_Data1 != "") + { + cmd += string.Format(" AND `{0}` = \"{1}\"", DB_Where_Table1, DB_Search_Data1); + } + cmd += ";"; + return cmd; + } + /// + /// DBcon이 선진행되어야함. / SELECT * FROM DB_Table_Name WHERE DB_Where_Table = \"DB_Search_Data\"; + /// + /// 테이블명 + /// 검색할 테이블 + /// 검색할 텍스트 + /// 검색된 결과값이 반환됨. + public string DB_Search(string DB_Table_Name, + string DB_Where_Table = "", string DB_Search_Data = "", + string DB_Where_Table1 = "", string DB_Search_Data1 = "") + { + string cmd = "SELECT * FROM "; + cmd += DB_Table_Name;// + " where id=\"id\""; + if(DB_Search_Data != "") + { + cmd += " WHERE "+ DB_Where_Table + "=\"" + DB_Search_Data +"\""; + } + if (DB_Where_Table1 != "" && DB_Search_Data1 != "") + { + cmd += " AND `" + DB_Where_Table1 + "` =\"" + DB_Search_Data1 + "\""; + } + cmd += ";"; + return cmd; + } + /// + /// 여러 조건이 있을때 사용 (단, Where_Table과 Search_Date의 배열길이는 같아야함) + /// + /// + /// + /// + /// 추출할 열의 이름."`num1`, `num2`" 이런식으로 + /// + public string More_DB_Search(String DB_Table_Name, String[] DB_Where_Table, + String[] DB_Search_Data, String Search_Table = "") + { + if(DB_Where_Table.Length != DB_Search_Data.Length) { return "오류발생"; } + string cmd = "SELECT "; + if(Search_Table == "") { cmd += "*"; } + else { cmd += Search_Table; } + cmd += " FROM " + DB_Table_Name + " WHERE "; + for(int a = 0; a < DB_Where_Table.Length; a++) + { + cmd += "`" + DB_Where_Table[a] + "` = \"" + DB_Search_Data[a] + "\" "; + if(a == DB_Where_Table.Length - 1) { cmd += ";"; } + else { cmd += " AND "; } + } + return cmd; + } + /// + /// DB상의 날짜의 사이값을 가져오기 위한 함수 + /// + /// 가져올 테이블의 이름 + /// 프로그램상으로 가져올 DB데이터 + /// DB상의 날짜가 저장된 컬럼명 + /// 시작할 날짜 0000-00-00 + /// 끝낼 날짜 0000-00-00 + /// 회사 인덱스 main.com_idx + /// + public string Search_Date(string Table_name, string Search_Table, string Search_date, + string start_date, string end_date, string compidx) + { + if (Search_Table == "") { Search_Table = "*"; } + // select * from `table_name` where `날짜 컬럼` between date('start_date') and date('end_date')+1; + string cmd = "SELECT " + Search_Table + " FROM `" + Table_name + "` " + + "WHERE `comp_num` = '" + compidx + "' AND `" + + Search_date + "` >= '" + start_date + "'"; + if(Table_name != "Obj_List") { cmd = cmd.Replace("`comp_num`", "`compidx`"); } + if (end_date != "") { cmd += " AND `" + Search_date + "` <= '" + end_date + "';"; } + else { cmd += ";"; } + return cmd; + } + public string DB_INSERT(String DB_Table_name, String[] DB_col_name, String[] setData) + { + string cmd = "INSERT INTO " + DB_Table_name + "("; + for(int a = 0; a < DB_col_name.Length; a++) + { + if (a == DB_col_name.Length - 1) { cmd += "`" + DB_col_name[a] + "`) "; } + else { cmd += "`" + DB_col_name[a] + "`, "; } + } + cmd += "values("; + for(int a = 0; a < setData.Length; a++) + { + setData[a] = setData[a].Replace("\"", "\"\""); + if (a == setData.Length - 1) { cmd += "\"" + setData[a] + "\")"; } + else { cmd += "\"" + setData[a] + "\", "; } + } + cmd += ";"; + cmd = cmd.Replace("|", ""); + return cmd; + } + public string DB_INSERT_SUB(string value, string[] setData) + { + string cmd = string.Format("("); + if (value == "") + { + for (int a = 0; a < setData.Length; a++) + { + if (a == setData.Length - 1) { cmd += "`" + setData[a] + "`) "; } + else { cmd += "`" + setData[a] + "`, "; } + } + return cmd; + } + for (int a = 0; a < setData.Length; a++) + { + setData[a] = setData[a].Replace("\"", "\"\""); + if (a == setData.Length - 1) { cmd += "\"" + setData[a] + "\")"; } + else { cmd += "\"" + setData[a] + "\", "; } + } + return cmd; + } + /// + /// 대상 컬럼 삭제 / DELETE FROM "DB_Table_Name" WHERE "target_idx"="comp_idx" AND "target_area"="target"; + /// + /// 삭제할 대상이 있는 테이블명 + /// 인덱스 대상이 있는 열명 + /// 삭제할 대상의 인덱스 + /// 삭제할 대상이 있는 열명 + /// 삭제할 대상 + public string DB_Delete(string DB_Table_Name, + string target_idx, string comp_idx, + string target_area, string target) + { + string cmd = "DELETE FROM " + DB_Table_Name + " WHERE " + + "`" + target_idx + "`=\"" + comp_idx + "\" AND" + + "`" + target_area + "`=\"" + target + "\" LIMIT 1;"; + return cmd; + } + /// + /// 대상 컬럼 삭제(리미트 없음) / DELETE FROM "DB_Table_Name" WHERE "target_idx"="comp_idx" AND "target_area"="target"; + /// + /// 대상 테이블명 + /// 회사 인덱스 컬럼명 + /// 회사 인덱스 + /// 삭제 대상의 컬럼명 + /// 삭제 대상 + public string DB_Delete_No_Limit(string DB_Table, + string target_idx, string comp_idx, + string[] target_area, string[] target) + { + string cmd = string.Format("DELETE FROM {0} WHERE `{1}`= \"{2}\" AND", DB_Table, target_idx, comp_idx); + for(int a= 0; a < target_area.Length; a++) + { + cmd += string.Format("`{0}`=\"{1}\"", target_area[a], target[a]); + if (a != target_area.Length - 1) { cmd += " AND"; } + } + cmd += ";"; + return cmd; + } + /// + /// 대상 컬럼 삭제 / DELETE FROM "DB_Table_Name" WHERE "target_idx"="comp_idx" AND "target_area"="target"; + /// + public string DB_Delete_More_term(string DB_Table_Name, + string target_idx, string comp_idx, + string[] target_area, string[] target) + { + string cmd = "DELETE FROM " + DB_Table_Name + " WHERE " + + "`" + target_idx + "`=\"" + comp_idx + "\" AND"; + for(int a = 0; a < target_area.Length; a++) + { + cmd += " `" + target_area[a] + "`=\"" + target[a] + "\" "; + if (a == target_area.Length - 1) { cmd += "LIMIT 1;"; } + else { cmd += "AND"; } + } + return cmd; + } + /// + /// "UPDATE \"" + DB_Tabel_Name + "\" SET \"" + Edit_colum + "\"=\"" + Edit_Name + "\" WHERE \""+Search_Name+"\"=\"" + Search_Data + "\";" + /// + /// 테이블명 + /// 수정할 컬럼명 + /// 수정하고 싶은 문구 + /// 검색할 컬럼명 + /// 검색할 데이터 + public string DB_Update(string DB_Tabel_Name, string Edit_colum, string Edit_Name, string Search_Name, string Search_Data) + { + string cmd = "UPDATE `" + DB_Tabel_Name + "` SET `" + Edit_colum + "`=\"" + Edit_Name + "\" WHERE `"+Search_Name+"`=\"" + Search_Data + "\";"; + cmd = cmd.Replace("|", ""); + return cmd; + } + /// + /// 많은 곳의 데이터를 변화시키고 싶을때. 테이블명을 제외하곤 다 배열. Edit와 Search끼리의 배열 인덱스값이 각자 서로 같아야함. + /// + /// 바꿀 데이터가 있는 테이블명 + /// 대상 테이블명 + /// 바꿀 데이터값 + /// 대상 테이블명 + /// 대상 데이터값 + public string More_Update(String DB_Table_Name, + String[] Edit_col, String[] Edit_name, + String[] Search_col, String[] Search_Name, int limit = 0) + { + string cmd = "UPDATE `" + DB_Table_Name + "` SET "; + for(int a = 0; a < Edit_col.Length; a++) + { + Edit_name[a] = Edit_name[a].Replace("\"", "\"\""); + cmd += "`" + Edit_col[a] + "` = \"" + Edit_name[a] + "\""; + if (a != Edit_col.Length - 1) { cmd += ", "; } + else { cmd += " "; } + } + cmd += "WHERE "; + for(int a = 0; a < Search_col.Length; a++) + { + cmd += "`" + Search_col[a] + "` = \"" + Search_Name[a] + "\" "; + if (a != Search_col.Length - 1) { cmd += "AND "; } + } + if(limit != 0) { cmd += string.Format("LIMIT {0}", limit); } + cmd += ";"; + cmd = cmd.Replace("|", ""); + return cmd; + } + /// + /// DB에 회사이름을 검색하여 만약 있는 회사일 경우 False 반환 / 없을경우 True반환 + /// + /// 검색할 회사 명 + /// + public bool chk_comp(string Search_Data) + { + string cmd = "SELECT `comp_name` FROM `Comp`;"; + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + // 한줄씩 불러오기 + while (sd.Read()) + { + for (int cout = 0; cout < sd.FieldCount; cout++) + { + if(sd[cout].ToString() == Search_Data) { conn.Close(); return false; } + } + } + conn.Close(); + return true; + } + /// + /// SQL문을 직접 만들어서 작성하여 사용해야함. (단, DELETE문/UPDATE문은 사용하지말 것!) + /// + /// 등록할 SQL문 + /// + public string self_Made_Cmd(string cmd) + { + cmd = cmd.Replace("|", ""); + + string result = ""; + if (cmd.Contains("DELETE") == true || cmd.Contains("UPDATE") == true) { return ""; } + conn.Open(); + try + { + sqlcmd.CommandText = cmd; + sqlcmd.Connection = conn; + sd = sqlcmd.ExecuteReader(); + while (sd.Read()) + { + for (int cout = 0; cout < sd.FieldCount; cout++) + { + result += sd[cout].ToString() + "|"; + } + } + } + catch(Exception e) + { + MessageBox.Show("{0} Exception caught.\n"+ e.ToString()); + MessageBox.Show(cmd); + } + conn.Close(); + return result; + } + + #region 추가 + + /// + /// DBcon이 선진행되어야함. / SELECT * FROM DB_Table_Name WHERE DB_Where_Table = \"DB_Search_Data\"; + /// + /// 테이블명 + /// 검색할 테이블 + /// 검색할 텍스트 + /// 검색된 결과값이 반환됨. + public string DB_Search_Author(string DB_Table_Name, string Search_Area, string DB_Where_Table, string DB_Search_Data) + { + if (Search_Area == "") { Search_Area = "*"; } + + string result = ""; + // SELECT * FROM `Author_Symbol` WHERE `Author` <= '겐서' ORDER BY `Author` DESC LIMIT 1 + string cmd = string.Format("SELECT `{0}` FROM `{1}` WHERE `{2}` <= \'{3}\' ORDER BY `{2}` DESC LIMIT 1;", + Search_Area, DB_Table_Name, DB_Where_Table, DB_Search_Data); + + // DB연결 + conn.Open(); + // 쿼리 맵핑 + sqlcmd.CommandText = cmd; + // 쿼리 날릴 곳은 conn, 즉 아까 연결한 DB + sqlcmd.Connection = conn; + // 쿼리 날리기, sqlDataReader에 결과값 저장 + sd = sqlcmd.ExecuteReader(); + // 한줄씩 불러오기 + while (sd.Read()) + { + for (int cout = 0; cout < sd.FieldCount; cout++) + { + result += sd[cout].ToString() + "|"; + } + } + conn.Close(); + return result; + } + + /// + /// insert선 실행. 만약 값이 있을 경우 update로 전환 + /// + /// + /// + /// + /// + public string DB_INSERT_DUPLICATE(string Table, string[] InsertCol, string[] InsertData) + { + string cmd = "INSERT INTO " + Table + "("; + for (int a = 0; a < InsertCol.Length; a++) + { + if (a == InsertCol.Length - 1) { cmd += "`" + InsertCol[a] + "`) "; } + else { cmd += "`" + InsertCol[a] + "`, "; } + } + cmd += "values("; + for (int a = 0; a < InsertData.Length; a++) + { + InsertData[a] = InsertData[a].Replace("\"", "\"\""); + if (a == InsertData.Length - 1) { cmd += "\"" + InsertData[a] + "\")"; } + else { cmd += "\"" + InsertData[a] + "\", "; } + } + cmd = cmd.Replace("|", ""); + + cmd += "ON DUPLICATE KEY UPDATE"; + + string sub_cmd = ""; + for (int a = 0; a < InsertCol.Length; a++) + { + if (a == InsertCol.Length - 1) + sub_cmd += string.Format("`{0}` = \"{1}\";", InsertCol[a], InsertData[a]); + else + sub_cmd += string.Format("`{0}` = \"{1}\",", InsertCol[a], InsertData[a]); + } + cmd += sub_cmd; + + return cmd; + } + #endregion + } +} diff --git a/unimarc/unimarc/Skill.cs b/unimarc/unimarc/Skill.cs new file mode 100644 index 0000000..a40fa9a --- /dev/null +++ b/unimarc/unimarc/Skill.cs @@ -0,0 +1,3402 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Net; +using System.IO; +using System.Web; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Script.Serialization; +using System.Xml; +using System.Windows.Forms; +using System.Reflection; +using Excel = Microsoft.Office.Interop.Excel; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using UniMarc.BaroService_API; +using System.Text.RegularExpressions; +using System.Drawing.Printing; +using System.ComponentModel; + +namespace WindowsFormsApp1 +{ + #region TestComparer + + public class DGVComparer : System.Collections.IComparer + { + public int Compare(object x, object y) + { + DataGridViewRow row1 = (DataGridViewRow)x; + DataGridViewRow row2 = (DataGridViewRow)y; + + int compareResult = string.Compare( + (string)row1.Cells[0].Value, + (string)row2.Cells[0].Value); + + if (compareResult == 0) + compareResult = ((int)row1.Cells[1].Value).CompareTo((int)row2.Cells[1].Value); + + return compareResult; + } + } + + #endregion + + /// + /// 여러 기능들이 추가될 예정. + /// Excel_to_DataGridView + /// + class Skill_Grid + { + + /// + /// 숫자형 정렬이 필요할때 쓰는 함수. + /// + /// + /// + /// + public void dataGridView_SortCompare(object sender, DataGridViewSortCompareEventArgs e, string ColumnName) + { + if (e.Column.Name.Equals(ColumnName)) + { + int a = int.Parse(e.CellValue1.ToString()); + int b = int.Parse(e.CellValue2.ToString()); + e.SortResult = a.CompareTo(b); + e.Handled = true; + } + } + + /// + /// Grid 정렬 CellClick => if (e.RowIndex < 0) 안에 들어가야함. + /// + /// 사용할 데이터 그리드 뷰 + /// 클릭시 나오는 e.ColumnIndex + public void Grid_Sort(DataGridView dataGridView, int col) + { + if (System.ComponentModel.ListSortDirection.Ascending == 0) + dataGridView.Sort(dataGridView.Columns[col], System.ComponentModel.ListSortDirection.Descending); + + else + dataGridView.Sort(dataGridView.Columns[col], System.ComponentModel.ListSortDirection.Ascending); + + + } + /// + /// * Row헤더에 체크박스를 넣는 기능* + /// *설정오류* 복사해서 사용할것. + /// + /// + /// + /// 체크박스를 넣을 컬럼 위치 + public void Add_Row_CheckBox(DataGridView sender, DataGridViewCellPaintingEventArgs e, int colCount) + { + if (e.ColumnIndex == colCount && e.RowIndex == -1) + { + e.PaintBackground(e.ClipBounds, false); + + Point pt = e.CellBounds.Location; + + int nChkBoxWidth = 15; + int nChkBoxHeight = 15; + int offsetX = (e.CellBounds.Width - nChkBoxWidth) / 2; + int offsetY = (e.CellBounds.Height - nChkBoxHeight) / 2; + + pt.X += offsetX; + pt.Y += offsetY; + + CheckBox cb = new CheckBox(); + cb.Size = new Size(nChkBoxWidth, nChkBoxHeight); + cb.Location = pt; + cb.CheckedChanged += new EventHandler(datagridview_checkBox_Click); + sender.Controls.Add(cb); + + e.Handled = true; + } + } + private void datagridview_checkBox_Click(object sender, EventArgs e) + { + foreach(DataGridViewRow r in ((DataGridView)sender).Rows) + { + r.Cells["colCheck"].Value = ((CheckBox)sender).Checked; + } + } + /// + /// 엑셀에서 복사한 데이터를 DataGirdView에 붙여넣어주는 코드 (단, KeyDown에 넣어야함!!!!) + /// + /// KeyDown의 object "sender" + /// KeyDown의 KeyEventArgs "e" + public void Excel_to_DataGridView(object sender, KeyEventArgs e) + { + //if user clicked Shift+Ins or Ctrl+V (paste from clipboard) + if ((e.Shift && e.KeyCode == Keys.Insert) || (e.Control && e.KeyCode == Keys.V)) + { + char[] rowSplitter = { '\r', '\n' }; + char[] columnSplitter = { '\t' }; + + //get the text from clipboard + IDataObject dataInClipboard = Clipboard.GetDataObject(); + + string stringInClipboard = (string)dataInClipboard.GetData(DataFormats.Text); + //split it into lines + string[] rowsInClipboard = stringInClipboard.Split(rowSplitter, StringSplitOptions.RemoveEmptyEntries); + //get the row and column of selected cell in dataGridView1 + int r = ((DataGridView)sender).SelectedCells[0].RowIndex; + int c = ((DataGridView)sender).SelectedCells[0].ColumnIndex; + //add rows into dataGridView1 to fit clipboard lines + if (((DataGridView)sender).Rows.Count < (r + rowsInClipboard.Length)) + { + ((DataGridView)sender).Rows.Add(r + rowsInClipboard.Length - ((DataGridView)sender).Rows.Count); + } + // loop through the lines, split them into cells and place the values in the corresponding cell. + for (int iRow = 0; iRow < rowsInClipboard.Length; iRow++) + { + //split row into cell values + string[] valuesInRow = rowsInClipboard[iRow].Split(columnSplitter); + //cycle through cell values + for (int iCol = 0; iCol < valuesInRow.Length; iCol++) + { + //assign cell value, only if it within columns of the dataGridView1 + if (((DataGridView)sender).ColumnCount - 1 >= c + iCol) + { + ((DataGridView)sender).Rows[r + iRow].Cells[c + iCol].Value = valuesInRow[iCol]; + } + } + } + } + } + /// + /// DataGirdView의 활성화된 셀값을 삭제하는 코드 (단, KeyDown에 넣어야함!!!!) + /// 사전에 if(e.KeyCode == Keys.Delete)안에 들어가야함. + /// + /// KeyDown의 object "sender" + /// KeyDown의 KeyEventArgs "e" + public void DataGrid_to_Delete(object sender, KeyEventArgs e) + { + int rowIndex = ((DataGridView)sender).CurrentCell.RowIndex; + int columnIndex = ((DataGridView)sender).CurrentCell.ColumnIndex; + ((DataGridView)sender).Rows[rowIndex].Cells[columnIndex].Value = ""; + } + /// + /// RowPostPaint 이벤트 핸들러 + /// 그리드 앞 머리말에 넘버를 표시 + /// + /// + /// + public void Print_Grid_Num(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); + } + /// + /// Grid에서 복사시 클립보드 글자깨짐방지 + /// 현재 효과없음 + /// + /// + /// + public void clipboard_not_crack(object sender, KeyEventArgs e) + { + Clipboard.SetDataObject(((DataGridView)sender).GetClipboardContent().GetText()); + } + + + #region DataGridView 드래그 행이동 이벤트 함수 + private Rectangle dragBoxFromMouseDown; + private int rowIndexFromMouseDown; + private int rowIndexOfItemUnderMouseToDrop; + + public void MouseMove(object sender, MouseEventArgs e) + { + DataGridView dataGridView = sender as DataGridView; + + if ((e.Button & MouseButtons.Left) == MouseButtons.Left) + { + if (dragBoxFromMouseDown != Rectangle.Empty && !dragBoxFromMouseDown.Contains(e.X, e.Y)) + { + DragDropEffects dropEffect = dataGridView.DoDragDrop(dataGridView.Rows[rowIndexFromMouseDown], DragDropEffects.Move); + } + } + } + + public void MouseDown(object sender, MouseEventArgs e) + { + DataGridView dataGridView = sender as DataGridView; + rowIndexFromMouseDown = dataGridView.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; + } + + public void DragOver(object sender, DragEventArgs e) + { + e.Effect = DragDropEffects.Move; + } + + public void DragDrop(object sender, DragEventArgs e) + { + DataGridView dataGridView = sender as DataGridView; + + Point clientPoint = dataGridView.PointToClient(new Point(e.X, e.Y)); + + rowIndexOfItemUnderMouseToDrop = dataGridView.HitTest(clientPoint.X, clientPoint.Y).RowIndex; + + if (e.Effect == DragDropEffects.Move) + { + DataGridViewRow rowToMove = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow; + dataGridView.Rows.RemoveAt(rowIndexFromMouseDown); + dataGridView.Rows.Insert(rowIndexOfItemUnderMouseToDrop, rowToMove); + } + } + + #endregion + } + class Excel_text + { + /// + /// 주문관리 - Excel로 주문서 작성하는 노가다코드 + /// + /// Grid상 선택된 데이터가 해당 배열변수에 들어감 + /// Grid상 선택된 데이터중 개수의 합계 + /// 사용자가 소속된 회사 인덱스 + /// 주문처명 + /// 엑셀 밑부분에 붙힐 참고사항 + /// 생성된 파일명 + public string mk_Excel_Order(string[,] data, int[] total, string compidx, string Pur, string PS) + { + Helper_DB db = new Helper_DB(); + db.DBcon(); + + if (Pur == "") { MessageBox.Show("입력된 주문처가 없습니다!"); return "False"; } + + string Area = "`comp_name`, `tel`, `fax`, `bubin`, `uptae`, " + + "`jongmok`, `addr`, `boss`, `email`, `barea`"; + + string Pur_Area = "`tel`, `fax`, `emchk`"; + + string cmd1 = db.DB_Select_Search(Area, "Comp", "idx", compidx); + string cmd2 = db.DB_Select_Search(Pur_Area, "Purchase", "sangho", Pur); + + string db_res1 = db.DB_Send_CMD_Search(cmd1); + string db_res2 = db.DB_Send_CMD_Search(cmd2); + + string[] db_data = db_res1.Split('|'); + string[] db_pur = db_res2.Split('|'); + + if (db_res1.Length < 3) { + MessageBox.Show("DB호출 에러!", "Error"); + return "False"; + } + string tel = string.Empty; + string fax = string.Empty; + string emchk = string.Empty; + + if (db_pur.Length > 3) { + for(int a= 0; a < db_pur.Length; a++) + { + if (a % 3 == 0) { // 전화번호 + if (db_pur[a] != "") { + tel = db_pur[a]; + } + } + if (a % 3 == 1) { // 팩스 + if (db_pur[a] != "") { + fax = db_pur[a]; + } + } + if (a % 3 == 2) { // 팩스 이메일 체크 + emchk = db_pur[a]; + } + } + } + try + { + string tempPath = Application.StartupPath + "\\Excel"; + DirectoryInfo di = new DirectoryInfo(tempPath); + if (!di.Exists) { di.Create(); } + + Excel.Application application = new Excel.Application(); // Excel Application Create + // application.Visible = true; // true 일시 엑셀이 작업되는 내용이 보임 + // application.Interactive = false; // false일 경우 유저의 조작에 방해받지않음. + + Excel._Workbook wb = (Excel._Workbook)(application.Workbooks.Add(Missing.Value)); // 워크북 생성 + Excel._Worksheet ws = (Excel._Worksheet)application.ActiveSheet; // 시트 가져옴 + Excel.PageSetup ps = ws.PageSetup; + + ps.LeftMargin = 0.64; + ps.RightMargin = 0.64; + ps.TopMargin = 1.91; + ps.BottomMargin = 1.91; + + Excel.Range rng = null; // 셀 처리 변수 + Excel.Range rng2 = null; // 셀 처리 변수2 + + // 발신자 정보 + string compname = db_data[0]; + string Snum = db_data[1]; + string Sfax = db_data[2]; + string Scompnum = db_data[3]; + string 업태 = db_data[4]; + string 종목 = db_data[5]; + string 주소 = db_data[6]; + string 대표 = db_data[7]; + string 이메일 = db_data[8]; + string[] barea = { "한국출판물류", "드 림 날 개", "모든배본대행", db_data[9] }; + + // 수신자 정보 + string taker = Pur; + string Tnum = tel; + string Tfax = fax; + + // 엑셀 파일 이름 설정 + string now = DateTime.Now.ToString("yy-MM-dd-HH-mm"); + string FileName = string.Format("{0}_{1}_{2}_{3}.xlsx", now.Replace("-", ""), emchk, Pur, db_data[0]); + MessageBox.Show(FileName); + + // 엑셀 파일 저장 경로 + string Savepath = Path.Combine(tempPath, FileName); + + #region 엑셀 베이스 (셀의 너비, 높이 설정) + ws.Columns[1].ColumnWidth = 3; // A + ws.Columns[2].ColumnWidth = 12; // B + ws.Columns[3].ColumnWidth = 28; // C + ws.Columns[4].ColumnWidth = 9; // D + ws.Columns[5].ColumnWidth = 4; // E + ws.Columns[6].ColumnWidth = 9; // F + ws.Columns[7].ColumnWidth = 12; // G + + ws.Rows[1].RowHeight = 16.5; + ws.Rows[2].RowHeight = 30; + ws.Rows[3].RowHeight = 10; + ws.Rows[4].RowHeight = 22; + ws.Rows[5].RowHeight = 22; + ws.Rows[6].RowHeight = 22; + ws.Rows[7].RowHeight = 22; + ws.Rows[8].RowHeight = 22; + ws.Rows[9].RowHeight = 16.5; + ws.Rows[10].RowHeight = 24; + #endregion + + rng = ws.Range["A4", "G8"]; + rng.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; + + // 제목 셀 + rng = ws.Range["A2", "G2"]; + rng.MergeCells = true; + rng.Value2 = "도 서 주 문 서"; + rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + rng.Font.Bold = true; + rng.Font.Size = 22; + + // 기본 정보 입력칸 + #region 주문일자 / 보낸곳 (4행) + rng = ws.Range["A4", "C4"]; + rng.MergeCells = true; + rng.Value2 = "주문일자 : "+DateTime.Now.ToString("yyyy-MM-dd H:m:ss"); + rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng.Font.Bold = true; + + rng2 = ws.Range["D4", "G4"]; + rng2.MergeCells = true; + rng2.Value2 = "보낸곳 : " + compname; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng2.Font.Bold = true; + rng2.Font.Size = 14; + #endregion + + #region 받는곳 / 보낸곳 전화번호 (5행) + rng = ws.Range["A5", "C5"]; + rng.MergeCells = true; + rng.Value2 = "받 는 곳 : " + taker; + rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng.Font.Bold = true; + + rng2 = ws.Range["D5", "G5"]; + rng2.MergeCells = true; + rng2.Value2 = "전화번호 : " + Snum; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng2.Font.Bold = true; + #endregion + + #region 받는곳 전화번호 / 보낸곳 팩스번호 (6행) + rng = ws.Range["A6", "C6"]; + rng.MergeCells = true; + rng.Value2 = "전화번호 : " + Tnum; + rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng.Font.Bold = true; + + rng2 = ws.Range["D6", "G6"]; + rng2.MergeCells = true; + rng2.Value2 = "팩스 : " + Sfax; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng2.Font.Bold = true; + #endregion + + #region 받는곳 팩스번호 / 보낸곳 사업자등록번호 (7행) + rng = ws.Range["A7", "C7"]; + rng.MergeCells = true; + rng.Value2 = "팩스 : " + Tfax; + rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng.Font.Bold = true; + + rng2 = ws.Range["D7", "G7"]; + rng2.MergeCells = true; + rng2.Value2 = "사업자No : " + Scompnum; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng2.Font.Bold = true; + #endregion + + #region 보낸곳 업태, 종목, 주소, 대표자 (8행) + rng2 = ws.Range["A8", "G8"]; + rng2.MergeCells = true; + rng2.Value2 = string.Format(@"배송주소 : {0}", 주소); + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; + rng2.Font.Bold = true; + rng2.WrapText = true; + #endregion + + // 도서 주문 목록 입력칸 (idx가 정해져있지않음) + #region 표 헤더 (No / 출판사 / 도서명 / 저자 / 수량 / 정가 / 구분 (10행) + string[] Header = { "No", "출판사", "도서명", "저자", "수량", "정가", "구분" }; + rng = ws.Range["A10", "G10"]; + rng.Value2 = Header; + rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + rng.Font.Bold = true; + #endregion + + #region gridData 엑셀에 반영 (11행~) + int endcount = data.GetLength(0) + 10; + rng2 = ws.Range["A11", "G" + endcount]; + rng2.Value2 = data; + rng2.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; + rng2.RowHeight = 24; + rng2.WrapText = true; + rng.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; + + string[] total_array = { "", "합계", "", "", total[0].ToString(), total[1].ToString(), "" }; + + endcount++; + rng = ws.Range["A" + endcount, "G" + endcount]; + rng.Value2 = total_array; + rng.Font.Bold = true; + + rng2 = ws.Range["E11", "G" + endcount]; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignRight; + #endregion + + #region 추신 + endcount++; + string 발송처 = "D"+endcount.ToString(); + + rng = ws.Range["A" + endcount, "C" + endcount]; + rng.MergeCells = true; + rng.Value2 = "계산서 또는 세금계산서를 발행해주세요."; + rng.Font.Bold = true; + + rng2 = ws.Range["E" + endcount, "F" + endcount]; + rng2.MergeCells = true; + rng2.Value2 = barea[0]; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + rng2.Font.Bold = true; + + //////// + endcount++; + + rng = ws.Range["A" + endcount, "C" + endcount]; + rng.MergeCells = true; + rng.Value2 = "E-Mail : " + 이메일; + rng.Font.Bold = true; + + rng2 = ws.Range["E" + endcount, "F" + endcount]; + rng2.MergeCells = true; + rng2.Value2 = barea[1]; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + rng2.Font.Bold = true; + + //////// + endcount++; + + rng = ws.Range["A" + endcount, "C" + endcount]; + rng.MergeCells = true; + rng.Value2 = "품절 및 절판도서는 연락주세요."; + rng.Font.Bold = true; + + rng2 = ws.Range["E" + endcount, "F" + endcount]; + rng2.MergeCells = true; + rng2.Value2 = barea[2]; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + rng2.Font.Bold = true; + + //////// + endcount++; + + rng = ws.Range["A" + endcount, "C" + endcount]; + rng.MergeCells = true; + rng.Value2 = "거레명세표를 발행하여 Fax번호로 회신부탁드립니다."; + rng.Font.Bold = true; + + rng2 = ws.Range["E" + endcount, "F" + endcount]; + rng2.MergeCells = true; + rng2.Value2 = barea[3]; + rng2.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + rng2.Font.Bold = true; + + //////// + rng = ws.Range[발송처, "D"+endcount]; + rng.MergeCells = true; + rng.Value2 = "발 송 처"; + rng.Font.Bold = true; + rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + + //////// + rng2 = ws.Range[발송처, "F" + endcount]; + rng2.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; + + #endregion + + #region 마무리 다듬기 + endcount++; + rng = ws.Range["A" + endcount, "G" + endcount]; + rng.Value2 = PS; + rng.MergeCells = true; + rng.Interior.Color = ColorTranslator.ToOle(Color.LightGray); + + rng2 = ws.Range["A4", "G" + endcount]; + rng2.Font.Name = "돋음"; + rng2.Font.Size = 10; + #endregion + + wb.SaveAs(Savepath, Excel.XlFileFormat.xlWorkbookDefault); + wb.Close(true); + + application.Interactive = true; + application.Quit(); + + return FileName; + } + catch(Exception e) + { + MessageBox.Show(e.ToString()); + return "False"; + } + } + + /// + /// 엑셀 내보내기 + /// + /// 사용할 데이터 + public void Mk_Excel(string[] title, string[,] data) + { + try + { + Excel.Application app = new Excel.Application(); + app.Visible = true; // true 일때 엑셀이 작업되는 내용이 보임 + app.Interactive = false; // false 일때 유저의 조작에 방해받지않음. + + Excel._Workbook wb = (Excel._Workbook)(app.Workbooks.Add(Missing.Value)); // 워크북 생성 + Excel._Worksheet ws = (Excel._Worksheet)app.ActiveSheet; // 시트 가져옴 + Excel.PageSetup ps = ws.PageSetup; + + Excel.Range rng = null; // 셀 처리 변수 + + rng = ws.Range["A1", Excel_Sub(title) + "1"]; + rng.Font.Color = Color.Blue; + rng.HorizontalAlignment = 3; + rng.Value2 = title; + + int length = data.GetLength(0) + 1; + rng = ws.Range["A2", Excel_Sub(title) + length]; + rng.Value2 = data; + ws.Columns.AutoFit(); + + app.Interactive = true; + app.Quit(); + } + catch (Exception e) + { + MessageBox.Show(e.ToString()); + } + } + #region MK_Excel_Sub + private string Excel_Sub(string[] data) + { + string[] length = { + "1", "2", "3", "4", "5", + "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", + "16", "17", "18", "19", "20", + "21", "22", "23", "24", "25", "26" + }; + string[] Alpha = { + "A", "B", "C", "D", "E", + "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", + "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", "Z" + }; + + string count = data.Length.ToString(); + string res = string.Empty; + + for(int a = 0; a < length.Length; a++) + { + if (length[a] == count) + { + res = Alpha[a]; + } + } + return res; + } + #endregion + } + public class Helper_Print + { + /// + /// 행의 갯수 + /// + public int cnt = 0; + + /// + /// 페이지 넘버 + /// + public int pageNo = 1; + + public void Init() + { + cnt = 0; + pageNo = 1; + } + + public void PrintPage(object sender, PrintPageEventArgs e, DataGridView gridView) + { + // 페이지 전체넓이 + int dialogWidth = 528; + + // 컬럼 안에 있는 값들 가운데 정렬하기 위해 선언 + StringFormat sf = new StringFormat(); + sf.Alignment = StringAlignment.Center; + + // width는 시작점 위치, width1은 datagrid 1개의 컬럼 가로길이 + int width, width1; + + // 시작 x좌표 + int startWidth = 10; + + // 시작 y좌표 + int startHeight = 140; + + // gridView 컬럼 하나의 높이 + int avgHeight = gridView.Rows[0].Height; + + // row 개수 카운트용 + int temp = 0; + + e.Graphics.DrawString("제목", new Font("Arial", 20, FontStyle.Bold), Brushes.Black, dialogWidth / 2, 40); + e.Graphics.DrawString("인쇄일 : " + DateTime.Now.ToString("yyyy/MM/dd"), new Font("Arial", 13), Brushes.Black, dialogWidth - 20, 80); + e.Graphics.DrawString("페이지번호 : " + pageNo, new Font("Arial", 13), Brushes.Black, dialogWidth - 20, 100); + + for (int a = 0; a < gridView.ColumnCount; a++) + { + if (a == 0) + { + width = 0; + width1 = gridView.Columns[a].Width + 15; + } + else if (a >= 1 && a < gridView.ColumnCount - 2) + { + width = gridView.Columns[a - 1].Width + 15; + width1 = gridView.Columns[a].Width + 15; + } + else + { + width = gridView.Columns[a - 1].Width + 15; + width1 = gridView.Columns[a].Width + 40; + } + + RectangleF drawRect = new RectangleF((float)(startWidth + width), (float)startHeight, (float)width1, avgHeight); + + e.Graphics.DrawRectangle(Pens.Black, (float)(startWidth + width), (float)startHeight, (float)width1, avgHeight); + + // e.Graphics.FillRectangle(Brushes.LightGray, (float)(startWidth + width), (float)startHeight, (float)width1, avgHeight); + e.Graphics.DrawString(gridView.Columns[a].HeaderText, new Font("Arial", 12, FontStyle.Bold), Brushes.Black, drawRect, sf); + + startWidth += width; + } + startHeight += avgHeight; + + for (int a = cnt; a < gridView.RowCount - 1; a++) + { + startWidth = 10; // 다시 초기화 + for (int b = 0; b < gridView.ColumnCount; b++) + { + if (b == 0) + { + width = 0; + width1 = gridView.Columns[b].Width + 15; + } + else if (b >= 1 && b <= gridView.ColumnCount - 2) + { + width = gridView.Columns[b - 1].Width + 15; + width1 = gridView.Columns[b].Width + 15; + } + else + { + width = gridView.Columns[b - 1].Width + 15; + width1 = gridView.Columns[b].Width + 40; + } + + RectangleF drawRect = new RectangleF((float)(startWidth + width), (float)startHeight, (float)width1, avgHeight); + + e.Graphics.DrawRectangle(Pens.Black, (float)(startWidth + width), (float)startHeight, (float)width1, avgHeight); + + //e.Graphics.FillRectangle(Brushes.LightGray, (float)(startWidth + width), (float)startHeight, (float)width, avgHeight); + e.Graphics.DrawString(gridView.Rows[a].Cells[b].FormattedValue.ToString(), new Font("Arial", 9), Brushes.Black, drawRect, sf); + startHeight += width; + } + startHeight += avgHeight; + temp++; + cnt++; + + if (temp % 40 == 0) + { + e.HasMorePages = true; + pageNo++; + return; + } + } + } + } + + class Barobill_FAX + { + private string CERTKEY = "BC5F164E-6410-44FF-BADF-25732E850D36"; //인증키 + private string CorpNum = "4088188534"; //바로빌 회원 사업자번호 ('-' 제외, 10자리) + private string SenderID = "gloriabook"; //연계사업자 담당자 아이디 + /// + /// 팩스 전송 모듈 (21.04.08 주문관리 전용) + /// + /// + /// [0] 발신번호 / [1] 수신번호 + /// / [2] 수신자 회사명 / [3 ]수신자명 + public string Send_BaroFax(string file_name, string[] fax_param ) + { + BaroService_FAXSoapClient fAXSoapClient = new BaroService_FAXSoapClient(); + + string FileName = file_name; //전송할 파일명 + string FromNumber = fax_param[0]; //발신번호 + string ToNumber = fax_param[1]; //수신번호 + string ToCorpName = fax_param[2]; //수신자 회사명 + string ToName = fax_param[3]; //수신자명 + string SendDT = ""; //전송일시 (yyyyMMddHHmmss 형식) (빈 문자열 입력시 즉시 전송, 미래일자 입력시 예약 전송) + string RefKey = ""; //연동사부여 전송키 + + string result = fAXSoapClient.SendFaxFromFTP( + CERTKEY, CorpNum, SenderID, FileName, FromNumber, + ToNumber, ToCorpName, ToName, SendDT, RefKey); + string msg = string.Format(@"[{0}] 파일이 팩스로 전송되었습니다!", FileName); + + string ErrMsg = FAX_GetErrString(result); + if (ErrMsg != "") + MessageBox.Show(msg, "전송완료"); + else + MessageBox.Show(ErrMsg, "Error"); + + return result; + } + public string[] Send_chk_BaroFax(string sendkey) + { + BaroService_FAXSoapClient fAXSoapClient = new BaroService_FAXSoapClient(); + + // 수신자회사명, 수신번호, 전송일시, 전송결과, 전송페이지수, 성공페이지수, 전송파일명 + string[] MsgBox_Array = { + fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).ReceiveCorp, + fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).ReceiverNum, + fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).SendDT, + fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).SendResult, + fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).SendPageCount.ToString(), + fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).SuccessPageCount.ToString(), + fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).SendFileName + }; + + MsgBox_Array[3] = Msg_result(MsgBox_Array[3]); + + return MsgBox_Array; + } + private string FAX_GetErrString(string msg) + { + switch (msg) + { + #region 공통 오류 + // 기본 오류코드 + case "-10000": return "알 수 없는 오류 발생."; + case "-10003": return "연동 서비스가 점검중입니다."; + case "-10004": return "해당 기능은 더 이상 사용되지 않습니다."; + case "-10005": return "최대 100건까지만 사용하실 수 있습니다."; + case "-10006": return "최대 1000건까지만 사용하실 수 있습니다."; + case "-10007": return "해당 기능을 사용할 수 없습니다."; + case "-10008": return "날짜형식이 잘못되었습니다."; + case "-10148": return "조회 기간이 잘못되었습니다."; + case "-40001": return "파일을 찾을 수 없습니다."; + case "-40002": return "빈 파일입니다. (0Byte)"; + + // 연동정보 관련 + case "-10002": return "해당 인증키를 찾을 수 없습니다."; + case "-10001": return "해당 인증키와 연결된 연계사가 아닙니다."; + case "-24005": return "사업자번호와 아이디가 맞지 않습니다."; + + // 회원정보 관련 + case "-32000": return "이미 가입된 연계사업자입니다."; + case "-32001": return "사업자번호가 유효하지 않습니다."; + case "-32002": return "회사명이 유효하지 않습니다."; + case "-32003": return "대표자명이 유효하지 않습니다."; + case "-32004": return "업태가 유효하지 않습니다."; + case "-32005": return "업종이 유효하지 않습니다."; + case "-32006": return "주소가 유효하지 않습니다."; + case "-32008": return "담당자명이 유효하지 않습니다."; + case "-32010": return "아이디가 유효하지 않습니다."; + case "-32015": return "해당 아이디는 이미 사용중입니다."; + case "-32011": return "패스워드가 유효하지 않습니다."; + case "-32012": return "연락처가 유효하지 않습니다."; + case "-32013": return "이메일이 유효하지 않습니다."; + case "-32016": return "해당 아이디를 찾을 수 없습니다."; + case "-32017": return "탈퇴한 아이디입니다."; + + // 과금 관련 + case "-26014": return "과금코드를 찾을 수 없습니다."; + case "-26004": return "과금에 실패하였습니다."; + case "-26006": return "충전잔액이 부족합니다."; + case "-26011": return "연동사의 충전잔액이 부족합니다."; + case "-26015": return "공급받는자의 충전잔액이 부족합니다."; + #endregion + + #region 문서서비스 관련 + // 문서 서비스 공통 + case "-24011": return "문서 DB입력에 실패하였습니다."; + case "-24012": return "문서 품목정보 DB입력에 실패하였습니다."; + case "-24013": return "문서 속성정보 DB입력에 실패하였습니다."; + case "-34021": return "문서 DB수정에 실패하였습니다."; + case "-34022": return "문서 품목정보 DB수정에 실패하였습니다."; + case "-34023": return "문서 속성정보 DB수정에 실패하였습니다."; + case "-25102": return "관리번호(MgtKey)가 잘못되었습니다."; + case "-11013": return "관리번호(MgtKey)가 중복되었습니다."; + case "-11011": return "공급자 부여 관리번호(MgtKey)가 잘못되었습니다."; + case "-11012": return "공급받는자 부여 관리번호(MgtKey)가 잘못되었습니다."; + case "-11018": return "수탁자 부여 관리번호(MgtKey)가 잘못되었습니다."; + case "-21002": return "해당 문서 정보가 없습니다."; + case "-21003": return "해당 문서는 삭제 가능한 상태가 아닙니다."; + case "-21005": return "해당 문서는 임시저장상태가 아닙니다."; + case "-21006": return "해당 문서는 임시저장상태입니다."; + case "-26000": return "해당 문서는 이미 발행되었거나, 임시저장상태가 아니므로 발행이 불가능합니다."; + case "-21007": return "해당 문서는 취소 가능한 상태가 아닙니다."; + case "-30000": return "지원되지 않는 처리요청입니다. (ProcType)"; + case "-30001": return "해당 처리요청은 현재 상태에는 처리할 수 없습니다."; + case "-25101": return "문서형태가 올바르지 않습니다."; + case "-26009": return "처리에 실패하였습니다."; + case "-33000": return "첨부할 파일을 찾을 수 없습니다."; + case "-33001": return "첨부파일 개수가 제한을 초과하였습니다."; + case "-33002": return "일괄인쇄기능은 50건까지만 가능합니다"; + + // 세금계산서 관련 + case "-11009": return "문서 형태가 잘못되었습니다. (TaxInvoiceType)"; + case "-11019": return "계산서 형태가 맞지 않습니다. (TaxInvoiceType, TaxType)"; + case "-11010": return "과세형태가 잘못되었습니다. (TaxType)"; + case "-11007": return "영수/청구 구분이 잘못되었습니다. (PurposeType)"; + case "-11005": return "발행방향이 잘못되었습니다. (IssueDirection)"; + case "-11008": return "세금계산방식이 잘못되었습니다. (TaxCalcType)"; + case "-24006": return "발행시점이 잘못되었습니다. (IssueTiming)"; + case "-11110": return "공급자와 공급받는자의 사업자번호가 같습니다."; + case "-11002": return "공급자 정보가 없습니다. (InvoicerParty)"; + case "-11101": return "공급자 사업자번호가 잘못되었습니다. (InvoicerParty.CorpNum)"; + case "-11109": return "공급자의 종사업자 번호는 숫자 4자리로 입력해야 합니다. (InvoicerParty.TaxRegID)"; + case "-11102": return "공급자 상호가 잘못되었습니다. (InvoicerParty.CorpName)"; + case "-11103": return "공급자 대표자명이 잘못되었습니다. (InvoicerParty.CEOName)"; + case "-11104": return "공급자 주소가 잘못되었습니다. (InvoicerParty.Addr)"; + case "-11105": return "공급자 업종이 잘못되었습니다. (InvoicerParty.BizType)"; + case "-11106": return "공급자 업태가 잘못되었습니다. (InvoicerParty.BizClass)"; + case "-11001": return "공급자 아이디가 잘못되었습니다. (InvoicerParty.ContactID)"; + case "-11107": return "공급자 담당자명이 잘못되었습니다. (InvoicerParty.ContactName)"; + case "-11108": return "공급자 이메일이 잘못되었습니다. (InvoicerParty.Email)"; + case "-11003": return "공급받는자 정보가 없습니다. (InvoiceeParty)"; + case "-11201": return "공급받는자 사업자번호가 잘못되었습니다. (InvoiceeParty.CorpNum)"; + case "-11209": return "공급받는자의 종사업자 번호는 숫자 4자리로 입력해야 합니다. (InvoiceeParty.TaxRegID)"; + case "-11202": return "공급받는자 상호가 잘못되었습니다. (InvoiceeParty.CorpName)"; + case "-11203": return "공급받는자 대표자명이 잘못되었습니다. (InvoiceeParty.CEOName)"; + case "-11204": return "공급받는자 주소가 잘못되었습니다. (InvoiceeParty.Addr)"; + case "-11205": return "공급받는자 업종이 잘못되었습니다. (InvoiceeParty.BizType)"; + case "-11206": return "공급받는자 업태가 잘못되었습니다. (InvoiceeParty.BizClass)"; + case "-11017": return "공급받는자 아이디가 잘못되었습니다. (InvoiceeParty.ContactID)"; + case "-11207": return "공급받는자 담당자명이 잘못되었습니다. (InvoiceeParty.ContactName)"; + case "-11208": return "공급받는자 이메일이 잘못되었습니다. (InvoiceeParty.Email)"; + case "-11004": return "위탁자 정보가 없습니다. (BrokerParty)"; + case "-25003": return "위탁자 사업자번호가 잘못되었습니다 (BrokerParty.CorpNum)."; + case "-11210": return "위탁자의 종사업자 번호는 숫자 4자리로 입력해야 합니다. (BrokerParty.TaxRegID)"; + case "-11301": return "수탁자 사업자번호가 잘못되었습니다. (BrokerParty.CorpNum)"; + case "-11302": return "수탁자 상호가 잘못되었습니다. (BrokerParty.CorpName)"; + case "-11303": return "수탁자 대표자명이 잘못되었습니다. (BrokerParty.CEOName)"; + case "-11304": return "수탁자 주소가 잘못되었습니다. (BrokerParty.Addr)"; + case "-11305": return "수탁자 업종이 잘못되었습니다. (BrokerParty.BizType)"; + case "-11306": return "수탁자 업태가 잘못되었습니다. (BrokerParty.BizClass)"; + case "-11014": return "수탁자 아이디가 잘못되었습니다. (BrokerParty.ContactID)"; + case "-11307": return "수탁자 담당자명이 잘못되었습니다. (BrokerParty.ContactName)"; + case "-11308": return "수탁자 이메일이 잘못되었습니다. (BrokerParty.Email)"; + case "-11021": return "공급받는자가 외국인인 경우 비고에 추가정보를 기재하여야 합니다. (Remark1)"; + case "-11022": return "작성일자의 형식(YYYYMMDD)이 잘못되었습니다. (WriteDate)"; + case "-11020": return "작성일자를 미래일자로 발행하실 수 없습니다. (WriteDate)"; + case "-11801": return "권 항목이 잘못되었습니다. 숫자만 가능합니다. (Kwon)"; + case "-11802": return "호 항목이 잘못되었습니다. 숫자만 가능합니다. (Ho)"; + case "-11006": return "공급가액이 잘못되었습니다. (AmountTotal)"; + case "-11016": return "세액이 잘못되었습니다. (TaxTotal)"; + case "-11015": return "합계금액이 잘못되었습니다. (TotalAmount)"; + case "-11310": return "영세,면세 세금계산서는 세금이 0원이어야 합니다."; + case "-11311": return "과세는 세금이 0원 이상이어야 합니다."; + case "-11803": return "현금 항목이 잘못되었습니다. (Cash)"; + case "-11804": return "수표 항목이 잘못되었습니다. (ChkBill)"; + case "-11805": return "어음 항목이 잘못되었습니다. (Note)"; + case "-11806": return "외상미수금 항목이 잘못되었습니다. (Credit)"; + case "-11811": return "현금, 수표, 어음, 외상미수금의 합계가 세금계산서의 합계금액과 맞지 않습니다."; + case "-11309": return "품목정보는 99개까지만 입력할 수 있습니다. (TaxInvoiceTradeLineItems)"; + case "-11023": return "품목정보의 공급일자 형식(YYYYMMDD)이 잘못되었습니다. (TaxInvoiceTradeLineItem.PurchaseExpiry)"; + case "-11814": return "품목정보의 공급일자의 월은 작성일자의 월과 같아야 합니다. (TaxInvoiceTradeLineItem.PurchaseExpiry)"; + case "-11808": return "품목정보의 수량이 유효하지 않습니다. (TaxInvoiceTradeLineItem.ChargeableUnit)"; + case "-11809": return "품목정보의 단가가 유효하지 않습니다. (TaxInvoiceTradeLineItem.UnitPrice)"; + case "-11807": return "품목정보의 공급가액이 유효하지 않습니다. (TaxInvoiceTradeLineItem.Amount)"; + case "-11810": return "품목정보의 세액이 유효하지 않습니다. (TaxInvoiceTradeLineItem.Tax)"; + case "-11812": return "품목정보의 공급가액, 세액이 유효하지 않습니다."; + case "-11813": return "영세,면세 세금계산서는 품목정보의 세금이 0원이어야 합니다."; + case "-11321": return "해당 함수는 일반세금계산서를 등록하실 수 없습니다."; + case "-11322": return "당초 국세청승인번호가 입력되지 않았습니다."; + case "-11323": return "당초 국세청승인번호는 바로빌을 통해 등록된 세금계산서의 승인번호만 가능합니다."; + case "-11324": return "공급자의 당초 국세청승인번호가 아닙니다."; + case "-11330": return "일반세금계산서를 수정세금계산서로 수정하실 수 없습니다."; + case "-11331": return "수정세금계산서를 일반세금계산서로 수정하실 수 없습니다."; + case "-11332": return "\"과세,영세\" 와 \"면세\" 간에 수정세금계산서를 작성하실 수 없습니다."; + case "-11341": return "환입 또는 계약의해지 시 공급가액과 세액은 (-)이어야 합니다."; + case "-26012": return "해당 세금계산서에 대해 가산세가 예상됩니다."; + case "-26013": return "해당 세금계산서에 대해 과세기간이 종료하였거나, 발행대상이 아닙니다."; + case "-26005": return "해당 세금계산서의 전자서명 과정 중 XML생성에 실패하였습니다."; + case "-31002": return "해당 세금계산서는 국세청 전송이 불가한 상태입니다."; + case "-31004": return "국세청 신고 과정이 진행 중이거나, 완료되었습니다."; + case "-31007": return "해당 세금계산서의 전자서명 정보를 찾을 수 없습니다."; + case "-31008": return "국세청 신고요청 중 알수 없는 오류가 발생하였습니다."; + case "-31009": return "역발행으로 저장된 건이 아닙니다."; + + // 세금계산서 국세청 전송설정 관련 + case "-31015": return "\"과세\" 국세청 전송설정을 잘못 설정하였습니다."; + case "-31016": return "\"과세\" 지연발행 허용 여부를 잘못 설정하였습니다."; + case "-31017": return "\"면세\" 국세청 전송설정을 잘못 설정하였습니다."; + case "-31018": return "\"면세\" 지연발행 허용 여부를 잘못 설정하였습니다."; + + // 공동인증서 관련 + case "-31100": return "등록된 공동인증서가 없습니다."; + case "-26001": return "발행에 필요한 공동인증서가 등록되어 있지 않습니다."; + case "-26002": return "등록된 공동인증서가 만료일이 지났거나, 전송일 기준 유효하지 않습니다."; + case "-26003": return "등록된 공동인증서의 검증에 실패하였습니다. 재등록하여 주시기 바랍니다."; + + // 현금영수증 관련 + case "-11701": return "거래일자가 잘못되었습니다. (TradeDate)"; + case "-11702": return "가맹점 사업자번호가 잘못되었습니다. (FranchiseCorpNum)"; + case "-11703": return "가맹점 아이디가 잘못되었습니다. (FranchiseMemberID)"; + case "-11704": return "가맹점 상호가 잘못되었습니다. (FranchiseCorpName)"; + case "-11705": return "가맹점 대표자명이 잘못되었습니다. (FranchiseCEOName)"; + case "-11706": return "가맹점 주소가 잘못되었습니다. (FranchiseAddr)"; + case "-11707": return "가맹점 전화번호가 잘못되었습니다. (FranchiseTel)"; + case "-11708": return "신분확인번호가 잘못되었습니다. (IdentityNum)"; + case "-11709": return "거래구분이 잘못되었습니다. (TradeType)"; + case "-11710": return "거래용도가 잘못되었습니다. (TradeUsage)"; + case "-11711": return "거래방법이 잘못되었습니다. (TradeMethod)"; + case "-11712": return "취소사유가 잘못되었습니다. (CancelType)"; + case "-11713": return "취소대상 승인번호가 잘못되었습니다. (CancelNTSConfirmNum)"; + case "-11714": return "취소대상 거래일자가 잘못되었습니다. (CancelNTSConfirmDate)"; + case "-11715": return "공급가액이 잘못되었습니다. (Amount)"; + case "-11716": return "부가세가 잘못되었습니다. (Tax)"; + case "-11717": return "봉사료가 잘못되었습니다. (ServiceCharge)"; + case "-11720": return "공급가액이 취소 가능한 금액보다 큽니다. (CancelAmount)"; + case "-11721": return "부가세가 취소 가능한 금액보다 큽니다. (CancelTax)"; + case "-11722": return "봉사료가 취소 가능한 금액보다 큽니다. (CancelServiceCharge)"; + case "-21008": return "거래일자가 과거/미래인 경우에는 발행하실 수 없습니다."; + case "-11718": return "취소중 알 수 없는 오류가 발생하였습니다."; + case "-31114": return "국세청으로 전송되기 전에는 취소발행하실 수 없습니다."; + case "-11719": return "승인번호 채번에 실패하였습니다."; + case "-31111": return "이메일 전송이 불가능한 상태입니다."; + case "-31112": return "SMS 전송이 불가능한 상태입니다."; + case "-31113": return "FAX 전송이 불가능한 상태입니다."; + + // 전자문서 관련 + case "-11601": return "전자문서 양식 코드가 유효하지 않습니다. (FormKey)"; + case "-24014": return "해당 문서에서 사용할 수 없는 속성입니다."; + case "-31102": return "아이디가 잘못되었습니다. (UserID)"; + case "-31213": return "Fax 기능을 지원하지 않는 문서양식입니다."; + + // 이메일 관련 + case "-31104": return "이메일 전송에 필요한 정보가 부족합니다."; + case "-31105": return "거부된 건은 이메일 재전송이 불가능합니다."; + #endregion + + #region 스크래핑 서비스 관련 + // 사업자등록 상태조회 관련 + case "-50301": return "일시적으로 휴폐업조회에 실패하였습니다. (잠시 후 다시 시도해주세요.)"; + + // 카드조회 관련 + case "-50101": return "카드를 찾을 수 없습니다."; + case "-50102": return "카드를 조회할 권한이 없습니다."; + + // 계좌조회 관련 + case "-50001": return "계좌를 찾을 수 없습니다."; + case "-50002": return "계좌를 조회할 권한이 없습니다."; + case "-50004": return "일일 즉시조회 횟수(10회)를 초과하였습니다."; + #endregion + + #region 메시징 서비스 관련 + // 문자전송 관련 + case "-10100": return "발송예약시간 계산오류"; + case "-10101": return "해당 발송정보가 없습니다."; + case "-31101": return "SMS 전송에 필요한 정보가 부족합니다."; + case "-31103": return "LMS 제목은 40자까지만 입력가능합니다."; + case "-10123": return "MMS 전송에 필요한 제목이 없습니다."; + case "-10124": return "MMS 전송에 필요한 이미지 파일정보가 없습니다."; + case "-10125": return "MMS 전송 가능한 이미지 파일크기를 초과하였습니다."; + case "-10126": return "MMS 전송 가능한 이미지의 크기를 초과하였습니다."; + case "-10127": return "MMS 전송 가능한 이미지 타입은 JPG입니다."; + case "-10170": return "080 수신거부 되었습니다."; + case "-10190": return "이미 등록된 발신번호입니다."; + case "-10191": return "번호의 형식이 올바르지 않습니다."; + case "-10192": return "사전등록되지 않은 발신번호로 문자를 전송할 수 없습니다."; + + // 문자전송 실패코드 + case "-10104": return "음영지역"; + case "-10106": return "메시지 저장 개수 초과"; + case "-10107": return "잘못된 전화번호"; + case "-10116": return "이통사에서 SPAM처리됨"; + case "-10131": return "MMS 미 지원 단말"; + case "-10132": return "중복전송에러"; + case "-10158": return "발송 미허용 시간 때 발송 실패 처리"; + case "-10185": return "웹문자 발신 차단번호"; + case "-10186": return "기타오류"; + + // 팩스전송 관련 + case "-31204": return "FAX 전송에 필요한 정보가 부족합니다."; + case "-31205": return "취소/거부된 문서는 FAX 전송이 불가능합니다."; + case "-31207": return "역발행 문서는 FAX 기능을 지원하지 않습니다."; + case "-10146": return "파일은 최대 10개까지 전송하실 수 있습니다."; + case "-31210": return "팩스전송을 위한 파일생성에 실패하였습니다."; + case "-31211": return "팩스전송을 위한 파일을 찾을 수 없습니다."; + case "-31214": return "90일이 경과된 건은 재전송하실 수 없습니다."; + #endregion + default: + return ""; + } + } + + private string Msg_result(string msg) + { + string result = ""; + switch (msg) + { + case "100": + result = "과금실패"; + break; + case "101": + result = "변환실패"; + break; + case "102": + result = "변환실패 (30분 타임아웃)"; + break; + case "801": + result = "부분완료"; + break; + case "802": + result = "완료"; + break; + case "803": + result = "통화중 (재전송시도)"; + break; + case "804": + result = "잘못된 수신번호"; + break; + case "805": + result = "응답없음"; + break; + case "806": + result = "수화기들음"; + break; + case "807": + result = "수신거부"; + break; + case "808": + result = "알수없는 오류"; + break; + case "809": + result = "콜 혼잡"; + break; + case "810": + result = "파일변환 오류"; + break; + case "811": + result = "전송데이터 없음"; + break; + case "812": + result = "파일저장 오류"; + break; + case "813": + result = "입력항목 오류"; + break; + case "814": + result = "소켓통신 오류"; + break; + default: + result = "알수없는 오류"; + break; + } + return result; + } + } + + /// + /// ftp 관련 클래스 + /// + class FTP + { + #region + public delegate void ExceptionEventHandler(string LocationID, Exception ex); + public event ExceptionEventHandler ExceptionEvent; + + public Exception LastException = null; + + public bool IsConnected { get; set; } + + private string ipAddr = string.Empty; + private string Port = string.Empty; + private string userId = string.Empty; + private string Pwd = string.Empty; + + public FTP() { } + + public bool ConnectToServer(string ip, string port, string userid, string pwd) + { + this.IsConnected = false; + + this.ipAddr = ip; + this.Port = port; + this.userId = userid; + this.Pwd = pwd; + + string url = string.Format(@"FTP://{0}:{1}/", this.ipAddr, this.Port); + + try + { + FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(url); + ftpRequest.Credentials = new NetworkCredential(userId, Pwd); + ftpRequest.KeepAlive = false; + ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory; + ftpRequest.UsePassive = true; + + using (ftpRequest.GetResponse()) { } + this.IsConnected = true; + } + catch(Exception ex) + { + this.LastException = ex; + System.Reflection.MemberInfo info = System.Reflection.MethodInfo.GetCurrentMethod(); + string id = string.Format("{0}.{1}", info.ReflectedType.Name, info.Name); + + if (this.ExceptionEvent != null) { this.ExceptionEvent(id, ex); } + return false; + } + return true; + } + public bool UpLoad(string folder, string filename) + { + return upload(folder, filename); + } + public bool DownLoad(string localFullPathFile, string serverFullPathFile) + { + return download(localFullPathFile, serverFullPathFile); + } + public List GetFIleList(string serverFolder) + { + return getFileList(serverFolder); + } + private bool upload(string folder, string filename) + { + try + { + makeDir(folder); + + FileInfo fileinf = new FileInfo(filename); + + folder = folder.Replace('\\', '/'); + filename = filename.Replace('\\', '/'); + + string url = string.Format(@"FTP://{0}:{1}/{2}{3}", ipAddr, Port, folder, fileinf.Name); + + FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(url); + ftpRequest.Credentials = new NetworkCredential(userId, Pwd); + ftpRequest.KeepAlive = false; + ftpRequest.UseBinary = false; + ftpRequest.UsePassive = true; + + ftpRequest.Method = WebRequestMethods.Ftp.UploadFile; + ftpRequest.ContentLength = fileinf.Length; + + int buffLength = 2048; + byte[] buff = new byte[buffLength]; + int contentLen; + + using (FileStream fs = fileinf.OpenRead()) + { + using (Stream strm = ftpRequest.GetRequestStream()) + { + contentLen = fs.Read(buff, 0, buffLength); + while (contentLen != 0) + { + strm.Write(buff, 0, contentLen); + contentLen = fs.Read(buff, 0, buffLength); + } + } + fs.Flush(); + fs.Close(); + } + if (buff != null) + { + Array.Clear(buff, 0, buffLength); + buff = null; + } + } + catch(Exception ex) + { + MessageBox.Show(ex.ToString()); + this.LastException = ex; + System.Reflection.MemberInfo info = System.Reflection.MethodInfo.GetCurrentMethod(); + string id = string.Format("{0}.{1}", info.ReflectedType.Name, info.Name); + + if (this.ExceptionEvent != null) { this.ExceptionEvent(id, ex); } + return false; + } + return true; + } + private bool download(string localFullPathFile, string serverFullPathFile) + { + try + { + checkDir(localFullPathFile); + + string url = string.Format(@"FTP://{0}:{1}/{2}", ipAddr, Port, serverFullPathFile); + FtpWebRequest ftp = (FtpWebRequest)WebRequest.Create(url); + + MessageBox.Show(url); + + ftp.Credentials = new NetworkCredential(userId, Pwd); + ftp.KeepAlive = false; + ftp.UseBinary = true; + ftp.UsePassive = false; + + using (FtpWebResponse response = (FtpWebResponse)ftp.GetResponse()) + { + using (FileStream output = new FileStream(localFullPathFile, FileMode.Create, FileAccess.Write)) + { + using (Stream ftpStream = response.GetResponseStream()) + { + int bufferSize = 2048; + int readCount; + byte[] buffer = new byte[bufferSize]; + + readCount = ftpStream.Read(buffer, 0, bufferSize); + while (readCount > 0) + { + output.Write(buffer, 0, readCount); + readCount = ftpStream.Read(buffer, 0, bufferSize); + } + + ftpStream.Close(); + output.Close(); + + if (buffer != null) + { + Array.Clear(buffer, 0, buffer.Length); + buffer = null; + } + } + } + } + return true; + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString()); + this.LastException = ex; + + if (serverFullPathFile.Contains(@"\ZOOM\")) + return false; + System.Reflection.MemberInfo info = System.Reflection.MethodInfo.GetCurrentMethod(); + string id = string.Format("{0}.{1}", info.ReflectedType.Name, info.Name); + if (this.ExceptionEvent != null) + this.ExceptionEvent(id, ex); + return false; + } + } + private List getFileList(string serverFolder) + { + List resultList = new List(); + StringBuilder result = new StringBuilder(); + + try + { + string url = string.Format(@"FTP://{0}:{1}/{2}", this.ipAddr, this.Port, serverFolder); + + FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(url); + ftpRequest.Credentials = new NetworkCredential(userId, Pwd); + ftpRequest.KeepAlive = false; + ftpRequest.UseBinary = false; + ftpRequest.UsePassive = false; + + ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory; + + using (WebResponse response = ftpRequest.GetResponse()) + { + StreamReader reader = new StreamReader(response.GetResponseStream()); + + string line = reader.ReadLine(); + while (line != null) + { + result.Append(line); + result.Append("\n"); + line = reader.ReadLine(); + } + result.Remove(result.ToString().LastIndexOf('\n'), 1); + + if (reader != null) reader.Close(); + + foreach(string file in result.ToString().Split('\n')) + { + resultList.Add(file); + } + } + return resultList; + } + catch(Exception ex) + { + this.LastException = ex; + + System.Reflection.MemberInfo info = + System.Reflection.MethodInfo.GetCurrentMethod(); + string id = string.Format("{0}.{1}", info.ReflectedType.Name, info.Name); + + if (this.ExceptionEvent != null) + this.ExceptionEvent(id, ex); + + return resultList; + } + } + private void makeDir(string dirName) + { + string[] arrDir = dirName.Split('\\'); + string currentDir = string.Empty; + + try + { + foreach(string tmpFolder in arrDir) + { + try + { + if (tmpFolder == string.Empty) continue; + + currentDir += @"/" + tmpFolder; + + string url = string.Format(@"FTP://{0}:{1}/{2}", this.ipAddr, this.Port, currentDir); + FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(url); + ftpRequest.Credentials = new NetworkCredential(userId, Pwd); + ftpRequest.Method = WebRequestMethods.Ftp.MakeDirectory; + ftpRequest.KeepAlive = false; + ftpRequest.UsePassive = true; + + FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse(); + response.Close(); + } + catch { } + } + } + catch (Exception ex) + { + this.LastException = ex; + System.Reflection.MemberInfo info = System.Reflection.MethodInfo.GetCurrentMethod(); + string id = string.Format("{0}.{1}", info.ReflectedType.Name, info.Name); + + if (this.ExceptionEvent != null) { this.ExceptionEvent(id, ex); } + } + } + private void checkDir(string localFullPathFile) + { + FileInfo finfo = new FileInfo(localFullPathFile); + if (!finfo.Exists) { + DirectoryInfo dInfo = new DirectoryInfo(finfo.DirectoryName); + if (!dInfo.Exists) { + dInfo.Create(); + } + } + } + #endregion + } + public delegate void FTPDownloadTotalSizeHandle(long totalSize); + public delegate void FTPDownloadReceivedSizeHandle(int RcvSize); + + /// + /// 텍스트 관련 함수. + /// + class String_Text + { + public string made_Ori_marc(RichTextBox rich) + { + string text = rich.Text; + return madeOrimarc(text); + } + public string made_Ori_marc(string rich) + { + return madeOrimarc(rich); + } + + /// + /// + /// + /// + /// ANSI, UTF-8, UniCode + /// + public string made_Ori_marc(string rich, string EncodingType) + { + return madeOrimarc(rich, EncodingType); + } + + /// + /// 한줄짜리 마크데이터로 만들어주는 함수 + /// + /// 데이터가 담긴 텍스트박스 + /// 한줄짜리 마크데이터 + private string madeOrimarc(string rich, string EncodingType = "ANSI") + { + string result = string.Empty; + + string 디렉토리 = string.Empty; + string 가변길이 = string.Empty; + string text = rich.Replace("\t", ""); + // text = text.Replace("\\", "₩"); + 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; a++) + { + if (array_text[a] == "") break; + + 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 = 0; + if (EncodingType == "UTF-8") { + textLength = Encoding.UTF8.GetBytes(array_text[a]).Length + - WordCheck(array_text[a], "▲") + - WordCheck(array_text[a], "▼"); + } + else if (EncodingType == "UniCode") { + textLength = Encoding.Unicode.GetBytes(array_text[a]).Length + - WordCheck(array_text[a], "▲") + - WordCheck(array_text[a], "▼"); + } + else { // ANSI + 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 (count[a].Length == 3) { count[a] = count[a].Insert(0, "0"); } + else if (count[a].Length == 2) { count[a] = count[a].Insert(0, "00"); } + else if (count[a].Length == 1) { count[a] = count[a].Insert(0, "000"); } + + 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 += 디렉토리 + 가변길이; + result = result.Replace("▲", ""); + result = result.Replace("▼", ""); + + return result; + } + #region made_Ori_marc_Sub + 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; + } + #endregion + + /// + /// 색상 변경함수(richTextBox에만 적용) + /// + /// + public void Color_change(string strTarget, RichTextBox rich) + { + Regex regex = new Regex(strTarget); + MatchCollection mc = regex.Matches(rich.Text); + rich.Select(0, rich.Text.Length); + rich.SelectionBackColor = Color.LightGray; + + int ICursorPosition = rich.SelectionStart; + foreach (Match m in mc) + { + int istartidx = m.Index; + int istopidx = m.Length + 1; + int istopidx1 = m.Length; + + if (strTarget == "▼" || strTarget == "▲") { rich.Select(istartidx, istopidx); } + else { rich.Select(istartidx, istopidx1); } + + if (strTarget == "▼") { rich.SelectionColor = Color.Blue; } + else if (strTarget == "▲") { rich.SelectionColor = Color.Red; } + else { rich.SelectionBackColor = Color.Orange; } // TODO: 색상 변경될수 있음. + + rich.SelectionStart = ICursorPosition; + if (strTarget == "▼" || strTarget == "▲") { rich.SelectionColor = Color.Black; } + else { rich.SelectionBackColor = Color.Empty; } + } + } + + /// + /// 원 마크 데이터에서 태그 추출하는 함수 + /// + /// 마크 데이터 + /// 추출할 함수(배열) + /// + public string[] Take_Tag(string marc, string[] search) + { + string[] ary = marc.Split(''); + string[] tag = res_dir(ary[0].Substring(24)); + (string[] jisi, string[] mrc) = jisi_Symbol(tag, ary); + + string[] s_tag = new string[search.Length]; + string[] scan = new string[search.Length]; + try + { + for (int a = 0; a < search.Length; a++) + { + s_tag[a] = search[a].Substring(0, 3); + scan[a] = "" + search[a].Substring(3); + } + } + catch { } + + string[] result = new string[search.Length]; + string memo = string.Empty; + + for (int a = 0; a < tag.Length; a++) + { + for (int b = 0; b < s_tag.Length; b++) + { + if (tag[a] == s_tag[b]) + { + string tmp = mrc[a]; + int start = tmp.IndexOf(scan[b]); + + if (start < 0) + { + int tag_num = Convert.ToInt16(s_tag[b]); + if (tag_num < 10) + result[b] = tmp; + else + result[b] = ""; + } + else + { + start += 2; + int end = tmp.IndexOf("", start); + if (memo == result[b]) + break; + + if (end < 0) + result[b] = tmp.Substring(start); + else + result[b] = tmp.Substring(start, end - start); + memo = result[b]; + } + } + } + } + + for (int a = 0; a < result.Length; a++) + { + if (result[a] == null) + { + result[a] = ""; + } + } + return result; + } + public string TakeTag_FilterJisi(string marc, string search, string searchJisi) + { + string[] ary = marc.Split(''); + string[] tag = res_dir(ary[0].Substring(24)); + (string[] jisi, string[] mrc) = jisi_Symbol(tag, ary); + + string s_tag = ""; + string scan = ""; + try + { + s_tag = search.Substring(0, 3); + scan = "" + search.Substring(3); + } + catch { } + + string result = ""; + + for (int a = 0; a < tag.Length; a++) + { + if (tag[a] == s_tag) + { + string tmp = mrc[a]; + int start = tmp.IndexOf(scan); + + if (jisi[a] != searchJisi) + { + MessageBox.Show(tmp); + break; + } + + if (start < 0) + { + result = tmp; + } + else + { + start += 2; + int end = tmp.IndexOf("", start); + if (end < 0) + result = tmp.Substring(start); + else + result = tmp.Substring(start, end - start); + } + } + } + if (result == null) + result = ""; + + return result; + } + #region Take_Tag_Sub + string[] res_dir(string dir) + { + List tmp = new List(); + + for (int a = 0; a < dir.Length; a++) + { + if (a % 12 == 0) + tmp.Add(dir.Substring(a, 3)); + } + return tmp.ToArray(); + } + + (string[], string[]) jisi_Symbol(string[] dir, string[] marc) + { + List res = new List(); + List tmp = new List(); + + for (int a = 0; a < dir.Length; a++) + { + if (dir[a].Length < 1) + break; + + if (marc[a + 1].Contains("")) + { + res.Add(marc[a + 1].Substring(0, 2)); + tmp.Add(marc[a + 1].Substring(2)); + } + else + { + res.Add(""); + tmp.Add(marc[a + 1]); + } + } + return (res.ToArray(), tmp.ToArray()); + } + #endregion + + /// + /// 한줄짜리 마크를 보기 쉬운 형태로 변환 + /// + /// 한줄짜리 마크 + /// + public string ConvertMarcType(string Marc) + { + if (Marc.Length < 3) return ""; + + string result = ""; + + List TagNum = new List(); // 태그번호 저장용 + List Field = new List(); // 가변길이필드 저장용 + + Marc = Marc.Replace("", "▼").Replace("", "▲"); + + int StartIdx = 0; + + // 리더부를 제외한 디렉토리, 가변길이필드 저장 + string[] data = Marc.Substring(24).Split('▲'); + for (int a = 1; a < data.Length - 1; a++) + { + TagNum.Add(data[0].Substring(StartIdx, 3)); + StartIdx += 12; + Field.Add(data[a] + "▲"); + } + + // List에 들어간 데이터를 메모장에 출력 + for (int a = 0; a < TagNum.Count; a++) + { + string res = TagNum[a]; + if (Field[a].IndexOf("▲") == -1) + res += "\t \t" + Field[a]; + else if (res.StartsWith("00")) { res += "\t \t" + Field[a]; } + else + { + string temp = Field[a].Insert(2, "\t"); + res += "\t" + temp; + } + result += res + "\n"; + } + return result; + } + + public string ApplyMark(string ViewMarc) + { + List SplitMarc = new List(ViewMarc.Split('\n')); + + for (int a = 0; a < SplitMarc.Count; a++) + { + if (SplitMarc[a].Length < 2) continue; + string ContentTag = SplitMarc[a].Substring(0, 3); + + SplitMarc[a] = GudoSub(ContentTag, SplitMarc[a]); + SplitMarc[a] = JiSiSUB(ContentTag, SplitMarc[a]); + } + return String.Join("\n", SplitMarc); + } + + #region 구두점 서브 + + /// + /// 구두점 입력하는 종합함수 + /// + /// 태그넘버 + /// 태그내용 + /// 구두점 적용된 태그내용 + public string GudoSub(string ContentTag, string Content) + { + switch (ContentTag) + { + case "020": Content = Gudo020(Content); break; + case "110": Content = Gudo110(Content); break; + case "245": Content = Gudo245(Content); break; + case "246": Content = Gudo246(Content); break; + case "260": Content = Gudo260(Content); break; + case "300": Content = Gudo300(Content); break; + case "440": Content = Gudo440(Content); break; + case "490": Content = Gudo490(Content); break; + case "830": Content = Gudo830(Content); break; + } + return Content; + } + + /// + /// 020구두점 적용 + /// + /// 020태그 내용 + /// 020태그 구두점 적용된 내용 + private string Gudo020(string Content) + { + string[] SplitContent = Content.Split('▼'); + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // $c 앞에 $g가 있을 경우 $c 앞에 ":" + if (SplitContent[a].StartsWith("c")) + if (SplitContent[a - 1].StartsWith("g")) + if (!SplitContent[a - 1].EndsWith(":")) + SplitContent[a - 1] += ":"; + } + + return string.Join("▼", SplitContent); + } + + /// + /// 110구두점 적용 + /// + /// 110태그 내용 + /// 110태그 구두점 적용된 내용 + private string Gudo110(string Content) + { + string[] SplitContent = Content.Split('▼'); + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // $a 뒤에 $b가 있는 경우 $b앞에 "." + if (SplitContent[a].StartsWith("b")) + if (SplitContent[a - 1].StartsWith("a")) + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + + // $b 뒤에 $b가 있는 경우 $b앞에 "." + if (SplitContent[a].StartsWith("b")) + if (SplitContent[a - 1].StartsWith("b")) + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + } + + return string.Join("▼", SplitContent); + } + + /// + /// 245구두점 적용 + /// + /// 245태그 내용 + /// 245태그 구두점 적용된 내용 + private string Gudo245(string Content) + { + string[] SplitContent = Content.Split('▼'); + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // 두번째 $a 앞에 ":" + if (SplitContent[a - 1].StartsWith("a")) + if (SplitContent[a].StartsWith("a")) + if (!SplitContent[a - 1].EndsWith(":")) + SplitContent[a - 1] += ":"; + + // $b 앞에 ":"적용 + if (SplitContent[a].StartsWith("b")) + if (!SplitContent[a - 1].EndsWith(":")) + SplitContent[a - 1] += ":"; + + // $x 앞에 "=" 적용 + if (SplitContent[a].StartsWith("x")) + if (!SplitContent[a - 1].EndsWith("=")) + SplitContent[a - 1] += "="; + + // $n 앞에 "." 적용 + if (SplitContent[a].StartsWith("n")) + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + + // $p 앞에 $n이 나온 경우 "," 적용, $p앞에 $n이 없는 경우 "." 적용 + if (SplitContent[a].StartsWith("p")) + { + if (SplitContent[a - 1].StartsWith("n")) + { + if (!SplitContent[a - 1].EndsWith(",")) + SplitContent[a - 1] += ","; + } + else + { + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + } + } + + // $d 앞에 "/" 적용 + if (SplitContent[a].StartsWith("d")) + if (!SplitContent[a - 1].EndsWith("/")) + SplitContent[a - 1] += "/"; + + // TODO : $e 논의 필요 (역할어가 필요함) + if (SplitContent[a].StartsWith("e")) + { + } + } + + return string.Join("▼", SplitContent); + } + + /// + /// 246구두점 적용 + /// + /// 246태그 내용 + /// 246태그 구두점 적용된 내용 + private string Gudo246(string Content) + { + string[] SplitContent = Content.Split('▼'); + char[] Gudo = { ';', ':', '.', ',', '/' }; + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // $a 앞에 $i가 나온경우 $a 앞에 ":"적용 + if (SplitContent[a].StartsWith("a")) + if (SplitContent[a - 1].StartsWith("i")) + if (!SplitContent[a - 1].EndsWith(":")) + SplitContent[a - 1] += ":"; + + // $b 앞에는 ":"적용 + if (SplitContent[a].StartsWith("b")) + if (!SplitContent[a - 1].EndsWith(":")) + SplitContent[a - 1] += ":"; + + // $n 앞에는 "." 적용 + if (SplitContent[a].StartsWith("n")) + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + + // $p 앞에 $n이 나온 경우 "," 적용, $p앞에 $n이 없는 경우 "."적용 + if (SplitContent[a].StartsWith("p")) + { + if (SplitContent[a - 1].StartsWith("n")) + { + if (!SplitContent[a - 1].EndsWith(",")) + SplitContent[a - 1] += ","; + } + else + { + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + } + } + + // $g 앞에는 "" + if (SplitContent[a].StartsWith("g")) + { + SplitContent[a - 1].TrimEnd(Gudo); + SplitContent[a - 1].TrimEnd(' '); + } + } + + return string.Join("▼", SplitContent); + } + + /// + /// 260구두점 적용 + /// + /// 260태그 내용 + /// 260태그 구두점 적용된 내용 + private string Gudo260(string Content) + { + string[] SplitContent = Content.Split('▼'); + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // 두번째 $a 앞에 ";" + if (SplitContent[a].StartsWith("a")) + if (!SplitContent[a - 1].EndsWith(";")) + SplitContent[a - 1] += ";"; + + // $b 앞에는 ":" 적용 + if (SplitContent[a].StartsWith("b")) + if (!SplitContent[a - 1].EndsWith(":")) + SplitContent[a - 1] += ":"; + + // $c 앞에는 "," 적용 + if (SplitContent[a].StartsWith("c")) + if (!SplitContent[a - 1].EndsWith(",")) + SplitContent[a - 1] += ","; + } + + return string.Join("▼", SplitContent); + } + + /// + /// 300구두점 적용 + /// + /// 300태그 내용 + /// 300태그 구두점 적용된 내용 + private string Gudo300(string Content) + { + string[] SplitContent = Content.Split('▼'); + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // $b 앞에는 ":" 적용 + if (SplitContent[a].StartsWith("b")) + if (!SplitContent[a - 1].EndsWith(":")) + SplitContent[a - 1] += ":"; + + // $c 앞에는 ";" 적용 + if (SplitContent[a].StartsWith("c")) + if (!SplitContent[a - 1].EndsWith(";")) + SplitContent[a - 1] += ";"; + + // $e 앞에는 "+" 적용 + if (SplitContent[a].StartsWith("e")) + if (!SplitContent[a - 1].EndsWith("+")) + SplitContent[a - 1] += "+"; + } + + return string.Join("▼", SplitContent); + } + + /// + /// 440구두점 적용 + /// + /// 440태그 내용 + /// 440태그 구두점 적용된 내용 + private string Gudo440(string Content) + { + string[] SplitContent = Content.Split('▼'); + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // $n 앞에는 "." 적용 + if (SplitContent[a].StartsWith("n")) + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + + // $p 앞에 $n이 나온 경우 "," 적용, $p앞에 $n이 없는 경우 "."적용 + if (SplitContent[a].StartsWith("p")) + { + if (SplitContent[a - 1].StartsWith("n")) + { + if (SplitContent[a - 1].EndsWith(",")) + SplitContent[a - 1] += ","; + } + else + { + if (SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + } + } + + // $v 앞에는 ";" 적용 + if (SplitContent[a].StartsWith("v")) + if (!SplitContent[a - 1].EndsWith(";")) + SplitContent[a - 1] += ";"; + } + + return string.Join("▼", SplitContent); + } + + /// + /// 490구두점 적용(TODO: 논의후 함수개발) + /// + /// 490태그 내용 + /// 490태그 구두점 적용된 내용 + private string Gudo490(string Content) + { + string[] SplitContent = Content.Split('▼'); + + return string.Join("▼", SplitContent); + } + + /// + /// 830구두점 적용 + /// + /// 830태그 내용 + /// 830태그 구두점 적용된 내용 + private string Gudo830(string Content) + { + string[] SplitContent = Content.Split('▼'); + + for (int a = 0; a < SplitContent.Length; a++) + { + if (a <= 1) continue; + + // $n 앞에는 "." 적용 + if (SplitContent[a].StartsWith("n")) + if (!SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + + // $p 앞에 $n이 나온 경우 "," 적용, $p앞에 $n이 없는 경우 "."적용 + if (SplitContent[a].StartsWith("p")) + { + if (SplitContent[a - 1].StartsWith("n")) + { + if (SplitContent[a - 1].EndsWith(",")) + SplitContent[a - 1] += ","; + } + else + { + if (SplitContent[a - 1].EndsWith(".")) + SplitContent[a - 1] += "."; + } + } + + // $v 앞에는 ";" 적용 + if (SplitContent[a].StartsWith("v")) + if (!SplitContent[a - 1].EndsWith(";")) + SplitContent[a - 1] += ";"; + } + + return string.Join("▼", SplitContent); + } + #endregion + + #region 지시기호 서브 + + /// + /// 지시기호 입력하는 종합함수 + /// + /// 태그넘버 + /// 태그내용 + /// 지시기호 적용된 태그내용 + private string JiSiSUB(string ContentTag, string Content) + { + switch (ContentTag) + { + case "020": Content = JiSi020(Content); break; + case "041": Content = JiSi041(Content); break; + case "049": Content = JiSi049(Content); break; + case "082": Content = JiSi082(Content); break; + case "100": Content = JiSi100(Content); break; + case "110": Content = JiSi110(Content); break; + case "245": Content = JiSi245(Content); break; + case "250": Content = JiSi250(Content); break; + case "260": Content = JiSi260(Content); break; + case "300": Content = JiSi300(Content); break; + case "440": Content = JiSi440(Content); break; + case "490": Content = JiSi490(Content); break; + case "500": Content = JiSi500(Content); break; + case "504": Content = JiSi504(Content); break; + case "521": Content = JiSi521(Content); break; + case "525": Content = JiSi525(Content); break; + case "536": Content = JiSi536(Content); break; + case "546": Content = JiSi546(Content); break; + case "586": Content = JiSi586(Content); break; + case "650": Content = JiSi650(Content); break; + case "653": Content = JiSi653(Content); break; + case "700": Content = JiSi700(Content); break; + case "710": Content = JiSi710(Content); break; + case "740": Content = JiSi740(Content); break; + case "830": Content = JiSi830(Content); break; + case "900": Content = JiSi900(Content); break; + case "910": Content = JiSi910(Content); break; + case "940": Content = JiSi940(Content); break; + case "950": Content = JiSi950(Content); break; + } + return Content; + } + + /// + /// 020 지시기호 설정 + /// + /// 020태그내용 + /// 020 지시기호 적용된 내용 + private string JiSi020(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + if (SplitContent[2].Contains("(")) + SplitContent[1] = "1 "; + else + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 100 지시기호 설정 + /// + /// 100태그내용 + /// 100 지시기호 적용된 내용 + private string JiSi100(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "1 "; + + return string.Join("\t", SplitContent); + } + + /// + /// 110 지시기호 설정 + /// + /// 110태그내용 + /// 110 지시기호 적용된 내용 + private string JiSi110(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 041 지시기호 설정 + /// + /// 041 태그내용 + /// 041 지시기호 적용된 내용 + private string JiSi041(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "1 "; + + return string.Join("\t", SplitContent); + } + + /// + /// 049 지시기호 설정 + /// + /// 049 태그내용 + /// 049 지시기호 적용된 내용 + private string JiSi049(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "0 "; + + return string.Join("\t", SplitContent); + } + + /// + /// 082 지시기호 설정 + /// + /// 082 태그내용 + /// 082 지시기호 적용된 내용 + private string JiSi082(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "0 "; + + return string.Join("\t", SplitContent); + } + + /// + /// 245 지시기호 설정 + /// + /// 245 태그내용 + /// 245 지시기호 적용된 내용 + private string JiSi245(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + if (SplitContent[2].Contains("(")) + SplitContent[1] = "00"; + else + SplitContent[1] = "20"; + + return string.Join("\t", SplitContent); + } + + /// + /// 250 지시기호 설정 + /// + /// 250 태그내용 + /// 250 지시기호 적용된 내용 + private string JiSi250(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 260 지시기호 설정 + /// + /// 260 태그내용 + /// 260 지시기호 적용된 내용 + private string JiSi260(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 300 지시기호 설정 + /// + /// 300 태그내용 + /// 300 지시기호 적용된 내용 + private string JiSi300(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 440 지시기호 설정 + /// + /// 440 태그내용 + /// 440 지시기호 적용된 내용 + private string JiSi440(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + if (SplitContent[2].Contains("(")) + SplitContent[1] = "10"; + else + SplitContent[1] = "00"; + + return string.Join("\t", SplitContent); + } + + /// + /// 500 지시기호 설정 + /// + /// 500 태그내용 + /// 500 지시기호 적용된 내용 + private string JiSi500(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 490 지시기호 설정 + /// + /// 490 태그내용 + /// 490 지시기호 적용된 내용 + private string JiSi490(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "1 "; + + return string.Join("\t", SplitContent); + } + + /// + /// 504 지시기호 설정 + /// + /// 504 태그내용 + /// 504 지시기호 적용된 내용 + private string JiSi504(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 521 지시기호 설정 + /// + /// 521 태그내용 + /// 521 지시기호 적용된 내용 + private string JiSi521(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 525 지시기호 설정 + /// + /// 525 태그내용 + /// 525 지시기호 적용된 내용 + private string JiSi525(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 536 지시기호 설정 + /// + /// 536 태그내용 + /// 536 지시기호 적용된 내용 + private string JiSi536(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 546 지시기호 설정 + /// + /// 546 태그내용 + /// 546 지시기호 적용된 내용 + private string JiSi546(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 586 지시기호 설정 + /// + /// 586 태그내용 + /// 586 지시기호 적용된 내용 + private string JiSi586(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 650 지시기호 설정 + /// + /// 650 태그내용 + /// 650 지시기호 적용된 내용 + private string JiSi650(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " 8"; + + return string.Join("\t", SplitContent); + } + + /// + /// 653 지시기호 설정 + /// + /// 653 태그내용 + /// 653 지시기호 적용된 내용 + private string JiSi653(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 700 지시기호 설정 + /// + /// 700 태그내용 + /// 700 지시기호 적용된 내용 + private string JiSi700(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "1 "; + + return string.Join("\t", SplitContent); + } + + /// + /// 710 지시기호 설정 + /// + /// 710 태그내용 + /// 710 지시기호 적용된 내용 + private string JiSi710(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " "; + + return string.Join("\t", SplitContent); + } + + /// + /// 740 지시기호 설정 + /// + /// 740 태그내용 + /// 740 지시기호 적용된 내용 + private string JiSi740(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "02"; + + return string.Join("\t", SplitContent); + } + + /// + /// 830 지시기호 설정 + /// + /// 830 태그내용 + /// 830 지시기호 적용된 내용 + private string JiSi830(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " 0"; + + return string.Join("\t", SplitContent); + } + + /// + /// 900 지시기호 설정 + /// + /// 900 태그내용 + /// 900 지시기호 적용된 내용 + private string JiSi900(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "10"; + + return string.Join("\t", SplitContent); + } + + /// + /// 910 지시기호 설정 + /// + /// 910 태그내용 + /// 910 지시기호 적용된 내용 + private string JiSi910(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = " 0"; + + return string.Join("\t", SplitContent); + } + + /// + /// 940 지시기호 설정 + /// + /// 940 태그내용 + /// 940 지시기호 적용된 내용 + private string JiSi940(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "0 "; + + return string.Join("\t", SplitContent); + } + + /// + /// 950 지시기호 설정 + /// + /// 950 태그내용 + /// 950 지시기호 적용된 내용 + private string JiSi950(string Content) + { + string[] SplitContent = Content.Split('\t'); + + if (SplitContent.Length < 2) return ""; + + SplitContent[1] = "0 "; + + return string.Join("\t", SplitContent); + } + #endregion + + /// + /// 텍스트박스 숫자만 입력받는 함수. KeyPress함수에 적용 + /// + /// + /// + public void Only_Int(object sender, KeyPressEventArgs e) + { + if (!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back))) + { + e.Handled = true; + } + } + /// + /// TextChanged이벤트 - 천단위 콤마찍어주기 + /// + /// object sender + /// EventArgs + public void Int_Comma(object sender, EventArgs e) + { + if (((TextBox)sender).Text != "") { + string text; + text = ((TextBox)sender).Text.Replace(",", ""); + ((TextBox)sender).Text = String.Format("{0:#,###}", Convert.ToInt32(text)); + ((TextBox)sender).SelectionStart = ((TextBox)sender).TextLength; + ((TextBox)sender).SelectionLength = 0; + } + } + /// + /// 문자열 내에 한글이 들어가는지 체크 + /// + /// 대상 문자열 + /// 한글 포함시 true + public bool isContainHangul(string value) + { + char[] charArr = value.ToCharArray(); + foreach(char c in charArr) + { + if (char.GetUnicodeCategory(c) == System.Globalization.UnicodeCategory.OtherLetter) + return true; + + } + return false; + } + /// + /// 대상 문자열안에 찾고 싶은 문자 찾기 + /// + /// 대상 문자열 + /// 찾고 싶은 문자 + /// 있을 경우 True반환 + public bool CheckString(string value, string chkString) + { + int index = value.IndexOf(chkString); + if (index < 0) + return false; + + return true; + } + /// + /// 문자와 문자사이의 값 가져오기 + /// + /// 대상 문자열 + /// 시작 문자열 + /// 마지막 문자열 + /// 문자 사이값 + public string GetMiddelString(string str, string begin, string end) + { + if (string.IsNullOrEmpty(str)) + { + return null; + } + + string result = null; + if (str.IndexOf(begin) > -1) + { + str = str.Substring(str.IndexOf(begin) + begin.Length); + if (str.IndexOf(end) > -1) result = str.Substring(0, str.IndexOf(end)); + else result = str; + } + return result; + } + + public string RemoveWordInBracket(string Target) + { + string startBracket = "("; + string endBracket = ")"; + + Regex regex = new Regex("[" + startBracket + "][^" + startBracket + "]*[" + endBracket + "]"); + string result = regex.Replace(Target, string.Empty); + + return result; + } + } + public class API + { + /// + /// https://blog.aladin.co.kr/openapi 참고 + /// + /// + /// + /// + /// + public string Aladin(string Query, string QueryType, string[] Param) + { + string result = string.Empty; + // 쿼리 생성 + string key = "ttbgloriabook1512001"; + string site = "http://www.aladin.co.kr/ttb/api/ItemSearch.aspx"; + string query = string.Format("{0}?query={1}&TTBKey={2}&output=xml&querytype={3}&MaxResults={4}", + site, Query, key, QueryType, 30.ToString()); + + // 쿼리를 입력인자로 WebRequest 개채 생성 + WebRequest request = WebRequest.Create(query); + + // WebRequest개체의 헤더에 인증키 포함시키기. + // request.Headers.Add("Authorization", header); + + // WebResponse개체를 통해 서비스 요청. + WebResponse response = request.GetResponse(); + + // 결과문자열 확인 + Stream stream = response.GetResponseStream(); + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + String xml = reader.ReadToEnd(); + stream.Close(); + // xml형식을 json형식으로 변환 + XmlDocument doc = new XmlDocument(); + try + { + doc.LoadXml(xml); + } + catch { return ""; } + var json = JsonConvert.SerializeXmlNode(doc); + + // json형식 분석을 위해 JavaScriptSerializer 개체 생성 + JavaScriptSerializer js = new JavaScriptSerializer(); + + // 런타임에 개체를 확인하여 사용할수 있는 dynamic을 이용해 역직렬화 + dynamic dob = js.Deserialize(json); + + // "object"내에 있는것을 얻어오기 위해 다시 dynamic변수에 참조 + dynamic docs = ""; + try + { + docs = dob["object"]["item"]; + } + catch + { + return ""; + } + int length = 0; + int ID_length = Param.Length; + + // 검색 결과가 1개 이하일 경우, 오류가 발생하여 try/catch문 사용. + try + { + // docs는 요소 컬렉션으로 object로 변환. + object[] buf = docs; + length = buf.Length; + } + catch + { + object buf = docs; + length = 1; + } + for (int a = 0; a < length; a++) + { + List tmp_data = new List(); + for (int b = 0; b < ID_length; b++) + { + if (length == 1) + { + tmp_data.Add(docs[Param[b]]); + } + else + { + tmp_data.Add(docs[a][Param[b]]); + } + result += tmp_data[b] + "|"; + } + result += "\n"; + } + return result; + } + public string Naver(string[] Query, string[] QueryType, string[] Param) + { + string result = string.Empty; + string json = string.Empty; + // url 생성 + string url = "https://openapi.naver.com/v1/search/book_adv?"; + + for (int a = 0; a < Query.Length; a++) + { + url += string.Format("{0}={1}&", QueryType[a], Query[a]); + } + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + + request.Headers.Add("X-Naver-Client-Id", "wYr0JczCBoDopq1NKTyQ"); // 클라이언트 아이디 + request.Headers.Add("X-Naver-Client-Secret", "QHzeXadtO7"); // 클라이언트 시크릿 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + string status = response.StatusCode.ToString(); + if (status == "OK") + { + Stream stream = response.GetResponseStream(); + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + json = reader.ReadToEnd(); + } + else + { + MessageBox.Show(status, "Error"); + return "Error"; + } + + // json형식 분석을 위해 JavaScriptSerializer 개체 생성 + JavaScriptSerializer js = new JavaScriptSerializer(); + + // 런타임에 개체를 확인하여 사용할수 있는 dynamic을 이용해 역직렬화 + dynamic dob = js.Deserialize(json); + + // "object"내에 있는것을 얻어오기 위해 다시 dynamic변수에 참조 + dynamic docs = ""; + try + { + // docs = dob["object"]["item"]; + docs = dob["items"]; + } + catch + { + return ""; + } + int length = 0; + int ID_length = Param.Length; + + // 검색 결과가 1개 이하일 경우, 오류가 발생하여 try/catch문 사용. + try + { + // docs는 요소 컬렉션으로 object로 변환. + object[] buf = docs; + length = buf.Length; + } + catch + { + object buf = docs; + length = 1; + } + for (int a = 0; a < length; a++) + { + List tmp_data = new List(); + for (int b = 0; b < ID_length; b++) + { + tmp_data.Add(docs[a][Param[b]]); + result += tmp_data[b] + "|"; + } + result += "\n\t"; + } + return result; + } + public string Daum(string Query, string Type, string[] Param) + { + string result = string.Empty; + + // url생성 + string url = "https://dapi.kakao.com/v3/search/book"; + string query = string.Format("{0}?query={1}&target={2}&", url, Query, Type); + WebRequest request = WebRequest.Create(query); + + string rKey = "e3935565b731a2a6f32880c90d76403a"; + string header = "KakaoAK " + rKey; + + request.Headers.Add("Authorization", header); + + WebResponse response = request.GetResponse(); + Stream stream = response.GetResponseStream(); + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + string json = reader.ReadToEnd(); + stream.Close(); + + JavaScriptSerializer js = new JavaScriptSerializer(); + dynamic dob = js.Deserialize(json); + dynamic docs = dob["documents"]; + object[] buf = docs; + + int length = buf.Length; + int ID_length = Param.Length; + + for (int a = 0; a < length; a++) + { + List tmp_data = new List(); + for (int b = 0; b < ID_length; b++) + { + if (Param[b] == "authors") + { + object[] tmp = docs[a][Param[b]]; + string tmp_str = string.Empty; + for (int j = 0; j < tmp.Length; j++) + { + tmp_str += tmp[j]; + if (j < tmp.Length - 1) + { + tmp_str += ", "; + } + } + tmp_data.Add(tmp_str); + result += tmp_data[b] + "|"; + tmp_str = ""; + } + else + { + tmp_data.Add(docs[a][Param[b]]); + result += tmp_data[b] + "|"; + } + } + result += "\n"; + } + return result; + } + } + public class Skill_Search_Text + { + /// + /// 검색용 박스 제작 + /// + /// 제목 + /// 내용 + /// 검색할 문자열 + /// + public DialogResult InputBox(string title, string promptText, ref string value) + { + Form form = new Form(); + Label label = new Label(); + TextBox textBox = new TextBox(); + Button btnOk = new Button(); + Button btnCancel = new Button(); + form.Text = title; + label.Text = promptText; + textBox.Text = value; + btnOk.Text = "OK"; + btnCancel.Text = "Cancel"; + btnOk.DialogResult = DialogResult.OK; + btnCancel.DialogResult = DialogResult.Cancel; + label.SetBounds(9, 20, 372, 13); + textBox.SetBounds(12, 36, 372, 20); + btnOk.SetBounds(228, 72, 75, 23); + btnCancel.SetBounds(309, 72, 75, 23); + label.AutoSize = true; + textBox.Anchor = textBox.Anchor | AnchorStyles.Right; + btnOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + form.ClientSize = new Size(396, 107); + form.Controls.AddRange(new Control[] { label, textBox, btnOk, btnCancel }); + form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); + form.FormBorderStyle = FormBorderStyle.FixedDialog; + form.StartPosition = FormStartPosition.CenterScreen; + form.MinimizeBox = false; + form.MaximizeBox = false; + form.AcceptButton = btnOk; + form.CancelButton = btnCancel; + DialogResult dialogResult = form.ShowDialog(); + value = textBox.Text; + return dialogResult; + } + } + public class PrintLine + { + string num { get; set; } + string count { get; set; } + string list_name { get; set; } + string book { get; set; } + string price { get; set; } + string comp { get; set; } + string isbn { get; set; } + + int MaxX_title = 145; + int MaxX = 125; + + /// + /// 파라미터 순서대로 설정이 되어야함. + /// + /// 목록번호 + /// 목록명 + /// 도서명 + /// 출판사 + /// 해당 도서의 isbn + /// 수량 + /// 가격 + public PrintLine(string num, string list_name, string isbn, string book, string comp, string count, string price) + { + this.num = num; + this.list_name = list_name; + this.isbn = isbn; + this.book = book; + this.comp = comp; + this.count = count; + this.price = price; + } + /// + /// 0:목록번호 1:목록명 2:isbn 3:도서명 4:출판사 5:수량 6:가격 + /// + /// 0:목록번호 1:목록명 2:isbn 3:도서명 4:출판사 5:수량 6:가격 + public PrintLine(string[] data) + { + this.num = data[0]; + this.list_name = data[1]; + this.isbn = data[2]; + this.book = data[3]; + this.comp = data[4]; + this.count = data[5]; + this.price = data[6]; + } + + public void BnP_LinePrint(object sender, PrintPageEventArgs e) + { + Graphics g = e.Graphics; + + int xPos = 0; + int yPos = 0; + + string list_tmp = count + "-" + list_name; + + Font title = new Font("굴림", 21, FontStyle.Bold); + Font list = new Font("굴림", 16, FontStyle.Regular); + Font book = new Font("굴림", 16, FontStyle.Regular); + Font price = new Font("굴림", 16, FontStyle.Regular); + + RectangleF title_Area = new RectangleF(xPos, yPos, MaxX_title, 35); + yPos += 35; + RectangleF list_Area = new RectangleF(xPos, yPos, MaxX, 80); + yPos += 75; + RectangleF book_Area = new RectangleF(xPos, yPos, MaxX, 125); + yPos += 125; + RectangleF price_Area = new RectangleF(xPos, yPos, MaxX, 70); + + using (SolidBrush brush = new SolidBrush(Color.Black)) + { + g.DrawString(this.num, title, brush, title_Area); + g.DrawString(list_tmp, list, brush, list_Area); + g.DrawString(this.book, book, brush, book_Area); + g.DrawString(this.price, price, brush, price_Area); + } + } + + public void BnP_LinePrint_Edit(object sender, PrintPageEventArgs e) + { + + Graphics g = e.Graphics; + + int xPos = 0; + int yPos = 0; + + Pen p = new Pen(Color.Black); + + Font title = new Font("굴림", 21, FontStyle.Bold); + Font count = new Font("굴림", 16, FontStyle.Bold); + Font list = new Font("굴림", 14, FontStyle.Regular); + Font book = new Font("굴림", 18, FontStyle.Regular); + Font price_f = new Font("굴림", 14, FontStyle.Regular); + + RectangleF title_Area = new RectangleF(xPos, yPos, MaxX_title, 35); + yPos += 30; + RectangleF count_Area = new RectangleF(xPos, yPos, MaxX, 35); + yPos += 25; + RectangleF list_Area = new RectangleF(xPos, yPos, MaxX, 70); + yPos += 65; + RectangleF book_Area1 = new RectangleF(xPos, yPos, MaxX, 120); + yPos += 115; + RectangleF price_Area = new RectangleF(xPos, yPos, MaxX, 70); + + //g.DrawLine(p, MaxX, 0, MaxX, yPos); + + using (SolidBrush drawBrush = new SolidBrush(Color.Black)) + { + g.DrawString(this.num, title, drawBrush, title_Area); + g.DrawString(this.count + "권", count, drawBrush, count_Area); + g.DrawString(this.list_name, list, drawBrush, list_Area); + g.DrawString(this.book, book, drawBrush, book_Area1); + g.DrawString(this.price, price_f, drawBrush, price_Area); + } + } + + public void New_LinePrint(object sender, PrintPageEventArgs e) + { + + Graphics g = e.Graphics; + + int xPos = 0; + int yPos = 0; + + Pen p = new Pen(Color.Black); + + Font list = new Font("굴림", 14, FontStyle.Regular); + Font num = new Font("굴림", 18, FontStyle.Bold); + Font book = new Font("굴림", 14, FontStyle.Bold); + Font isbn = new Font("굴림", 11, FontStyle.Regular); + + RectangleF list_Area = new RectangleF(xPos, yPos, MaxX, 20); + yPos += 20; + RectangleF num_Area = new RectangleF(xPos, yPos, MaxX, 35); + yPos += 30; + g.DrawLine(p, xPos, yPos, MaxX, yPos); + yPos += 5; + RectangleF book_Area = new RectangleF(xPos, yPos, MaxX, 115); + yPos += 115; + RectangleF comp_Area = new RectangleF(xPos, yPos, MaxX, 20); + yPos += 30; + RectangleF num1_Area = new RectangleF(xPos, yPos, MaxX, 20); + g.DrawLine(p, xPos, yPos, MaxX, yPos); + yPos += 25; + RectangleF isbn_Area = new RectangleF(xPos, yPos, MaxX, 20); + yPos += 20; + RectangleF price_Area = new RectangleF(xPos, yPos, MaxX, 20); + + using (SolidBrush drawBrush = new SolidBrush(Color.Black)) + { + g.DrawString(this.list_name, list, drawBrush, list_Area); + g.DrawString(this.num, num, drawBrush, num_Area); + g.DrawString(this.count + "-" + this.book, book, drawBrush, book_Area); + g.DrawString(this.comp, list, drawBrush, comp_Area); + g.DrawString(this.list_name, book, drawBrush, num1_Area); + g.DrawString(this.isbn, isbn, drawBrush, isbn_Area); + g.DrawString(this.price, list, drawBrush, price_Area); + } + } + } + /// + /// HangulJaso에서 한글자소에 대한 정보를 담음 + /// + public struct HANGUL_INFO + { + /// + /// 한글 여부(H, NH) + /// + public string isHangul; + + /// + /// 분석 한글 + /// + public char oriChar; + + /// + /// 분리된 한글 (강 -> ㄱ ㅏ ㅇ) + /// + public char[] chars; + } + + /// + /// 한글 분석 클래스 + /// + public sealed class HangulJaso + { + /// + /// 초성 리스트 + /// + public static readonly string HTable_ChoSung = "ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ"; + + /// + /// 중성 리스트 + /// + public static readonly string HTable_JungSung = "ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ"; + + /// + /// 종성 리스트 + /// + public static readonly string HTable_JongSung = "ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ"; + + private static readonly ushort m_UniCodeHangulBase = 0xAC00; + + private static readonly ushort m_UniCodeHangulLast = 0xD79F; + + /// + /// 생성자 + /// + public HangulJaso() { } + + /// + /// 초성, 중성, 종성으로 이루어진 한글을 한글자의 한글로 만듬 + /// + /// 초성 + /// 중성 + /// 종성 + /// 합쳐진 글자 + /// + /// 초성, 중성, 종성으로 이루어진 한글을 한글자의 한글로 만든다. + /// + /// string choSung = "ㄱ", jungSung = "ㅏ", jongSung = "ㅇ"; + /// char hangul = MergeJaso(choSung, jungSung, jongSung); + /// /결과 -> 강 + /// + public static char MergeJaso(string choSung, string jungSung, string jongSung) + { + int ChoSungPos, JungSungPos, JongSungPos; + int nUniCode; + + ChoSungPos = HTable_ChoSung.IndexOf(choSung); // 초성 위치 + JungSungPos = HTable_JungSung.IndexOf(jungSung); // 중성 위치 + JongSungPos = HTable_JongSung.IndexOf(jongSung); // 종성 위치 + + // 앞서 만들어 낸 계산식 + nUniCode = m_UniCodeHangulBase + (ChoSungPos * 21 + JungSungPos) * 28 + JongSungPos; + + // 코드값을 문자로 변환 + char temp = Convert.ToChar(nUniCode); + + return temp; + } + + /// + /// 한글자의 한글을 초성, 중성, 종성으로 나눈다. + /// + /// 한글 + /// 분리된 한글에 대한 정보 + /// + /// 한글자의 한글을 초성, 중성, 종성으로 나눈다. + /// + /// HANGUL_INFO hinfo = DevideJaso('강'); + /// // hinfo.isHangul -> "H"(한글) + /// // hinfo.oriChar -> 강 + /// // hinfo.chars[0] -> ㄱ, hinfo.chars[1] -> ㅏ, hinfo.chars[2] -> ㅇ + public static HANGUL_INFO DevideJaso(char hanChar) + { + int ChoSung, JungSung, JongSung; // 초성, 중성, 종성의 인덱스 + ushort temp = 0x0000; // 임시로 코드값을 담을 변수 + + HANGUL_INFO hi = new HANGUL_INFO(); + + // Char을 16비트 부호없는 정수형 형태로 변환 - Unicode + temp = Convert.ToUInt16(hanChar); + + // 캐릭터가 한글이 아닐 경우 처리 + if ((temp < m_UniCodeHangulBase) || temp > m_UniCodeHangulLast) + { + hi.isHangul = "NH"; + hi.oriChar = hanChar; + hi.chars = null; + } + else + { + // nUniCode에 한글코드에 대한 유니코드 위치를 담고 이를 이용해 인덱스 계산 + int nUniCode = temp - m_UniCodeHangulBase; + + ChoSung = nUniCode / (21 * 28); + nUniCode = nUniCode % (21 * 28); + + JungSung = nUniCode / 28; + nUniCode = nUniCode % 28; + + JongSung = nUniCode; + + hi.isHangul = "H"; + hi.oriChar = hanChar; + hi.chars = new char[] { HTable_ChoSung[ChoSung], HTable_JungSung[JungSung], HTable_JongSung[JongSung] }; + } + return hi; + } + } +} diff --git a/unimarc/unimarc/bin/Debug/UniMarc.exe b/unimarc/unimarc/bin/Debug/UniMarc.exe index 4918e5a..12adbdb 100644 Binary files a/unimarc/unimarc/bin/Debug/UniMarc.exe and b/unimarc/unimarc/bin/Debug/UniMarc.exe differ diff --git a/unimarc/unimarc/bin/Debug/UniMarc.pdb b/unimarc/unimarc/bin/Debug/UniMarc.pdb index aa32052..f27afb4 100644 Binary files a/unimarc/unimarc/bin/Debug/UniMarc.pdb and b/unimarc/unimarc/bin/Debug/UniMarc.pdb differ diff --git a/unimarc/unimarc/bin/Debug/ko/UniMarc.resources.dll b/unimarc/unimarc/bin/Debug/ko/UniMarc.resources.dll index cb347ef..8a43c5f 100644 Binary files a/unimarc/unimarc/bin/Debug/ko/UniMarc.resources.dll and b/unimarc/unimarc/bin/Debug/ko/UniMarc.resources.dll differ diff --git a/unimarc/unimarc/obj/Debug/UniMarc.csproj.AssemblyReference.cache b/unimarc/unimarc/obj/Debug/UniMarc.csproj.AssemblyReference.cache index f5e894a..6019835 100644 Binary files a/unimarc/unimarc/obj/Debug/UniMarc.csproj.AssemblyReference.cache and b/unimarc/unimarc/obj/Debug/UniMarc.csproj.AssemblyReference.cache differ diff --git a/unimarc/unimarc/obj/Debug/UniMarc.csproj.GenerateResource.cache b/unimarc/unimarc/obj/Debug/UniMarc.csproj.GenerateResource.cache index 86a49fe..06ebbd3 100644 Binary files a/unimarc/unimarc/obj/Debug/UniMarc.csproj.GenerateResource.cache and b/unimarc/unimarc/obj/Debug/UniMarc.csproj.GenerateResource.cache differ diff --git a/unimarc/unimarc/obj/Debug/UniMarc.exe b/unimarc/unimarc/obj/Debug/UniMarc.exe index 4918e5a..12adbdb 100644 Binary files a/unimarc/unimarc/obj/Debug/UniMarc.exe and b/unimarc/unimarc/obj/Debug/UniMarc.exe differ diff --git a/unimarc/unimarc/obj/Debug/UniMarc.pdb b/unimarc/unimarc/obj/Debug/UniMarc.pdb index aa32052..f27afb4 100644 Binary files a/unimarc/unimarc/obj/Debug/UniMarc.pdb and b/unimarc/unimarc/obj/Debug/UniMarc.pdb differ diff --git a/unimarc/unimarc/obj/Debug/ko/UniMarc.resources.dll b/unimarc/unimarc/obj/Debug/ko/UniMarc.resources.dll index cb347ef..8a43c5f 100644 Binary files a/unimarc/unimarc/obj/Debug/ko/UniMarc.resources.dll and b/unimarc/unimarc/obj/Debug/ko/UniMarc.resources.dll differ diff --git a/unimarc/unimarc/마크/Check_ISBN_Yes24.Designer.cs b/unimarc/unimarc/마크/Check_ISBN_Yes24.Designer.cs index 3abb420..12e5ba9 100644 --- a/unimarc/unimarc/마크/Check_ISBN_Yes24.Designer.cs +++ b/unimarc/unimarc/마크/Check_ISBN_Yes24.Designer.cs @@ -29,8 +29,8 @@ namespace UniMarc.마크 /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); this.btn_change = new System.Windows.Forms.Button(); this.btn_Close = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); @@ -85,14 +85,14 @@ namespace UniMarc.마크 this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle5.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle7.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.before_book_name, @@ -106,14 +106,14 @@ namespace UniMarc.마크 this.dataGridView1.Location = new System.Drawing.Point(0, 0); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle6.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle8; this.dataGridView1.RowHeadersWidth = 30; this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.Size = new System.Drawing.Size(579, 666); @@ -242,7 +242,7 @@ namespace UniMarc.마크 // // tb_PW // - this.tb_PW.Location = new System.Drawing.Point(761, 12); + this.tb_PW.Location = new System.Drawing.Point(754, 12); this.tb_PW.Name = "tb_PW"; this.tb_PW.Size = new System.Drawing.Size(100, 21); this.tb_PW.TabIndex = 6; @@ -259,7 +259,7 @@ namespace UniMarc.마크 // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(736, 16); + this.label2.Location = new System.Drawing.Point(729, 16); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(23, 12); this.label2.TabIndex = 7; diff --git a/unimarc/unimarc/마크/Check_ISBN_Yes24.cs b/unimarc/unimarc/마크/Check_ISBN_Yes24.cs index 61bcc13..adf255b 100644 --- a/unimarc/unimarc/마크/Check_ISBN_Yes24.cs +++ b/unimarc/unimarc/마크/Check_ISBN_Yes24.cs @@ -58,7 +58,7 @@ namespace UniMarc.마크 { int count = isbn.dataGridView1.Rows.Count; - for(int a= 0; a < count; a++) + for (int a = 0; a < count; a++) { string book_name = isbn.dataGridView1.Rows[a].Cells["book_name"].Value.ToString(); string author = isbn.dataGridView1.Rows[a].Cells["author"].Value.ToString(); @@ -67,7 +67,7 @@ namespace UniMarc.마크 string[] grid = { book_name, Replace_target(book_name, "book_name"), author, Replace_target(author, "author"), - book_comp, Replace_target(book_comp, "book_comp"), + book_comp, Replace_target(book_comp, "book_comp"), unit }; dataGridView1.Rows.Add(grid); diff --git a/unimarc/unimarc/마크/Marc_Plan.cs b/unimarc/unimarc/마크/Marc_Plan.cs index 085c8b5..263f8ec 100644 --- a/unimarc/unimarc/마크/Marc_Plan.cs +++ b/unimarc/unimarc/마크/Marc_Plan.cs @@ -163,14 +163,12 @@ namespace WindowsFormsApp1.Mac if (row < 0) return; - string idx = dataGridView1.Rows[row].Cells["idx"].Value.ToString(); - if (dataGridView1.Rows[row].Cells[col].ReadOnly) { string[] Marc = { dataGridView1.Rows[row].Cells["marc"].Value.ToString(), dataGridView1.Rows[row].Cells["midx"].Value.ToString(), dataGridView1.Rows[row].Cells["num"].Value.ToString(), - idx, + dataGridView1.Rows[row].Cells["idx"].Value.ToString(), dataGridView1.Rows[row].Cells["ISBN"].Value.ToString() }; string[] symbol_Type = { diff --git a/unimarc/unimarc/마크/Marc_Plan_Sub_MarcEdit.Designer.cs b/unimarc/unimarc/마크/Marc_Plan_Sub_MarcEdit.Designer.cs index 8e2b644..5616542 100644 --- a/unimarc/unimarc/마크/Marc_Plan_Sub_MarcEdit.Designer.cs +++ b/unimarc/unimarc/마크/Marc_Plan_Sub_MarcEdit.Designer.cs @@ -733,7 +733,7 @@ namespace UniMarc.마크 this.etcBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.etcBox1.Location = new System.Drawing.Point(4, 4); this.etcBox1.Name = "etcBox1"; - this.etcBox1.Size = new System.Drawing.Size(233, 218); + this.etcBox1.Size = new System.Drawing.Size(233, 220); this.etcBox1.TabIndex = 0; this.etcBox1.Text = ""; // @@ -741,7 +741,7 @@ namespace UniMarc.마크 // this.etcBox2.BorderStyle = System.Windows.Forms.BorderStyle.None; this.etcBox2.Dock = System.Windows.Forms.DockStyle.Fill; - this.etcBox2.Location = new System.Drawing.Point(4, 229); + this.etcBox2.Location = new System.Drawing.Point(4, 231); this.etcBox2.Name = "etcBox2"; this.etcBox2.Size = new System.Drawing.Size(233, 223); this.etcBox2.TabIndex = 0; @@ -754,19 +754,19 @@ namespace UniMarc.마크 this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.Controls.Add(this.etcBox2, 0, 1); this.tableLayoutPanel1.Controls.Add(this.etcBox1, 0, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(859, 267); + this.tableLayoutPanel1.Location = new System.Drawing.Point(859, 266); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 229F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(241, 456); + this.tableLayoutPanel1.Size = new System.Drawing.Size(241, 458); this.tableLayoutPanel1.TabIndex = 0; // // Marc_Plan_Sub_MarcEdit // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1109, 736); + this.ClientSize = new System.Drawing.Size(1111, 736); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.panel4); this.Controls.Add(this.panel2); diff --git a/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.Designer.cs b/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.Designer.cs index 8fb04d8..e1d8b1c 100644 --- a/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.Designer.cs +++ b/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.Designer.cs @@ -29,7 +29,7 @@ namespace UniMarc.마크 /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.tb_Search = new System.Windows.Forms.TextBox(); this.cb_gu = new System.Windows.Forms.ComboBox(); @@ -92,20 +92,20 @@ namespace UniMarc.마크 // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(105, 6); + this.label2.Location = new System.Drawing.Point(103, 6); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(29, 12); + this.label2.Size = new System.Drawing.Size(33, 12); this.label2.TabIndex = 0; - this.label2.Text = "검색"; + this.label2.Text = "검 색"; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 6); + this.label1.Location = new System.Drawing.Point(4, 6); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(29, 12); + this.label1.Size = new System.Drawing.Size(33, 12); this.label1.TabIndex = 0; - this.label1.Text = "구분"; + this.label1.Text = "구 분"; // // btn_Search // @@ -172,14 +172,14 @@ namespace UniMarc.마크 this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle2.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle4.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.idx, @@ -263,7 +263,6 @@ namespace UniMarc.마크 // // btn_OpenFile // - this.btn_OpenFile.Enabled = false; this.btn_OpenFile.Location = new System.Drawing.Point(680, 1); this.btn_OpenFile.Name = "btn_OpenFile"; this.btn_OpenFile.Size = new System.Drawing.Size(61, 29); @@ -288,6 +287,8 @@ namespace UniMarc.마크 this.ClientSize = new System.Drawing.Size(805, 357); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "Marc_Plan_Sub_SelectList"; this.Text = "마크정리_목록선택"; this.Load += new System.EventHandler(this.Marc_Plan_Sub_SelectList_Load); diff --git a/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.cs b/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.cs index 26c10c5..5ed7415 100644 --- a/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.cs +++ b/unimarc/unimarc/마크/Marc_Plan_Sub_SelectList.cs @@ -230,7 +230,7 @@ namespace UniMarc.마크 try { System.IO.StreamReader r = new System.IO.StreamReader(filePath, Encoding.Default); - InputGrid(r.ReadToEnd()); + InputGridByFileData(r.ReadToEnd()); r.Close(); } catch (Exception ex) @@ -239,17 +239,60 @@ namespace UniMarc.마크 } } } + #region OpenFileSub - void InputGrid(string text) + void InputGridByFileData(string text) { + String_Text st = new String_Text(); + + /* "TODO: 마크 파일 내 마크만 표출하여 수정할 수 있게 추가작업 시작할 것." + 1. 목록을 만든다. (목록명은 파일명) + ㄴ> 굳이 저장해서 더 보관할 필요가 있을까? 파일이 있는데? + + 2. 마크 파일내의 마크만 표출한다. **** + ㄴ> 현재 소스파일 분석결과 idx가 없을 경우 몇몇 기능에 장애가 생김. + ㄴ> 만약 저장기능만 제외하고 전부 쓸 수 있게 변경이 된다면? + ㄴ> 현재로썬 가장 가능성있음. DB에 저장할 필요 자체가 없이 로컬로 작업하는 것도 필요하다고 느낌. + */ + string[] grid = text.Split(''); for (int a = 0; a < grid.Length - 1; a++) { + string[] Search = { + // 등록번호, 분류기호, 저자기호, 볼륨v, 복본c, 별치f + "049i", "090a", "090b", "049v", "049c", "049f", + // ISBN, 도서명, 총서명1, 총서번호1, 총서명2, 총서번호2, 출판사, 정가 + "020a", "245a", "440a", "440n", "490a", "490n", "260b", "950b" }; + string[] Search_Res = st.Take_Tag(grid[a], Search); + + string[] Author_Search = { "100a", "110", "111a" }; + string[] Author_Res = st.Take_Tag(grid[a], Author_Search); + string author_Fin = ""; + foreach (string author in Author_Res) + { + if (author != "") { + author_Fin = author; + break; + } + } + + string[] AddGrid = { + // idx, 연번, 등록번호, 분류, 저자기호 + "", "", Search_Res[0], Search_Res[1], Search_Res[2], + // 볼륨v, 복본c, 별치f, 구분, isbn + Search_Res[3], Search_Res[4], Search_Res[5], "", Search_Res[6], + // 도서명, 총서명1, 총서번호1, 총서명1, 총서번호2 + Search_Res[7], Search_Res[8], Search_Res[9], Search_Res[10], Search_Res[11], + // 저자, 출판사, 정가, midx, 마크 + author_Fin, Search_Res[12], Search_Res[13], "", grid[a], + // 검색태그 + "" }; + mp.dataGridView1.Rows.Add(AddGrid); + this.Close(); } } - #endregion private void btn_Close_Click(object sender, EventArgs e) diff --git a/unimarc/unimarc/마크/Search_Infor.Designer.cs b/unimarc/unimarc/마크/Search_Infor.Designer.cs index 6240bef..57cbcbe 100644 --- a/unimarc/unimarc/마크/Search_Infor.Designer.cs +++ b/unimarc/unimarc/마크/Search_Infor.Designer.cs @@ -112,7 +112,7 @@ this.dataGridView1.RowHeadersWidth = 20; this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.Size = new System.Drawing.Size(1449, 630); - this.dataGridView1.TabIndex = 49; + this.dataGridView1.TabIndex = 0; this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick); // // idx @@ -278,7 +278,7 @@ this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1449, 36); - this.panel1.TabIndex = 54; + this.panel1.TabIndex = 0; // // panel5 //