=====* UniMarc [0.0127] 버전 업데이트 내용 *=====
1. 마크 작성 ㄴ> 마크DB에 저장된 마크중 중복된 ISBN을 검색하게 될 경우, N개중 한개를 선택할수 있게 폼 추가 및 내부 소스코드 수정. 2. 마크 선택 ㄴ> 마크 작성의 서브창. ㄴ> 여러개의 목록이 있고, 일반 클릭시 선택된 마크를 그냥 볼수있으며, 더블클릭시 해당 마크로 확정이 지어져 마크 작성으로 넘어오게 됨.
This commit is contained in:
		
							
								
								
									
										260
									
								
								unimarc/unimarc/마크/MarcCopySelect.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										260
									
								
								unimarc/unimarc/마크/MarcCopySelect.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,260 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using System.Data; | ||||
| using System.Drawing; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Forms; | ||||
| using WindowsFormsApp1; | ||||
| using ExcelTest; | ||||
|  | ||||
| namespace UniMarc.마크 | ||||
| { | ||||
|     public partial class MarcCopySelect : Form | ||||
|     { | ||||
|         Helper_DB db = new Helper_DB(); | ||||
|         Marc m; | ||||
|         public int MarcFormRowIndex; | ||||
|  | ||||
|         public MarcCopySelect() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|         } | ||||
|  | ||||
|         public MarcCopySelect(Marc _m) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             m = _m; | ||||
|         } | ||||
|  | ||||
|         public void Init(string isbn) | ||||
|         { | ||||
|             db.DBcon(); | ||||
|                           // 0 1 2 3 4 5 | ||||
|             string Area = "`idx`, `compidx`, `user`, `date`, `grade`, `008tag`, " + | ||||
|                           // 6 7 8 9 10 11 | ||||
|                           "`marc`, `marc_chk`, `marc1`, `marc_chk1`, `marc2`, `marc_chk2`"; | ||||
|             string Table = "Marc"; | ||||
|  | ||||
|             string Query = string.Format("SELECT {0} FROM {1} WHERE isbn = \"{2}\";", Area, Table, isbn); | ||||
|             string Result = db.DB_Send_CMD_Search(Query); | ||||
|             string[] GridData = Result.Split('|'); | ||||
|  | ||||
|             InputGrid(GridData); | ||||
|         } | ||||
|  | ||||
|         private void InputGrid(string[] Value) | ||||
|         { | ||||
|             string[] Grid = { | ||||
|                 "", "", "", "", "", "", "" | ||||
|             }; | ||||
|  | ||||
|             string[] MarcData = { "", "", "", "", "", "" }; | ||||
|  | ||||
|             for (int a = 0; a < Value.Length; a++) | ||||
|             { | ||||
|                 if (a % 12 == 0)    Grid[0] = Value[a];       // idx | ||||
|                 if (a % 12 == 1)    Grid[1] = Value[a];       // compidx | ||||
|                 if (a % 12 == 2)    Grid[2] = Value[a];       // user | ||||
|                 if (a % 12 == 3)    Grid[3] = Value[a];       // date | ||||
|                 if (a % 12 == 4)    Grid[4] = ChangeGrade(Value[a]);       // grade | ||||
|                 if (a % 12 == 5)    Grid[5] = Value[a];       // 008tag | ||||
|                 if (a % 12 == 6)    MarcData[0] = Value[a];   // marc | ||||
|                 if (a % 12 == 7)    MarcData[1] = Value[a];   // marc_chk | ||||
|                 if (a % 12 == 8)    MarcData[2] = Value[a];   // marc1 | ||||
|                 if (a % 12 == 9)    MarcData[3] = Value[a];   // marc_chk1 | ||||
|                 if (a % 12 == 10)   MarcData[4] = Value[a];   // marc2 | ||||
|                 if (a % 12 == 11) { MarcData[5] = Value[a];   // marc_chk2 | ||||
|                     Grid[6] = RealMarc(MarcData); | ||||
|                     dataGridView1.Rows.Add(Grid); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             for (int a = 0; a < dataGridView1.Rows.Count; a++) | ||||
|             { | ||||
|                 string compidx = dataGridView1.Rows[a].Cells["compidx"].Value.ToString(); | ||||
|                 string grade = dataGridView1.Rows[a].Cells["grade"].Value.ToString(); | ||||
|                 string savedate = dataGridView1.Rows[a].Cells["date"].Value.ToString(); | ||||
|  | ||||
|                 bool isMyData = true; | ||||
|  | ||||
|                 if (compidx != Properties.Settings.Default.compidx) {  | ||||
|                     isMyData = false; | ||||
|                     string FindCompCmd = string.Format("SELECT `comp_name` FROM `Comp` WHERE `idx` = {0}", compidx); | ||||
|                     dataGridView1.Rows[a].Cells["user"].Value = db.DB_Send_CMD_Search(FindCompCmd).Replace("|", ""); | ||||
|                     dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.LightGray; | ||||
|                 } | ||||
|  | ||||
|                 dataGridView1.Rows[a].DefaultCellStyle.ForeColor = SetGradeColor(grade, isMyData); | ||||
|                 SaveDataCheck(savedate, a); | ||||
|             } | ||||
|              | ||||
|         } | ||||
|  | ||||
|         private string ChangeGrade(string Grade) | ||||
|         { | ||||
|             switch (Grade) | ||||
|             { | ||||
|                 case "0": | ||||
|                     return "A"; | ||||
|                 case "1": | ||||
|                     return "B"; | ||||
|                 case "2": | ||||
|                     return "C"; | ||||
|                 case "3": | ||||
|                     return "D"; | ||||
|  | ||||
|                 case "A": | ||||
|                     return "0"; | ||||
|                 case "B": | ||||
|                     return "1"; | ||||
|                 case "C": | ||||
|                     return "2"; | ||||
|                 case "D": | ||||
|                     return "3"; | ||||
|  | ||||
|                 default: | ||||
|                     return "D"; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private Color SetGradeColor(string Grade, bool isMyData = true) | ||||
|         { | ||||
|             if (!isMyData) | ||||
|                 return Color.Orange; | ||||
|  | ||||
|             switch (Grade) | ||||
|             { | ||||
|                 case "A": | ||||
|                     return Color.Blue; | ||||
|  | ||||
|                 case "B": | ||||
|                     return Color.Black; | ||||
|  | ||||
|                 case "C": | ||||
|                     return Color.Gray; | ||||
|  | ||||
|                 case "D": | ||||
|                     return Color.Red; | ||||
|  | ||||
|                 default: | ||||
|                     return Color.Black; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void SaveDataCheck(string Date, int row) | ||||
|         { | ||||
|             DateTime SaveDate = DateTime.ParseExact(Date, "yyyy-MM-dd HH:mm:ss", | ||||
|                 System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None); | ||||
|             DateTime TargetDate = DateTime.Today.AddDays(-14); | ||||
|  | ||||
|             int result = DateTime.Compare(SaveDate, TargetDate); | ||||
|  | ||||
|             if (result >= 0)   // SaveDate가 같거나 큼 | ||||
|                 dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.Yellow; | ||||
|  | ||||
|             else               // TargetDate가 큼 | ||||
|                 dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.White; | ||||
|         } | ||||
|  | ||||
|         private string RealMarc(string[] MarcData) | ||||
|         { | ||||
|             string result = ""; | ||||
|             if (MarcData[1] == "1") | ||||
|                 result = MarcData[0]; | ||||
|  | ||||
|             if (MarcData[3] == "1") | ||||
|                 result = MarcData[2]; | ||||
|  | ||||
|             if (MarcData[5] == "1") | ||||
|                 result = MarcData[4]; | ||||
|  | ||||
|             return result; | ||||
|         } | ||||
|  | ||||
|         private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) | ||||
|         { | ||||
|             String_Text st = new String_Text(); | ||||
|             int row = e.RowIndex; | ||||
|  | ||||
|             view_Marc(row); | ||||
|  | ||||
|             st.Color_change("▼", richTextBox1); | ||||
|             st.Color_change("▲", richTextBox1); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 마크데이터가 있는지 확인하고 메모장으로 출력 | ||||
|         /// </summary> | ||||
|         /// <param name="row">해당 데이터의 row값</param> | ||||
|         /// <returns></returns> | ||||
|         void view_Marc(int row) | ||||
|         { | ||||
|             // 마크 데이터 | ||||
|             string Marc_data = dataGridView1.Rows[row].Cells["marc"].Value.ToString(); | ||||
|  | ||||
|             if (Marc_data.Length < 3) return; | ||||
|  | ||||
|             string result = string.Empty; | ||||
|  | ||||
|             List<string> TagNum = new List<string>();   // 태그번호 | ||||
|             List<string> field = new List<string>();    // 가변길이필드 저장 | ||||
|  | ||||
|             // 특수기호 육안으로 확인하기 쉽게 변환 | ||||
|             Marc_data = Marc_data.Replace("", "▼"); | ||||
|             Marc_data = Marc_data.Replace("", "▲"); | ||||
|             Marc_data = Marc_data.Replace("₩", "\\"); | ||||
|             // string leader = Marc_data.Substring(0, 24); | ||||
|  | ||||
|             int startidx = 0; | ||||
|             string[] data = Marc_data.Substring(24).Split('▲'); // 리더부를 제외한 디렉터리, 가변길이필드 저장 | ||||
|  | ||||
|             // List에 필요한 데이터 집어넣는 작업. | ||||
|             for (int a = 1; a < data.Length - 1; a++) | ||||
|             { | ||||
|                 TagNum.Add(data[0].Substring(startidx, 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 | ||||
|                 { | ||||
|                     string temp = field[a].Insert(2, "\t"); | ||||
|                     res += "\t" + temp; | ||||
|                 } | ||||
|                 result += res + "\n"; | ||||
|             } | ||||
|             richTextBox1.Text = result; | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) | ||||
|         { | ||||
|             int row = e.RowIndex; | ||||
|  | ||||
|             string[] GridData = { | ||||
|                 dataGridView1.Rows[row].Cells["idx"].Value.ToString(), | ||||
|                 dataGridView1.Rows[row].Cells["compidx"].Value.ToString(), | ||||
|                 dataGridView1.Rows[row].Cells["user"].Value.ToString(), | ||||
|                 dataGridView1.Rows[row].Cells["date"].Value.ToString(), | ||||
|                 ChangeGrade(dataGridView1.Rows[row].Cells["grade"].Value.ToString()), | ||||
|                 dataGridView1.Rows[row].Cells["tag008"].Value.ToString(), | ||||
|                 dataGridView1.Rows[row].Cells["marc"].Value.ToString() | ||||
|             }; | ||||
|  | ||||
|             m.SelectMarc_Sub(MarcFormRowIndex, GridData); | ||||
|  | ||||
|             this.Close(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 SeungHo Yang
					SeungHo Yang