diff --git a/unimarc/unimarc/Helper/MarcParser.cs b/unimarc/unimarc/Helper/MarcParser.cs new file mode 100644 index 0000000..8e97951 --- /dev/null +++ b/unimarc/unimarc/Helper/MarcParser.cs @@ -0,0 +1,323 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniMarc +{ + public class MarcSubfield + { + public char Code { get; set; } + public string Value { get; set; } + + public MarcSubfield(char code, string value) + { + Code = code; + Value = value; + } + + public override string ToString() + { + return $"▼{Code}{Value}"; + } + } + + public class MarcField + { + public string Tag { get; set; } + public string Indicators { get; set; } = " "; + public string ControlValue { get; set; } + public List Subfields { get; set; } = new List(); + + public bool IsControlField => int.TryParse(Tag, out int tagNum) && tagNum < 10; + + public MarcField(string tag) + { + Tag = tag; + } + + public string GetSubfieldValue(char code) + { + var sub = Subfields.FirstOrDefault(s => s.Code == code); + return sub != null ? sub.Value : string.Empty; + } + + public override string ToString() + { + if (IsControlField) + return $"{Tag}\t \t{ControlValue}▲"; + + StringBuilder sb = new StringBuilder(); + sb.Append($"{Tag}\t{Indicators}\t"); + foreach (var sub in Subfields) + { + sb.Append(sub.ToString()); + } + sb.Append("▲"); + return sb.ToString(); + } + } + + public class MarcParser + { + public string Leader { get; set; } = "00000nam 2200000 k 4500"; + public List Fields { get; set; } = new List(); + + private const char SUBFIELD_MARKER = '▼'; + private const char FIELD_TERMINATOR = '▲'; + private const char RECORD_TERMINATOR = '\x1D'; + + public MarcParser() { } + + public void ParseMnemonic(string data) + { + Fields.Clear(); + if (string.IsNullOrEmpty(data)) return; + + string[] lines = data.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var line in lines) + { + string cleanLine = line.Trim(); + if (cleanLine.Length < 3) continue; + + string tag = cleanLine.Substring(0, 3); + MarcField field = new MarcField(tag); + + string[] parts = cleanLine.Split('\t'); + + if (field.IsControlField) + { + if (parts.Length >= 3) + field.ControlValue = parts[2].TrimEnd(FIELD_TERMINATOR, ' '); + else + field.ControlValue = cleanLine.Substring(Math.Min(cleanLine.Length, 3)).Trim('\t', ' ', FIELD_TERMINATOR); + } + else + { + if (parts.Length >= 2) + field.Indicators = parts[1].PadRight(2).Substring(0, 2); + + string dataPart = parts.Length >= 3 ? parts[2] : ""; + if (parts.Length < 3 && cleanLine.Length > 5) + dataPart = cleanLine.Substring(5); + + dataPart = dataPart.TrimEnd(FIELD_TERMINATOR); + ParseSubfields(field, dataPart); + } + Fields.Add(field); + } + } + + private void ParseSubfields(MarcField field, string dataPart) + { + if (string.IsNullOrEmpty(dataPart)) return; + + if (dataPart.Contains(SUBFIELD_MARKER)) + { + string[] subfields = dataPart.Split(new[] { SUBFIELD_MARKER }, StringSplitOptions.RemoveEmptyEntries); + foreach (var s in subfields) + { + if (s.Length >= 1) + field.Subfields.Add(new MarcSubfield(s[0], s.Substring(1).TrimEnd(FIELD_TERMINATOR))); + } + } + else if (dataPart.Contains('\x1F')) + { + string[] subfields = dataPart.Split(new[] { '\x1F' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var s in subfields) + { + if (s.Length >= 1) + field.Subfields.Add(new MarcSubfield(s[0], s.Substring(1))); + } + } + else + { + for (int k = 0; k < dataPart.Length; k++) + { + if (char.IsLetter(dataPart[k]) && (k == 0 || dataPart[k - 1] == ' ' || dataPart[k - 1] == '^' || dataPart[k - 1] == '\x1F')) + { + char code = dataPart[k]; + int next = -1; + for (int m = k + 1; m < dataPart.Length - 1; m++) + { + if (dataPart[m] == ' ' && char.IsLetter(dataPart[m + 1])) + { + next = m; + break; + } + } + + string val = next == -1 ? dataPart.Substring(k + 1) : dataPart.Substring(k + 1, next - k - 1); + field.Subfields.Add(new MarcSubfield(code, val.Trim())); + if (next != -1) k = next; + else break; + } + } + } + } + + public void ParseFullMarc(string data) + { + Fields.Clear(); + if (string.IsNullOrEmpty(data) || data.Length < 24) return; + + Leader = data.Substring(0, 24); + if (!int.TryParse(Leader.Substring(12, 5), out int baseAddress)) return; + + // Detection: Is the directory using Standard Byte Offsets (ANSI) or Scaled Byte Offsets (Unicode/UTF16)? + bool isScaled = false; + if (data.Length >= 31) + { + if (int.TryParse(data.Substring(27, 4), out int len008) && len008 > 75) + isScaled = true; + } + + int directoryLength = baseAddress - 24; + int entryCount = directoryLength / 12; + + for (int i = 0; i < entryCount; i++) + { + int entryStart = 24 + (i * 12); + if (entryStart + 12 > data.Length) break; + if (data[entryStart] == '\x1E' || data[entryStart] == '^' || data[entryStart] == FIELD_TERMINATOR) break; + + string tag = data.Substring(entryStart, 3); + if (!int.TryParse(data.Substring(entryStart + 3, 4), out int length)) continue; + if (!int.TryParse(data.Substring(entryStart + 7, 5), out int offset)) continue; + + // Scaling logic: directory values represent Unicode byte offsets (2x chars) + // Integer division (offset / 2) maps the byte offset to the starting char index. + // Addition of 1 to length before division handles odd byte-lengths (markers). + int actualOffset = isScaled ? (offset / 2) : offset; + int actualLength = isScaled ? ((length + 1) / 2) : length; + + if (baseAddress + actualOffset >= data.Length) continue; + if (baseAddress + actualOffset + actualLength > data.Length) + actualLength = data.Length - (baseAddress + actualOffset); + + string fieldData = data.Substring(baseAddress + actualOffset, actualLength); + fieldData = fieldData.TrimEnd('\x1E', '\x1D', FIELD_TERMINATOR, '^', ' '); + + MarcField field = new MarcField(tag); + if (field.IsControlField) + field.ControlValue = fieldData; + else + { + if (fieldData.Length >= 2) + { + field.Indicators = fieldData.Substring(0, 2); + ParseSubfields(field, fieldData.Substring(2)); + } + else if (fieldData.Length > 0) + ParseSubfields(field, fieldData); + } + Fields.Add(field); + } + } + + public List GetTag(string path) + { + if (string.IsNullOrEmpty(path)) return new List(); + + string tag = path.Substring(0, 3); + char? subCode = path.Length > 3 ? (char?)path[3] : null; + + var fields = Fields.Where(f => f.Tag == tag).ToList(); + if (fields.Count == 0) return new List(); + + if (typeof(T) == typeof(MarcField)) + return fields.Cast().ToList(); + + if (typeof(T) == typeof(MarcSubfield)) + { + if (!subCode.HasValue) return new List(); + var subResults = new List(); + foreach (var f in fields) + subResults.AddRange(f.Subfields.Where(s => s.Code == subCode.Value)); + return subResults.Cast().ToList(); + } + + if (typeof(T) == typeof(string)) + { + var stringResults = new List(); + foreach (var f in fields) + { + if (f.IsControlField) + stringResults.Add(f.ControlValue); + else + { + if (subCode.HasValue) + stringResults.AddRange(f.Subfields.Where(s => s.Code == subCode.Value).Select(s => s.Value)); + else + stringResults.AddRange(f.Subfields.Select(s => s.Value)); + } + } + return stringResults.Cast().ToList(); + } + + return new List(); + } + + public List GetTag(string path) + { + return GetTag(path); + } + + public void SetTag(string path, string value, string indicators = " ") + { + if (string.IsNullOrEmpty(path) || path.Length < 3) return; + + string tag = path.Substring(0, 3); + bool isControl = int.TryParse(tag, out int tagNum) && tagNum < 10; + + var field = Fields.FirstOrDefault(f => f.Tag == tag); + if (field == null) + { + field = new MarcField(tag) { Indicators = indicators }; + Fields.Add(field); + Fields = Fields.OrderBy(f => f.Tag).ToList(); + } + + if (isControl) + field.ControlValue = value; + else + { + if (path.Length < 4) throw new ArgumentException("Subfield code required for data fields"); + char subCode = path[3]; + var sub = field.Subfields.FirstOrDefault(s => s.Code == subCode); + if (sub != null) sub.Value = value; + else field.Subfields.Add(new MarcSubfield(subCode, value)); + } + } + + public string Get008Segment(int offset, int length) + { + var valLine = GetTag("008").FirstOrDefault(); + if (string.IsNullOrEmpty(valLine) || valLine.Length < offset + length) return string.Empty; + return valLine.Substring(offset, length); + } + + public void Set008Segment(int offset, int length, string value) + { + var valLine = GetTag("008").FirstOrDefault() ?? new string(' ', 40); + if (valLine.Length < 40) valLine = valLine.PadRight(40); + + StringBuilder sb = new StringBuilder(valLine); + for (int i = 0; i < length; i++) + { + char c = (i < value.Length) ? value[i] : ' '; + if (offset + i < sb.Length) + sb[offset + i] = c; + } + SetTag("008", sb.ToString()); + } + + public string ToMnemonicString() + { + StringBuilder sb = new StringBuilder(); + foreach (var field in Fields) + sb.AppendLine(field.ToString()); + return sb.ToString(); + } + } +} diff --git a/unimarc/unimarc/Helper/sample_fullmarc b/unimarc/unimarc/Helper/sample_fullmarc new file mode 100644 index 0000000..59db8b8 --- /dev/null +++ b/unimarc/unimarc/Helper/sample_fullmarc @@ -0,0 +1 @@ +00559nam 2200229 k 4500008004100000020003300041020002400074041000800098049000600106056001300112082001200125090001800137100001100155245004500166260002500211300001600236520000500252653003900257700001100296740001100307950001100318200306s2011 ggk 000 f kor  a9788954615860g04810c^158001 a9788954615853(세트)1 akor v1 a813.6240 a895.734 a813.6b이67퇴1 a이우혁00a퇴마록x退魔錄n1b국내편d이우혁 [지음] a파주b엘릭시르c2011 a663p.c20cm a a퇴마록a한국현대소설a한국장편소설1 a이우혁 0a국내편0 b^15800 \ No newline at end of file diff --git a/unimarc/unimarc/Helper/sample_richtext b/unimarc/unimarc/Helper/sample_richtext new file mode 100644 index 0000000..f062e86 --- /dev/null +++ b/unimarc/unimarc/Helper/sample_richtext @@ -0,0 +1,15 @@ +020 ▼a9788954615877▼g04810▼c\15800▲ +020 1 ▼a9788954615853(세트)▲ +049 ▼v2▲ +056 ▼a813.6▼24▲ +082 0 ▼a895.734▲ +090 ▼a813.6▼b이67퇴▲ +100 1 ▼a이우혁▲ +245 00 ▼a퇴마록▼x退魔錄▼n2▼b국내편▼d이우혁 [지음]▲ +260 ▼a파주▼b엘릭시르▼c2011▲ +300 ▼a600p.▼c20cm▲ +520 ▼a▲ +653 ▼a퇴마록▼a한국현대소설▼a한국장편소설▲ +700 1 ▼a이우혁▲ +740 0 ▼a국내편▲ +950 0 ▼b\15800▲ \ No newline at end of file diff --git a/unimarc/unimarc/Helper_DB.cs b/unimarc/unimarc/Helper_DB.cs index 1ae3961..e7df2ae 100644 --- a/unimarc/unimarc/Helper_DB.cs +++ b/unimarc/unimarc/Helper_DB.cs @@ -101,6 +101,31 @@ namespace UniMarc return (-1, ex.Message); } } + public static (long value, string errorMessage) ExcuteInsertGetIndex(string cmd, MySqlConnection cn = null) + { + long lastId = -1; + var bLocalCN = cn == null; + string message; + try + { + + if (cn == null) cn = CreateConnection(eDbType.unimarc);//new MySqlConnection(cs); + using (var sqlcmd = new MySqlCommand(cmd, cn)) + { + cn.Open(); + sqlcmd.ExecuteNonQuery(); + lastId = sqlcmd.LastInsertedId; + } + if (bLocalCN) cn.Dispose(); + message = ""; + } + catch (Exception ex) + { + lastId = -1; + message = ex.Message; + } + return (lastId, message); + } /// /// 단일항목값을 반환 합니다 diff --git a/unimarc/unimarc/UniMarc.csproj b/unimarc/unimarc/UniMarc.csproj index c95b49c..990d5a5 100644 --- a/unimarc/unimarc/UniMarc.csproj +++ b/unimarc/unimarc/UniMarc.csproj @@ -225,6 +225,7 @@ Reference.svcmap + Form @@ -419,6 +420,7 @@ Mac_List_Edit.cs + Form @@ -2045,6 +2047,8 @@ Reference.svcmap + + @@ -2182,6 +2186,7 @@ + diff --git a/unimarc/unimarc/마크/AddMarc2.Designer.cs b/unimarc/unimarc/마크/AddMarc2.Designer.cs index d414808..67fe282 100644 --- a/unimarc/unimarc/마크/AddMarc2.Designer.cs +++ b/unimarc/unimarc/마크/AddMarc2.Designer.cs @@ -29,52 +29,57 @@ namespace UniMarc /// private void InitializeComponent() { - this.btn_Save = new System.Windows.Forms.Button(); + this.btSaveNew = new System.Windows.Forms.Button(); this.Btn_SearchKolis = new System.Windows.Forms.Button(); this.cb_SearchCol = new System.Windows.Forms.ComboBox(); this.btn_Empty = new System.Windows.Forms.Button(); this.tb_Search = new System.Windows.Forms.TextBox(); this.panel2 = new System.Windows.Forms.Panel(); - this.marcEditorControl1 = new UniMarc.MarcEditorControl(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button2 = new System.Windows.Forms.Button(); this.panel5 = new System.Windows.Forms.Panel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.rtEtc1 = new System.Windows.Forms.RichTextBox(); this.rtEtc2 = new System.Windows.Forms.RichTextBox(); this.panel6 = new System.Windows.Forms.Panel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.lbl_Midx = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); this.radD = new System.Windows.Forms.RadioButton(); this.radC = new System.Windows.Forms.RadioButton(); this.radB = new System.Windows.Forms.RadioButton(); this.radA = new System.Windows.Forms.RadioButton(); this.label6 = new System.Windows.Forms.Label(); this.lbl_SaveData = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.button2 = new System.Windows.Forms.Button(); + this.btSave = new System.Windows.Forms.Button(); + this.marcEditorControl1 = new UniMarc.MarcEditorControl(); this.panel2.SuspendLayout(); + this.groupBox1.SuspendLayout(); this.panel5.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.panel6.SuspendLayout(); + this.panel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); - this.groupBox1.SuspendLayout(); this.SuspendLayout(); // - // btn_Save + // btSaveNew // - this.btn_Save.Location = new System.Drawing.Point(11, 90); - this.btn_Save.Name = "btn_Save"; - this.btn_Save.Size = new System.Drawing.Size(107, 33); - this.btn_Save.TabIndex = 398; - this.btn_Save.Text = "저장(F9)"; - this.btn_Save.UseVisualStyleBackColor = true; - this.btn_Save.Click += new System.EventHandler(this.btn_Save_Click); + this.btSaveNew.Location = new System.Drawing.Point(92, 8); + this.btSaveNew.Name = "btSaveNew"; + this.btSaveNew.Size = new System.Drawing.Size(84, 33); + this.btSaveNew.TabIndex = 398; + this.btSaveNew.Text = "새로추가"; + this.btSaveNew.UseVisualStyleBackColor = true; + this.btSaveNew.Click += new System.EventHandler(this.btn_Save_Click); // // Btn_SearchKolis // this.Btn_SearchKolis.Dock = System.Windows.Forms.DockStyle.Fill; - this.Btn_SearchKolis.Location = new System.Drawing.Point(131, 3); + this.Btn_SearchKolis.Location = new System.Drawing.Point(132, 3); this.Btn_SearchKolis.Name = "Btn_SearchKolis"; - this.Btn_SearchKolis.Size = new System.Drawing.Size(122, 39); + this.Btn_SearchKolis.Size = new System.Drawing.Size(123, 39); this.Btn_SearchKolis.TabIndex = 397; this.Btn_SearchKolis.Text = "코리스 검색"; this.Btn_SearchKolis.UseVisualStyleBackColor = true; @@ -99,7 +104,7 @@ namespace UniMarc this.btn_Empty.Dock = System.Windows.Forms.DockStyle.Fill; this.btn_Empty.Location = new System.Drawing.Point(3, 3); this.btn_Empty.Name = "btn_Empty"; - this.btn_Empty.Size = new System.Drawing.Size(122, 39); + this.btn_Empty.Size = new System.Drawing.Size(123, 39); this.btn_Empty.TabIndex = 396; this.btn_Empty.Text = "비 우 기"; this.btn_Empty.UseVisualStyleBackColor = true; @@ -115,192 +120,23 @@ namespace UniMarc // // panel2 // - this.panel2.Controls.Add(this.marcEditorControl1); - this.panel2.Controls.Add(this.panel5); - this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Controls.Add(this.groupBox1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Left; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(1324, 939); + this.panel2.Padding = new System.Windows.Forms.Padding(8); + this.panel2.Size = new System.Drawing.Size(277, 939); this.panel2.TabIndex = 394; // - // marcEditorControl1 - // - this.marcEditorControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.marcEditorControl1.Font = new System.Drawing.Font("돋움", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.marcEditorControl1.Location = new System.Drawing.Point(0, 0); - this.marcEditorControl1.Name = "marcEditorControl1"; - this.marcEditorControl1.Size = new System.Drawing.Size(1058, 939); - this.marcEditorControl1.TabIndex = 394; - // - // panel5 - // - this.panel5.Controls.Add(this.tableLayoutPanel1); - this.panel5.Controls.Add(this.panel6); - this.panel5.Dock = System.Windows.Forms.DockStyle.Right; - this.panel5.Location = new System.Drawing.Point(1058, 0); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(266, 939); - this.panel5.TabIndex = 395; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 1; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Controls.Add(this.rtEtc1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.rtEtc2, 0, 1); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 377); - 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.Percent, 50F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(266, 562); - this.tableLayoutPanel1.TabIndex = 0; - // - // rtEtc1 - // - this.rtEtc1.BackColor = System.Drawing.SystemColors.ScrollBar; - this.rtEtc1.Dock = System.Windows.Forms.DockStyle.Fill; - this.rtEtc1.Font = new System.Drawing.Font("굴림체", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.rtEtc1.Location = new System.Drawing.Point(3, 3); - this.rtEtc1.Name = "rtEtc1"; - this.rtEtc1.Size = new System.Drawing.Size(260, 275); - this.rtEtc1.TabIndex = 32; - this.rtEtc1.Text = "Remark1"; - // - // rtEtc2 - // - this.rtEtc2.BackColor = System.Drawing.SystemColors.ScrollBar; - this.rtEtc2.Dock = System.Windows.Forms.DockStyle.Fill; - this.rtEtc2.Font = new System.Drawing.Font("굴림체", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.rtEtc2.Location = new System.Drawing.Point(3, 284); - this.rtEtc2.Name = "rtEtc2"; - this.rtEtc2.Size = new System.Drawing.Size(260, 275); - this.rtEtc2.TabIndex = 32; - this.rtEtc2.Text = "Remark2"; - // - // panel6 - // - this.panel6.Controls.Add(this.groupBox1); - this.panel6.Controls.Add(this.tableLayoutPanel2); - this.panel6.Controls.Add(this.button1); - this.panel6.Controls.Add(this.radD); - this.panel6.Controls.Add(this.radC); - this.panel6.Controls.Add(this.radB); - this.panel6.Controls.Add(this.radA); - this.panel6.Controls.Add(this.label6); - this.panel6.Controls.Add(this.btn_Save); - this.panel6.Controls.Add(this.lbl_SaveData); - this.panel6.Dock = System.Windows.Forms.DockStyle.Top; - this.panel6.Location = new System.Drawing.Point(0, 0); - this.panel6.Name = "panel6"; - this.panel6.Padding = new System.Windows.Forms.Padding(5); - this.panel6.Size = new System.Drawing.Size(266, 377); - this.panel6.TabIndex = 1; - // - // radD - // - this.radD.AutoSize = true; - this.radD.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.radD.Location = new System.Drawing.Point(210, 126); - this.radD.Name = "radD"; - this.radD.Size = new System.Drawing.Size(42, 27); - this.radD.TabIndex = 403; - this.radD.TabStop = true; - this.radD.Text = "D"; - this.radD.UseVisualStyleBackColor = true; - // - // radC - // - this.radC.AutoSize = true; - this.radC.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.radC.Location = new System.Drawing.Point(163, 126); - this.radC.Name = "radC"; - this.radC.Size = new System.Drawing.Size(41, 27); - this.radC.TabIndex = 402; - this.radC.TabStop = true; - this.radC.Text = "C"; - this.radC.UseVisualStyleBackColor = true; - // - // radB - // - this.radB.AutoSize = true; - this.radB.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.radB.Location = new System.Drawing.Point(116, 126); - this.radB.Name = "radB"; - this.radB.Size = new System.Drawing.Size(41, 27); - this.radB.TabIndex = 401; - this.radB.TabStop = true; - this.radB.Text = "B"; - this.radB.UseVisualStyleBackColor = true; - // - // radA - // - this.radA.AutoSize = true; - this.radA.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.radA.Location = new System.Drawing.Point(69, 126); - this.radA.Name = "radA"; - this.radA.Size = new System.Drawing.Size(41, 27); - this.radA.TabIndex = 400; - this.radA.TabStop = true; - this.radA.Text = "A"; - this.radA.UseVisualStyleBackColor = true; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.label6.Location = new System.Drawing.Point(28, 136); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(31, 12); - this.label6.TabIndex = 399; - this.label6.Text = "등급"; - // - // lbl_SaveData - // - this.lbl_SaveData.Font = new System.Drawing.Font("굴림체", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.lbl_SaveData.ForeColor = System.Drawing.Color.Black; - this.lbl_SaveData.Location = new System.Drawing.Point(6, 157); - this.lbl_SaveData.Multiline = true; - this.lbl_SaveData.Name = "lbl_SaveData"; - this.lbl_SaveData.Size = new System.Drawing.Size(255, 164); - this.lbl_SaveData.TabIndex = 319; - this.lbl_SaveData.Text = "[] []"; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(154, 90); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(107, 33); - this.button1.TabIndex = 404; - this.button1.Text = "닫기"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.ColumnCount = 2; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Controls.Add(this.btn_Empty, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.Btn_SearchKolis, 1, 0); - this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tableLayoutPanel2.Location = new System.Drawing.Point(5, 327); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 1; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(256, 45); - this.tableLayoutPanel2.TabIndex = 407; - // // groupBox1 // this.groupBox1.Controls.Add(this.button2); this.groupBox1.Controls.Add(this.cb_SearchCol); this.groupBox1.Controls.Add(this.tb_Search); this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.groupBox1.Location = new System.Drawing.Point(5, 5); + this.groupBox1.Location = new System.Drawing.Point(8, 8); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(256, 80); + this.groupBox1.Size = new System.Drawing.Size(261, 79); this.groupBox1.TabIndex = 408; this.groupBox1.TabStop = false; this.groupBox1.Text = "마크 검색"; @@ -315,25 +151,240 @@ namespace UniMarc this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // + // panel5 + // + this.panel5.Controls.Add(this.tableLayoutPanel1); + this.panel5.Controls.Add(this.panel6); + this.panel5.Dock = System.Windows.Forms.DockStyle.Right; + this.panel5.Location = new System.Drawing.Point(1306, 0); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(268, 939); + this.panel5.TabIndex = 395; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.rtEtc1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.rtEtc2, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 455); + 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.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(268, 484); + this.tableLayoutPanel1.TabIndex = 0; + // + // rtEtc1 + // + this.rtEtc1.BackColor = System.Drawing.SystemColors.ScrollBar; + this.rtEtc1.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtEtc1.Font = new System.Drawing.Font("굴림체", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.rtEtc1.Location = new System.Drawing.Point(3, 3); + this.rtEtc1.Name = "rtEtc1"; + this.rtEtc1.Size = new System.Drawing.Size(262, 236); + this.rtEtc1.TabIndex = 32; + this.rtEtc1.Text = "Remark1"; + // + // rtEtc2 + // + this.rtEtc2.BackColor = System.Drawing.SystemColors.ScrollBar; + this.rtEtc2.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtEtc2.Font = new System.Drawing.Font("굴림체", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.rtEtc2.Location = new System.Drawing.Point(3, 245); + this.rtEtc2.Name = "rtEtc2"; + this.rtEtc2.Size = new System.Drawing.Size(262, 236); + this.rtEtc2.TabIndex = 32; + this.rtEtc2.Text = "Remark2"; + // + // panel6 + // + this.panel6.Controls.Add(this.btSave); + this.panel6.Controls.Add(this.panel1); + this.panel6.Controls.Add(this.tableLayoutPanel2); + this.panel6.Controls.Add(this.button1); + this.panel6.Controls.Add(this.radD); + this.panel6.Controls.Add(this.radC); + this.panel6.Controls.Add(this.radB); + this.panel6.Controls.Add(this.radA); + this.panel6.Controls.Add(this.label6); + this.panel6.Controls.Add(this.btSaveNew); + this.panel6.Controls.Add(this.lbl_SaveData); + this.panel6.Dock = System.Windows.Forms.DockStyle.Top; + this.panel6.Location = new System.Drawing.Point(0, 0); + this.panel6.Name = "panel6"; + this.panel6.Padding = new System.Windows.Forms.Padding(5); + this.panel6.Size = new System.Drawing.Size(268, 455); + this.panel6.TabIndex = 1; + // + // panel1 + // + this.panel1.Controls.Add(this.lbl_Midx); + this.panel1.Controls.Add(this.label1); + this.panel1.Location = new System.Drawing.Point(8, 50); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(250, 65); + this.panel1.TabIndex = 410; + // + // lbl_Midx + // + this.lbl_Midx.BackColor = System.Drawing.Color.Tomato; + this.lbl_Midx.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbl_Midx.Font = new System.Drawing.Font("돋움체", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.lbl_Midx.Location = new System.Drawing.Point(0, 27); + this.lbl_Midx.Name = "lbl_Midx"; + this.lbl_Midx.Size = new System.Drawing.Size(250, 38); + this.lbl_Midx.TabIndex = 409; + this.lbl_Midx.Text = "신규 데이터"; + this.lbl_Midx.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label1 + // + this.label1.BackColor = System.Drawing.Color.White; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(250, 27); + this.label1.TabIndex = 408; + this.label1.Text = "MARC INDEX"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Controls.Add(this.btn_Empty, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.Btn_SearchKolis, 1, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; + this.tableLayoutPanel2.Location = new System.Drawing.Point(5, 405); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(258, 45); + this.tableLayoutPanel2.TabIndex = 407; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(179, 8); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(79, 33); + this.button1.TabIndex = 404; + this.button1.Text = "닫기"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // radD + // + this.radD.AutoSize = true; + this.radD.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.radD.Location = new System.Drawing.Point(211, 121); + this.radD.Name = "radD"; + this.radD.Size = new System.Drawing.Size(42, 27); + this.radD.TabIndex = 403; + this.radD.TabStop = true; + this.radD.Text = "D"; + this.radD.UseVisualStyleBackColor = true; + // + // radC + // + this.radC.AutoSize = true; + this.radC.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.radC.Location = new System.Drawing.Point(164, 121); + this.radC.Name = "radC"; + this.radC.Size = new System.Drawing.Size(41, 27); + this.radC.TabIndex = 402; + this.radC.TabStop = true; + this.radC.Text = "C"; + this.radC.UseVisualStyleBackColor = true; + // + // radB + // + this.radB.AutoSize = true; + this.radB.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.radB.Location = new System.Drawing.Point(117, 121); + this.radB.Name = "radB"; + this.radB.Size = new System.Drawing.Size(41, 27); + this.radB.TabIndex = 401; + this.radB.TabStop = true; + this.radB.Text = "B"; + this.radB.UseVisualStyleBackColor = true; + // + // radA + // + this.radA.AutoSize = true; + this.radA.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.radA.Location = new System.Drawing.Point(70, 121); + this.radA.Name = "radA"; + this.radA.Size = new System.Drawing.Size(41, 27); + this.radA.TabIndex = 400; + this.radA.TabStop = true; + this.radA.Text = "A"; + this.radA.UseVisualStyleBackColor = true; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.label6.Location = new System.Drawing.Point(29, 131); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(31, 12); + this.label6.TabIndex = 399; + this.label6.Text = "등급"; + // + // lbl_SaveData + // + this.lbl_SaveData.Font = new System.Drawing.Font("굴림체", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.lbl_SaveData.ForeColor = System.Drawing.Color.Black; + this.lbl_SaveData.Location = new System.Drawing.Point(8, 154); + this.lbl_SaveData.Multiline = true; + this.lbl_SaveData.Name = "lbl_SaveData"; + this.lbl_SaveData.Size = new System.Drawing.Size(255, 244); + this.lbl_SaveData.TabIndex = 319; + this.lbl_SaveData.Text = "[] []"; + // + // btSave + // + this.btSave.Location = new System.Drawing.Point(6, 8); + this.btSave.Name = "btSave"; + this.btSave.Size = new System.Drawing.Size(84, 33); + this.btSave.TabIndex = 411; + this.btSave.Text = "수정"; + this.btSave.UseVisualStyleBackColor = true; + this.btSave.Click += new System.EventHandler(this.btSave_Click); + // + // marcEditorControl1 + // + this.marcEditorControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.marcEditorControl1.Font = new System.Drawing.Font("돋움", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.marcEditorControl1.Location = new System.Drawing.Point(277, 0); + this.marcEditorControl1.Name = "marcEditorControl1"; + this.marcEditorControl1.Size = new System.Drawing.Size(1029, 939); + this.marcEditorControl1.TabIndex = 394; + // // AddMarc2 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Gray; - this.ClientSize = new System.Drawing.Size(1324, 939); + this.ClientSize = new System.Drawing.Size(1574, 939); + this.Controls.Add(this.marcEditorControl1); this.Controls.Add(this.panel2); + this.Controls.Add(this.panel5); this.Name = "AddMarc2"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "마크 작성(2-New)"; this.Load += new System.EventHandler(this.AddMarc_Load); this.panel2.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.panel5.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.panel6.ResumeLayout(false); this.panel6.PerformLayout(); + this.panel1.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); this.ResumeLayout(false); } @@ -345,7 +396,7 @@ namespace UniMarc private System.Windows.Forms.Button btn_Empty; private System.Windows.Forms.Button Btn_SearchKolis; private MarcEditorControl marcEditorControl1; - private System.Windows.Forms.Button btn_Save; + private System.Windows.Forms.Button btSaveNew; private System.Windows.Forms.Panel panel5; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; public System.Windows.Forms.RichTextBox rtEtc1; @@ -361,5 +412,9 @@ namespace UniMarc private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button button2; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label lbl_Midx; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btSave; } } \ No newline at end of file diff --git a/unimarc/unimarc/마크/AddMarc2.cs b/unimarc/unimarc/마크/AddMarc2.cs index f6e641d..970f19f 100644 --- a/unimarc/unimarc/마크/AddMarc2.cs +++ b/unimarc/unimarc/마크/AddMarc2.cs @@ -19,7 +19,6 @@ namespace UniMarc String_Text st = new String_Text(); Help008Tag tag008 = new Help008Tag(); private string mOldMarc = string.Empty; - private MacEditorParameter _param; Main m; public AddMarc2(Main _m) { @@ -33,13 +32,13 @@ namespace UniMarc { cb_SearchCol.SelectedIndex = 0; - + TextReset(); - + this.KeyPreview = true; this.radD.Checked = true; //등급기본 - + } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) @@ -55,61 +54,6 @@ namespace UniMarc { this.marcEditorControl1.SetMarcString(marc); } - private void btn_Save_Click(object sender, EventArgs e) - { - if (marcEditorControl1.CheckValidation() == false) return; - - string dbMarc = marcEditorControl1.MakeMarcString(); - - string tag056 = marcEditorControl1.Tag056();// Tag056(dbMarc, _param); - if(tag056.isEmpty()) - { - UTIL.MsgE("056 태그값을 확인할 수 없습니다\n개발자 문의 하세요"); - return; - } - string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - //string orimarc = st.made_Ori_marc(dbMarc).Replace(@"\", "₩"); - - //if (!isMustTag(orimarc)) - //{ - // return; - //} - var MarcText = dbMarc; - string midx = this.lbl_Midx; - string[] BookData = GetBookData(MarcText); - if(string.Join("",BookData).isEmpty()) - { - UTIL.MsgE("도서정보를 추출할 수 없습니다\n개발자 문의 하세요"); - return; - } - bool IsCoverDate = false; - - if (_param != null && _param.SaveDate != "") - { - // 마지막 수정일로부터 2일이 지났는지, 마지막 저장자가 사용자인지 확인 - TimeSpan sp = CheckDate(_param.SaveDate, date); - IsCoverDate = IsCoverData(sp.Days, _param.User); - } - - bool isUpdate; - if (lbl_Midx != "") - isUpdate = true; - else - isUpdate = false; - - var v_grade = ""; - if (radA.Checked) v_grade = "0"; - else if (radB.Checked) v_grade = "1"; - else if (radC.Checked) v_grade = "2"; - else if (radD.Checked) v_grade = "3"; - - if (isUpdate) - UpdateMarc(midx, dbMarc, v_grade, tag056, date, IsCoverDate, _param); - else - InsertMarc(BookData, dbMarc, v_grade, tag056, date, _param); - - MessageBox.Show("저장되었습니다.", "저장"); - } private void MarcEditorControl1_BookSaved(object sender, EventArgs e) { @@ -117,7 +61,7 @@ namespace UniMarc } - + private void tb_ISBN_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) @@ -132,42 +76,47 @@ namespace UniMarc string SearchText = tb_Search.Text; string SearchCol = cb_SearchCol.SelectedItem.ToString(); - var mcs = new MarcCopySelect2(SearchCol, SearchText); - if (mcs.ShowDialog() == DialogResult.OK) - { - //값을적용해야한다 - //SelectMarc_Sub 함수 내용이 들어오면된다. - } + using (var mcs = new MarcCopySelect2(SearchCol, SearchText)) + if (mcs.ShowDialog() == DialogResult.OK) + { + /// 0:idx

+ /// 1:compidx

+ /// 2:user

+ /// 3:date

+ /// 4:grade

+ /// 5:tag008

+ /// 6:LineMarc + var selected = mcs.SelectedItem; + var defMarc = PUB.MakeEmptyMarc(selected.ISBN, "BookName", "Author", "Publisher", "Price"); + this.marcEditorControl1.LoadBookData(selected.marc_db, selected.ISBN, defMarc); + mOldMarc = selected.marc_db; + + if (selected.compidx != PUB.user.CompanyIdx) + { + UTIL.MsgI($"다른 기관의 데이터 입니다\n신규 등록모드로 실행됩니다.\n\n필요한 경우 입력일자를 업데이트하세요"); + this.lbl_Midx.Text = "신규등록";// ".idx; + this.lbl_Midx.Tag = null; + this.lbl_Midx.BackColor = Color.Tomato; + } + else + { + this.lbl_Midx.Text = selected.idx; + this.lbl_Midx.Tag = selected.idx; + this.lbl_Midx.BackColor = Color.Lime; + + } + + + //가져온 등급으로 변경해준다. + if (selected.Grade == "0") radA.Checked = true; + else if (selected.Grade == "1") radB.Checked = true; + else if (selected.Grade == "2") radC.Checked = true; + else if (selected.Grade == "3") radD.Checked = true; + + rtEtc1.Text = selected.remark1; + rtEtc2.Text = selected.remark2; + } } - /// - /// ISBN 검색후 특정 마크 선택시 현재폼에 적용시키는 폼 - /// - /// 뷰형태 마크데이터 - /// ISBN - /// - /// 0:idx

- /// 1:compidx

- /// 2:user

- /// 3:date

- /// 4:grade

- /// 5:tag008

- /// 6:LineMarc - public void SelectMarc_Sub(string Marc, string ISBN, string[] GridData) - { - _param = new MacEditorParameter - { - ISBN13 = ISBN, - SaveDate = string.Format("[{0}] [{1}]", GridData[2], GridData[3]), - User = GridData[2], - NewMake = true, - text008 = GridData[5] - }; - var debmarc = PUB.MakeEmptyMarc(ISBN, "BookName", "Author", "Publisher", "Price"); - this.marcEditorControl1.LoadBookData(Marc,ISBN, debmarc); - mOldMarc = GridData[6]; - lbl_Midx = GridData[0]; - } - string lbl_Midx = ""; private void btn_close_Click(object sender, EventArgs e) @@ -192,16 +141,15 @@ namespace UniMarc var isbn = $"※{DateTime.Now.ToString("yyMMddhhmmss")}"; var emptryMarc = PUB.MakeEmptyMarc(isbn, "title", "author", "publisher", "price"); var emptymarc = TextResetSub(); - _param = new MacEditorParameter - { - ISBN13 = string.Empty, - SaveDate = string.Empty, - NewMake = true, - }; marcEditorControl1.LoadBookData(string.Empty, isbn, defaultMarc: emptryMarc); + + this.rtEtc1.Text = string.Empty; + this.rtEtc2.Text = string.Empty; + + lbl_Midx.Tag = null; + lbl_Midx.Text = "신규작성"; + lbl_Midx.BackColor = Color.Tomato; } - - } string TextResetSub() @@ -260,8 +208,7 @@ namespace UniMarc /// 마크 등급 /// 분류기호 /// 저장시각 yyyy-MM-dd HH:mm:ss - /// 덮어씌울지 유무 - void UpdateMarc(string MarcIndex, string oriMarc, string grade, string tag056, string date, bool IsCovertDate, MacEditorParameter param) + void UpdateMarc(string MarcIndex, string oriMarc, string grade, string tag056, string tag008, string date) { var etc1 = rtEtc1.Text.Trim(); var etc2 = rtEtc2.Text.Trim(); @@ -276,7 +223,7 @@ namespace UniMarc string[] EditColumn = { PUB.user.CompanyIdx, oriMarc, "1",mOldMarc, "0", etc1, - etc2, tag056, param.text008, date, PUB.user.UserName, + etc2, tag056, tag008, date, PUB.user.UserName, grade.ToString() }; @@ -312,9 +259,15 @@ namespace UniMarc //} string UpCMD = db.More_Update("Marc", EditTable, EditColumn, SearchTable, SearchColumn); PUB.log.Add("ADDMarcUPDATE", string.Format("{0}({1}) : {2}", PUB.user.UserName, PUB.user.CompanyIdx, UpCMD.Replace("\r", " ").Replace("\n", " "))); - Helper_DB.ExcuteNonQuery(UpCMD); + var rlt = Helper_DB.ExcuteNonQuery(UpCMD); + if (rlt.applyCount != 1) + UTIL.MsgE(rlt.errorMessage); + else + UTIL.MsgI("변경 완료"); } + + /// /// 마크DB에 INSERT해주는 함수 /// @@ -324,7 +277,7 @@ namespace UniMarc /// 마크 등급 /// 분류기호 /// 저장시각 yyyy-MM-dd HH:mm:ss - void InsertMarc(string[] BookData, string oriMarc, string grade, string tag056, string date, MacEditorParameter param) + void InsertMarc(string[] BookData, string oriMarc, string grade, string tag056, string tag008, string date) { if (grade.isEmpty()) grade = "2"; var etc1 = rtEtc1.Text.Trim(); @@ -336,17 +289,32 @@ namespace UniMarc "user", "division", "008tag", "date", "compidx" }; + //데이터중복검사필요 + //동일 isbnd있다면 그래도 저장할건지 한번 더 물어봐야 함 + if (DB_Utils.ExistISBN(BookData[0])) + { + if (UTIL.MsgQ("동일한 ISBN이 이미 존재합니다. 그래도 저장하시겠습니까?") == DialogResult.No) + return; + } string[] InsertColumn = { BookData[0], BookData[1], BookData[2], BookData[3], BookData[4], oriMarc, etc1, etc2, grade.ToString(), "1", - PUB.user.UserName, tag056, param.text008, date, PUB.user.CompanyIdx + PUB.user.UserName, tag056, tag008, date, PUB.user.CompanyIdx }; string InCMD = db.DB_INSERT("Marc", InsertTable, InsertColumn); PUB.log.Add("ADDMarcINSERT", string.Format("{0}({1}) : {2}", PUB.user.UserName, PUB.user.CompanyIdx, InCMD.Replace("\r", " ").Replace("\n", " "))); - Helper_DB.ExcuteNonQuery(InCMD); + var rlt = Helper_DB.ExcuteInsertGetIndex(InCMD); + if (rlt.errorMessage.isEmpty() == false) + UTIL.MsgE(rlt.errorMessage); + else + { + lbl_Midx.Tag = rlt.value.ToString(); + lbl_Midx.Text = rlt.value.ToString(); + UTIL.MsgI($"저장 완료\n\nIDX:{rlt.value}"); + } } /// @@ -374,68 +342,7 @@ namespace UniMarc - /// - /// 필수태그 검사 - /// - /// 한줄짜리 마크 - /// 필수태그 없을시 false 반환 - private bool isMustTag(string orimarc) - { - string[] SearchTag = { "056a", "0562", "245a", "245d", "260a", "260c", "300a", "300c", "653a" }; - string[] Tag = st.Take_Tag(orimarc, SearchTag); - int count = 0; - string msg = ""; - bool isTag = true; - foreach (string tag in Tag) - { - if (tag == "") - { - msg += SearchTag[count] + " "; - isTag = false; - } - count++; - } - if (!isTag) - { - MessageBox.Show(msg + "태그가 없습니다."); - return false; - } - - bool is1XX = false; - string[] AuthorTag = { "100a", "110a", "111a" }; - Tag = st.Take_Tag(orimarc, AuthorTag); - foreach (string author in Tag) - { - if (author != "") - is1XX = true; - } - if (!is1XX) - { - MessageBox.Show("기본표목이 존재하지않습니다."); - return false; - } - - bool is7XX = false; - AuthorTag[0] = "700a"; - AuthorTag[1] = "710a"; - AuthorTag[2] = "711a"; - Tag = st.Take_Tag(orimarc, AuthorTag); - - foreach (string author in Tag) - { - if (author != "") - is7XX = true; - } - - if (!is7XX) - { - MessageBox.Show("부출표목이 존재하지않습니다."); - return false; - } - - return true; - } /// /// 관련 도서 정보를 가져옴 @@ -476,48 +383,40 @@ namespace UniMarc result[3] = GetMiddelString(tmp[2], "▼b", "▼"); } + //파서를 사용해서 변경한다 + var parser = new UniMarc.MarcParser(); + parser.ParseMnemonic(ViewMarc); + + //ISBN와 가격 (처음나오는 020태그의 값을 적용) + var tag_020 = parser.GetTag("020").FirstOrDefault(); + if (tag_020 != null) + { + result[0] = tag_020.GetSubfieldValue('a'); + result[4] = tag_020.GetSubfieldValue('c'); + } + + //저자(100 -> 110 -> 111 순으로 적용) + var tag_100 = parser.GetTag("100").FirstOrDefault(); + var tag_110 = parser.GetTag("110").FirstOrDefault(); + var tag_111 = parser.GetTag("111").FirstOrDefault(); + if (tag_111 != null) + result[2] = tag_111.GetSubfieldValue('a'); + else if (tag_110 != null) + result[2] = tag_110.GetSubfieldValue('a'); + else if (tag_100 != null) + result[2] = tag_100.GetSubfieldValue('a'); + + //서명 + var tag_245 = parser.GetTag("245a").FirstOrDefault(); + result[1] = tag_245?.Value ?? string.Empty; + + //출판사 + var tag_300b = parser.GetTag("300b").FirstOrDefault(); + result[3] = tag_300b?.Value ?? string.Empty; + return result; } - string Tag056(string marc, MacEditorParameter param) - { - // string marc = richTextBox1.Text; - string[] temp = marc.Split('\n'); - List target = temp.ToList(); - bool isEight = false; - bool eight_chk = false; - string tag056 = string.Empty; - int count = 0; - - for (int a = 0; a < target.Count - 1; a++) - { - string[] tmp = target[a].Split('\t'); - string tag = tmp[0]; - if (tag == "") break; - int eight = Convert.ToInt32(tag.Substring(0, 3)); - if (eight == 008) - { - count = a; - eight_chk = true; - isEight = true; - } - else if (eight > 008 && !eight_chk) - { - count = a; - eight_chk = true; - } - if (tag == "056") - tag056 = GetMiddelString(tmp[2], "▼a", "▼"); - } - if (!isEight) - target.Insert(count, string.Format("{0}\t{1}\t{2}▲", "008", " ", param.text008)); - - //richTextBox1.Text = string.Join("\n", target.ToArray()); - return tag056; - } - - - /// /// 문자와 문자사이의 값 가져오기 /// @@ -623,5 +522,95 @@ namespace UniMarc { searchMarc(); } + + private void btSave_Click(object sender, EventArgs e) + { + var midx = lbl_Midx.Tag?.ToString() ?? string.Empty; + if (midx.isEmpty()) + { + UTIL.MsgE("저장할 마크를 불러오세요\n신규마크작성상태에서는 추가 버튼을 사용하세요"); + return; + } + SaveData(true); + } + private void btn_Save_Click(object sender, EventArgs e) + { + SaveData(false); + } + + void SaveData(bool isUpdate) + { + string tag008 = marcEditorControl1.text008.Text; + + //입력일자를 업데이트할지 확인한다. + if (isUpdate == false) + { + var inputdate = tag008.Substring(0, 6); + if (inputdate == "000000") + inputdate = DateTime.Now.ToString("yyMMdd"); + else + { + if (UTIL.MsgQ($"입력일자({inputdate})를 오늘로 변경할까요?") == DialogResult.Yes) + { + tag008 = DateTime.Now.ToString("yyMMdd") + tag008.Substring(6); + marcEditorControl1.text008.Text = tag008; + } + } + } + + if (marcEditorControl1.CheckValidation() == false) return; + + + + string tag056 = marcEditorControl1.Tag056(out string with008TagOutput);// Tag056(dbMarc, _param); + + //tag056을 호출해야 008이추가된다.그런후에 데이터를 처리해야함 + string fullMarc = marcEditorControl1.MakeMarcString(); + var marcString = marcEditorControl1.richTextBox1.Text; + + var parser = new UniMarc.MarcParser(); + parser.ParseMnemonic(marcString); + + //풀마크분석은 아직 오류가 있음. + var parserF = new UniMarc.MarcParser(); + parserF.ParseFullMarc(fullMarc); + + var v_056 = parser.GetTag("056a").FirstOrDefault() ?? string.Empty; + + if (tag056.isEmpty()) + { + UTIL.MsgE("056 태그값을 확인할 수 없습니다\n개발자 문의 하세요"); + return; + } + string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //string orimarc = st.made_Ori_marc(dbMarc).Replace(@"\", "₩"); + + //if (!isMustTag(orimarc)) + //{ + // return; + //} + //var MarcText = fullMarc; + string midx = this.lbl_Midx.Tag?.ToString() ?? string.Empty; + string[] BookData = GetBookData(marcString); + if (string.Join("", BookData).isEmpty()) + { + UTIL.MsgE("도서정보를 추출할 수 없습니다\n개발자 문의 하세요"); + return; + } + + var v_grade = ""; + if (radA.Checked) v_grade = "0"; + else if (radB.Checked) v_grade = "1"; + else if (radC.Checked) v_grade = "2"; + else if (radD.Checked) v_grade = "3"; + + if (isUpdate) + UpdateMarc(midx, fullMarc, v_grade, tag056, tag008, date); + else + InsertMarc(BookData, fullMarc, v_grade, tag056, tag008, date); + + + } + } } diff --git a/unimarc/unimarc/마크/Marc2.cs b/unimarc/unimarc/마크/Marc2.cs index 5ecd040..7da3f9e 100644 --- a/unimarc/unimarc/마크/Marc2.cs +++ b/unimarc/unimarc/마크/Marc2.cs @@ -535,13 +535,14 @@ namespace UniMarc { if (copySelect.ShowDialog() == DialogResult.OK) { - dr.MarcIdx = copySelect.GridData[0]; - dr.User = copySelect.GridData[2]; - dr.SaveDate = copySelect.GridData[4]; - dr.Grade = copySelect.GridData[3]; - // text008.Text = GridData[5]; - dr.DbMarc = copySelect.GridData[6]; - mOldMarc = copySelect.GridData[6]; + var selected = copySelect.SelectedItem; + dr.MarcIdx = selected.idx; + dr.User = selected.User; + dr.SaveDate = selected.Date; + dr.Grade = selected.Grade; + // text008.Text = selected.Tag008; + dr.DbMarc = selected.marc_db; + mOldMarc = selected.marc_db; // row.ForeColor = SetGradeColor(row.Grade); // Handled by MarcBookItem automatically dr.BackColor = Color.Yellow; @@ -919,9 +920,8 @@ namespace UniMarc private void button2_Click(object sender, EventArgs e) { - marcEditorControl1.Tag056(); // 008 태그가 richTextBox1에 포함되도록 갱신 - var orimarc = st.made_Ori_marc(marcEditorControl1.richTextBox1).Replace(@"\", "₩"); - var fb = new Marc_CopyForm(orimarc); + var fullmarc = marcEditorControl1.MakeMarcString(); + var fb = new Marc_CopyForm(fullmarc); fb.ShowDialog(); } @@ -951,14 +951,11 @@ namespace UniMarc } } + this.Param.text008 = marcEditorControl1.text008.Text.Trim(); + this.Param.tag056 = marcEditorControl1.Tag056(out string with008fullmarcstring); string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - string orimarc = marcEditorControl1.MakeMarcString();// st.made_Ori_marc(marcEditorControl1.richTextBox1).Replace(@"\", "₩"); - - - - this.Param.text008 = marcEditorControl1.text008.Text.Trim(); - this.Param.tag056 = marcEditorControl1.Tag056(); + string orimarc = marcEditorControl1.MakeMarcString(); //아래는 실제 폼에서의 저장코드 diff --git a/unimarc/unimarc/마크/Marc2.designer.cs b/unimarc/unimarc/마크/Marc2.designer.cs index 9a164d1..807c97b 100644 --- a/unimarc/unimarc/마크/Marc2.designer.cs +++ b/unimarc/unimarc/마크/Marc2.designer.cs @@ -96,20 +96,20 @@ this.etc1 = new System.Windows.Forms.RichTextBox(); this.etc2 = new System.Windows.Forms.RichTextBox(); this.panel6 = new System.Windows.Forms.Panel(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.btCopy = new System.Windows.Forms.Button(); + this.btn_FillBlank = new System.Windows.Forms.Button(); + this.btPrev = new System.Windows.Forms.Button(); + this.btNext = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); this.radD = new System.Windows.Forms.RadioButton(); this.radC = new System.Windows.Forms.RadioButton(); this.radB = new System.Windows.Forms.RadioButton(); this.radA = new System.Windows.Forms.RadioButton(); this.lbl_SaveData = new System.Windows.Forms.TextBox(); - this.button2 = new System.Windows.Forms.Button(); - this.btNext = new System.Windows.Forms.Button(); - this.btPrev = new System.Windows.Forms.Button(); this.btn_Save = new System.Windows.Forms.Button(); - this.btn_FillBlank = new System.Windows.Forms.Button(); this.label6 = new System.Windows.Forms.Label(); this.marcEditorControl1 = new UniMarc.MarcEditorControl(); - this.button3 = new System.Windows.Forms.Button(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); label31 = new System.Windows.Forms.Label(); label30 = new System.Windows.Forms.Label(); label33 = new System.Windows.Forms.Label(); @@ -683,6 +683,7 @@ // this.bindingNavigatorPositionItem.AccessibleName = "위치"; this.bindingNavigatorPositionItem.AutoSize = false; + this.bindingNavigatorPositionItem.Font = new System.Drawing.Font("맑은 고딕", 9F); this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem"; this.bindingNavigatorPositionItem.Size = new System.Drawing.Size(50, 23); this.bindingNavigatorPositionItem.Text = "0"; @@ -794,6 +795,78 @@ this.panel6.TabIndex = 1; this.panel6.Paint += new System.Windows.Forms.PaintEventHandler(this.panel6_Paint); // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Controls.Add(this.btCopy, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.btn_FillBlank, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.btPrev, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.btNext, 1, 1); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 215); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 2; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(266, 93); + this.tableLayoutPanel2.TabIndex = 406; + // + // btCopy + // + this.btCopy.Dock = System.Windows.Forms.DockStyle.Fill; + this.btCopy.Location = new System.Drawing.Point(3, 3); + this.btCopy.Name = "btCopy"; + this.btCopy.Size = new System.Drawing.Size(127, 40); + this.btCopy.TabIndex = 231; + this.btCopy.Text = "유사본"; + this.btCopy.UseVisualStyleBackColor = true; + this.btCopy.Click += new System.EventHandler(this.button2_Click); + // + // btn_FillBlank + // + this.btn_FillBlank.Dock = System.Windows.Forms.DockStyle.Fill; + this.btn_FillBlank.Location = new System.Drawing.Point(136, 3); + this.btn_FillBlank.Name = "btn_FillBlank"; + this.btn_FillBlank.Size = new System.Drawing.Size(127, 40); + this.btn_FillBlank.TabIndex = 228; + this.btn_FillBlank.Text = "미소장 마크 코리스\r\n칸채우기"; + this.btn_FillBlank.UseVisualStyleBackColor = true; + this.btn_FillBlank.Click += new System.EventHandler(this.btn_FillBlank_Click); + // + // btPrev + // + this.btPrev.Dock = System.Windows.Forms.DockStyle.Fill; + this.btPrev.Location = new System.Drawing.Point(3, 49); + this.btPrev.Name = "btPrev"; + this.btPrev.Size = new System.Drawing.Size(127, 41); + this.btPrev.TabIndex = 229; + this.btPrev.Text = "이 전(F7)"; + this.btPrev.UseVisualStyleBackColor = true; + this.btPrev.Click += new System.EventHandler(this.btPrev_Click); + // + // btNext + // + this.btNext.Dock = System.Windows.Forms.DockStyle.Fill; + this.btNext.Location = new System.Drawing.Point(136, 49); + this.btNext.Name = "btNext"; + this.btNext.Size = new System.Drawing.Size(127, 41); + this.btNext.TabIndex = 230; + this.btNext.Text = "다 음(F8)"; + this.btNext.UseVisualStyleBackColor = true; + this.btNext.Click += new System.EventHandler(this.btNext_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(147, 6); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(107, 33); + this.button3.TabIndex = 405; + this.button3.Text = "닫기"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // // radD // this.radD.AutoSize = true; @@ -854,39 +927,6 @@ this.lbl_SaveData.TabIndex = 319; this.lbl_SaveData.Text = "[] []"; // - // button2 - // - this.button2.Dock = System.Windows.Forms.DockStyle.Fill; - this.button2.Location = new System.Drawing.Point(3, 3); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(127, 40); - this.button2.TabIndex = 231; - this.button2.Text = "유사본"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // btNext - // - this.btNext.Dock = System.Windows.Forms.DockStyle.Fill; - this.btNext.Location = new System.Drawing.Point(136, 49); - this.btNext.Name = "btNext"; - this.btNext.Size = new System.Drawing.Size(127, 41); - this.btNext.TabIndex = 230; - this.btNext.Text = "다 음(F8)"; - this.btNext.UseVisualStyleBackColor = true; - this.btNext.Click += new System.EventHandler(this.btNext_Click); - // - // btPrev - // - this.btPrev.Dock = System.Windows.Forms.DockStyle.Fill; - this.btPrev.Location = new System.Drawing.Point(3, 49); - this.btPrev.Name = "btPrev"; - this.btPrev.Size = new System.Drawing.Size(127, 41); - this.btPrev.TabIndex = 229; - this.btPrev.Text = "이 전(F7)"; - this.btPrev.UseVisualStyleBackColor = true; - this.btPrev.Click += new System.EventHandler(this.btPrev_Click); - // // btn_Save // this.btn_Save.Location = new System.Drawing.Point(11, 6); @@ -897,17 +937,6 @@ this.btn_Save.UseVisualStyleBackColor = true; this.btn_Save.Click += new System.EventHandler(this.btn_Save_Click); // - // btn_FillBlank - // - this.btn_FillBlank.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_FillBlank.Location = new System.Drawing.Point(136, 3); - this.btn_FillBlank.Name = "btn_FillBlank"; - this.btn_FillBlank.Size = new System.Drawing.Size(127, 40); - this.btn_FillBlank.TabIndex = 228; - this.btn_FillBlank.Text = "미소장 마크 코리스\r\n칸채우기"; - this.btn_FillBlank.UseVisualStyleBackColor = true; - this.btn_FillBlank.Click += new System.EventHandler(this.btn_FillBlank_Click); - // // label6 // this.label6.AutoSize = true; @@ -928,34 +957,6 @@ this.marcEditorControl1.Size = new System.Drawing.Size(817, 658); this.marcEditorControl1.TabIndex = 0; // - // button3 - // - this.button3.Location = new System.Drawing.Point(147, 6); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(107, 33); - this.button3.TabIndex = 405; - this.button3.Text = "닫기"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.ColumnCount = 2; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Controls.Add(this.button2, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.btn_FillBlank, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.btPrev, 0, 1); - this.tableLayoutPanel2.Controls.Add(this.btNext, 1, 1); - this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 215); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 2; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(266, 93); - this.tableLayoutPanel2.TabIndex = 406; - // // Marc2 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -1047,7 +1048,7 @@ public System.Windows.Forms.RichTextBox etc1; public System.Windows.Forms.RichTextBox etc2; private System.Windows.Forms.Panel panel6; - private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button btCopy; private System.Windows.Forms.Button btNext; private System.Windows.Forms.Button btPrev; private System.Windows.Forms.Button btn_Save; diff --git a/unimarc/unimarc/마크/MarcCopyItem.cs b/unimarc/unimarc/마크/MarcCopyItem.cs new file mode 100644 index 0000000..500fc98 --- /dev/null +++ b/unimarc/unimarc/마크/MarcCopyItem.cs @@ -0,0 +1,44 @@ +using System; + +namespace UniMarc +{ + public class MarcCopyItem + { + public string idx { get; set; } + public string compidx { get; set; } + public string ISBN { get; set; } + public string Title { get; set; } + public string Author { get; set; } + public string Comp { get; set; } + public string User { get; set; } + public string Date { get; set; } + public string Grade { get; set; } + public string Tag008 { get; set; } + public string Marc { get; set; } // Calculated real MARC + + // Raw MARC segments from DB + public string marc_db { get; set; } + public string marc_chk { get; set; } + public string marc1 { get; set; } + public string marc_chk1 { get; set; } + public string marc2 { get; set; } + public string marc_chk2 { get; set; } + + public string remark1 { get; set; } + public string remark2 { get; set; } + public string DisplayGrade + { + get + { + switch (Grade) + { + case "0": return "A"; + case "1": return "B"; + case "2": return "C"; + case "3": return "D"; + default: return Grade; + } + } + } + } +} diff --git a/unimarc/unimarc/마크/MarcCopySelect2.Designer.cs b/unimarc/unimarc/마크/MarcCopySelect2.Designer.cs index fa2b6f9..674b2e0 100644 --- a/unimarc/unimarc/마크/MarcCopySelect2.Designer.cs +++ b/unimarc/unimarc/마크/MarcCopySelect2.Designer.cs @@ -42,26 +42,30 @@ namespace UniMarc this.btn_Close = new System.Windows.Forms.Button(); this.btn_Delete = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); - this.panel3 = new System.Windows.Forms.Panel(); - this.bs1 = new System.Windows.Forms.BindingSource(this.components); this.bindingNavigator1 = new System.Windows.Forms.BindingNavigator(this.components); + this.bs1 = new System.Windows.Forms.BindingSource(this.components); + this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel(); this.bindingNavigatorMoveFirstItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorMovePreviousItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorSeparator = new System.Windows.Forms.ToolStripSeparator(); this.bindingNavigatorPositionItem = new System.Windows.Forms.ToolStripTextBox(); - this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel(); this.bindingNavigatorSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.bindingNavigatorMoveNextItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorMoveLastItem = new System.Windows.Forms.ToolStripButton(); this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.panel3 = new System.Windows.Forms.Panel(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.rtEtc1 = new System.Windows.Forms.RichTextBox(); + this.rtEtc2 = new System.Windows.Forms.RichTextBox(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); - this.panel3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.bs1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingNavigator1)).BeginInit(); this.bindingNavigator1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bs1)).BeginInit(); + this.panel3.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // dataGridView1 @@ -83,7 +87,7 @@ namespace UniMarc this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(1109, 107); + this.dataGridView1.Size = new System.Drawing.Size(1293, 210); this.dataGridView1.TabIndex = 0; this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick); this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick); @@ -102,7 +106,7 @@ namespace UniMarc this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(1109, 33); + this.panel1.Size = new System.Drawing.Size(1293, 33); this.panel1.TabIndex = 1; // // progressBar1 @@ -135,7 +139,8 @@ namespace UniMarc this.cb_SearchFilter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cb_SearchFilter.FormattingEnabled = true; this.cb_SearchFilter.Items.AddRange(new object[] { - "도서명", + "ISBN", + "서명", "저자", "출판사"}); this.cb_SearchFilter.Location = new System.Drawing.Point(11, 5); @@ -180,30 +185,9 @@ namespace UniMarc this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Location = new System.Drawing.Point(0, 33); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(1109, 134); + this.panel2.Size = new System.Drawing.Size(1293, 237); this.panel2.TabIndex = 2; // - // richTextBox1 - // - this.richTextBox1.BackColor = System.Drawing.Color.LightGray; - this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.richTextBox1.Font = new System.Drawing.Font("굴림체", 11.25F); - this.richTextBox1.Location = new System.Drawing.Point(0, 0); - this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(1109, 512); - this.richTextBox1.TabIndex = 0; - this.richTextBox1.Text = ""; - // - // panel3 - // - this.panel3.Controls.Add(this.richTextBox1); - this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel3.Location = new System.Drawing.Point(0, 167); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(1109, 512); - this.panel3.TabIndex = 3; - // // bindingNavigator1 // this.bindingNavigator1.AddNewItem = null; @@ -222,17 +206,24 @@ namespace UniMarc this.bindingNavigatorMoveNextItem, this.bindingNavigatorMoveLastItem, this.bindingNavigatorSeparator2}); - this.bindingNavigator1.Location = new System.Drawing.Point(0, 107); + this.bindingNavigator1.Location = new System.Drawing.Point(0, 210); this.bindingNavigator1.MoveFirstItem = this.bindingNavigatorMoveFirstItem; this.bindingNavigator1.MoveLastItem = this.bindingNavigatorMoveLastItem; this.bindingNavigator1.MoveNextItem = this.bindingNavigatorMoveNextItem; this.bindingNavigator1.MovePreviousItem = this.bindingNavigatorMovePreviousItem; this.bindingNavigator1.Name = "bindingNavigator1"; this.bindingNavigator1.PositionItem = this.bindingNavigatorPositionItem; - this.bindingNavigator1.Size = new System.Drawing.Size(1109, 27); + this.bindingNavigator1.Size = new System.Drawing.Size(1293, 27); this.bindingNavigator1.TabIndex = 4; this.bindingNavigator1.Text = "bindingNavigator1"; // + // bindingNavigatorCountItem + // + this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem"; + this.bindingNavigatorCountItem.Size = new System.Drawing.Size(27, 24); + this.bindingNavigatorCountItem.Text = "/{0}"; + this.bindingNavigatorCountItem.ToolTipText = "전체 항목 수"; + // // bindingNavigatorMoveFirstItem // this.bindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -266,16 +257,9 @@ namespace UniMarc this.bindingNavigatorPositionItem.Text = "0"; this.bindingNavigatorPositionItem.ToolTipText = "현재 위치"; // - // bindingNavigatorCountItem - // - this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem"; - this.bindingNavigatorCountItem.Size = new System.Drawing.Size(27, 24); - this.bindingNavigatorCountItem.Text = "/{0}"; - this.bindingNavigatorCountItem.ToolTipText = "전체 항목 수"; - // // bindingNavigatorSeparator1 // - this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator"; + this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1"; this.bindingNavigatorSeparator1.Size = new System.Drawing.Size(6, 27); // // bindingNavigatorMoveNextItem @@ -298,14 +282,73 @@ namespace UniMarc // // bindingNavigatorSeparator2 // - this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator"; + this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2"; this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 27); // + // richTextBox1 + // + this.richTextBox1.BackColor = System.Drawing.Color.LightGray; + this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.richTextBox1.Font = new System.Drawing.Font("굴림체", 11.25F); + this.richTextBox1.Location = new System.Drawing.Point(0, 0); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(1050, 528); + this.richTextBox1.TabIndex = 0; + this.richTextBox1.Text = ""; + // + // panel3 + // + this.panel3.Controls.Add(this.richTextBox1); + this.panel3.Controls.Add(this.tableLayoutPanel1); + this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel3.Location = new System.Drawing.Point(0, 270); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1293, 528); + this.panel3.TabIndex = 3; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.rtEtc1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.rtEtc2, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Right; + this.tableLayoutPanel1.Location = new System.Drawing.Point(1050, 0); + 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.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(243, 528); + this.tableLayoutPanel1.TabIndex = 1; + // + // rtEtc1 + // + this.rtEtc1.BackColor = System.Drawing.SystemColors.ScrollBar; + this.rtEtc1.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtEtc1.Font = new System.Drawing.Font("굴림체", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.rtEtc1.Location = new System.Drawing.Point(3, 3); + this.rtEtc1.Name = "rtEtc1"; + this.rtEtc1.Size = new System.Drawing.Size(237, 258); + this.rtEtc1.TabIndex = 32; + this.rtEtc1.Text = "Remark1"; + // + // rtEtc2 + // + this.rtEtc2.BackColor = System.Drawing.SystemColors.ScrollBar; + this.rtEtc2.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtEtc2.Font = new System.Drawing.Font("굴림체", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.rtEtc2.Location = new System.Drawing.Point(3, 267); + this.rtEtc2.Name = "rtEtc2"; + this.rtEtc2.Size = new System.Drawing.Size(237, 258); + this.rtEtc2.TabIndex = 32; + this.rtEtc2.Text = "Remark2"; + // // MarcCopySelect2 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1109, 679); + this.ClientSize = new System.Drawing.Size(1293, 798); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); @@ -316,11 +359,12 @@ namespace UniMarc this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); - this.panel3.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.bs1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingNavigator1)).EndInit(); this.bindingNavigator1.ResumeLayout(false); this.bindingNavigator1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bs1)).EndInit(); + this.panel3.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); } @@ -350,5 +394,8 @@ namespace UniMarc private System.Windows.Forms.ToolStripButton bindingNavigatorMoveNextItem; private System.Windows.Forms.ToolStripButton bindingNavigatorMoveLastItem; private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + public System.Windows.Forms.RichTextBox rtEtc1; + public System.Windows.Forms.RichTextBox rtEtc2; } } \ No newline at end of file diff --git a/unimarc/unimarc/마크/MarcCopySelect2.cs b/unimarc/unimarc/마크/MarcCopySelect2.cs index e30d2a8..dcad011 100644 --- a/unimarc/unimarc/마크/MarcCopySelect2.cs +++ b/unimarc/unimarc/마크/MarcCopySelect2.cs @@ -14,18 +14,32 @@ namespace UniMarc public partial class MarcCopySelect2 : Form { Helper_DB db = new Helper_DB(); - MarcBookItem item; + SortableBindingList _list = new SortableBindingList(); + + public MarcCopyItem SelectedItem { get; private set; } public MarcCopySelect2(string search_col, string search_Target) { InitializeComponent(); db.DBcon(); - cb_SearchFilter.Text = search_col; - if(cb_SearchFilter.SelectedIndex <0) + // Lowercase mapping for common inputs from Marc2.cs or AddMarc2.cs + string normalizedCol = search_col; + if (search_col != null && search_col.ToLower() == "isbn") normalizedCol = "ISBN"; + else if (search_col == "도서명") normalizedCol = "서명"; + + cb_SearchFilter.Text = normalizedCol; + if (cb_SearchFilter.SelectedIndex < 0) cb_SearchFilter.SelectedIndex = 0; tb_SearchBox.Text = search_Target; + SettingGrid_Book(); + bs1.DataSource = _list; + dataGridView1.DataSource = bs1; + dataGridView1.CellFormatting += dataGridView1_CellFormatting; + + if (!string.IsNullOrEmpty(search_Target)) + btn_Search_Click(null, null); } @@ -43,130 +57,136 @@ namespace UniMarc var search_Target = tb_SearchBox.Text.Trim(); var search_col = cb_SearchFilter.Text.Trim(); - SettingGrid_Book(); if (search_Target == "") return; // 0 1 2 3 4 - string Area = "`idx`, `compidx`, `ISBN`, `서명`, `저자`, " + + string Area = "`idx`, `compidx`, `ISBN`, `서명` AS Title, `저자` AS Author, " + // 5 6 7 8 9 - "`출판사`, `user`, `date`, `grade`, `008tag`, " + + "`출판사` AS Comp, `user`, `date`, `grade`, `008tag`, " + // 10 11 12 13 14 15 - "`marc`, `marc_chk`, `marc1`, `marc_chk1`, `marc2`, `marc_chk2`"; + "`marc` AS marc_db, `marc_chk`, `marc1`, `marc_chk1`, `marc2`, `marc_chk2`, `비고1` as remark1, `비고2` as remark2"; string Table = "Marc"; string Query = string.Format("SELECT {0} FROM {1} WHERE `{2}` like \"%{3}%\";", Area, Table, search_col, search_Target); - string Result = db.DB_Send_CMD_Search(Query); - string[] GridData = Result.Split('|'); + DataTable dt = db.DB_Send_CMD_Search_DataTable(Query); - InputGrid(GridData); + InputGrid(dt); } private void SettingGrid_Book() { DataGridView dgv = dataGridView1; - dgv.Columns.Add("idx", "idx"); - dgv.Columns.Add("compidx", "compidx"); - dgv.Columns.Add("isbn", "ISBN"); - dgv.Columns.Add("Title", "서명"); - dgv.Columns.Add("Author", "저자"); - dgv.Columns.Add("Comp", "출판사"); - dgv.Columns.Add("user", "수정자"); - dgv.Columns.Add("date", "수정시각"); - dgv.Columns.Add("grade", "등급"); - dgv.Columns.Add("tag008", "008Tag"); - dgv.Columns.Add("marc", "Marc"); + dgv.AutoGenerateColumns = false; + dgv.Columns.Clear(); - dgv.Columns["idx"].Visible = false; - dgv.Columns["compidx"].Visible = false; - dgv.Columns["user"].Width = 120; - dgv.Columns["date"].Width = 120; - dgv.Columns["grade"].Width = 60; - dgv.Columns["tag008"].Width = 150; - dgv.Columns["marc"].Width = 200; + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "idx", HeaderText = "idx", Name = "idx", Visible = false }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "compidx", HeaderText = "compidx", Name = "compidx", Visible = false }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ISBN", HeaderText = "ISBN", Name = "isbn", Width = 100 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Title", HeaderText = "서명", Name = "Title", Width = 200 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Author", HeaderText = "저자", Name = "Author", Width = 150 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Comp", HeaderText = "출판사", Name = "Comp", Width = 150 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "User", HeaderText = "수정자", Name = "user", Width = 120 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Date", HeaderText = "수정시각", Name = "date", Width = 150 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "DisplayGrade", HeaderText = "등급", Name = "grade", Width = 60 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Tag008", HeaderText = "008Tag", Name = "tag008", Width = 150 }); + dgv.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Marc", HeaderText = "Marc", Name = "marc", Width = 200 }); } - private void InputGrid(string[] Value) + private void InputGrid(DataTable dt) { + _list.Clear(); + if (dt == null || dt.Rows.Count == 0) return; + progressBar1.Value = 0; - progressBar1.Maximum = Value.Length / 16; + progressBar1.Maximum = dt.Rows.Count; - string[] Grid = { - "", "", "", "", "", - "", "", "", "", "", - "" }; - string[] MarcData = { "", "", "", "", "", "" }; - - for (int a = 0; a < Value.Length; a++) + foreach (DataRow row in dt.Rows) { - if (a % 16 == 0) Grid[0] = Value[a]; // idx - if (a % 16 == 1) Grid[1] = Value[a]; // compidx - if (a % 16 == 2) Grid[2] = Value[a]; // isbn - if (a % 16 == 3) Grid[3] = Value[a]; // 서명 - if (a % 16 == 4) Grid[4] = Value[a]; // 저자 - if (a % 16 == 5) Grid[5] = Value[a]; // 출판사 - if (a % 16 == 6) Grid[6] = Value[a]; // user - if (a % 16 == 7) Grid[7] = Value[a]; // date - if (a % 16 == 8) Grid[8] = ChangeGrade(Value[a]); // grade - if (a % 16 == 9) Grid[9] = Value[a]; // 008tag - if (a % 16 == 10) MarcData[0] = Value[a]; // marc - if (a % 16 == 11) MarcData[1] = Value[a]; // marc_chk - if (a % 16 == 12) MarcData[2] = Value[a]; // marc1 - if (a % 16 == 13) MarcData[3] = Value[a]; // marc_chk1 - if (a % 16 == 14) MarcData[4] = Value[a]; // marc2 - if (a % 16 == 15) { MarcData[5] = Value[a]; // marc_chk2 - Grid[10] = RealMarc(MarcData); - dataGridView1.Rows.Add(Grid); + var item = new MarcCopyItem + { + idx = row["idx"].ToString(), + compidx = row["compidx"].ToString(), + ISBN = row["ISBN"].ToString(), + Title = row["Title"].ToString(), + Author = row["Author"].ToString(), + Comp = row["Comp"].ToString(), + User = row["user"].ToString(), + Date = row["date"].ToString(), + Grade = row["grade"].ToString(), + Tag008 = row["008tag"].ToString(), + marc_db = row["marc_db"].ToString(), + marc_chk = row["marc_chk"].ToString(), + marc1 = row["marc1"].ToString(), + marc_chk1 = row["marc_chk1"].ToString(), + marc2 = row["marc2"].ToString(), + marc_chk2 = row["marc_chk2"].ToString(), + remark1 = row["remark1"].ToString(), + remark2 = row["remark2"].ToString(), + }; + + // Calculate real Marc based on check flags + item.Marc = CalculateRealMarc(item); + + // For other company data, replace User with company name + if (item.compidx != PUB.user.CompanyIdx) + { + string FindCompCmd = string.Format("SELECT `comp_name` FROM `Comp` WHERE `idx` = {0}", item.compidx); + item.User = db.DB_Send_CMD_Search(FindCompCmd).Replace("|", ""); + } + + _list.Add(item); + if (progressBar1.Value < progressBar1.Maximum) progressBar1.Value += 1; - } - } - - 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 != PUB.user.CompanyIdx) { - 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) + private string CalculateRealMarc(MarcCopyItem item) { - 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"; - } + if (item.marc_chk == "1") return item.marc_db; + if (item.marc_chk1 == "1") return item.marc1; + if (item.marc_chk2 == "1") return item.marc2; + return ""; } + private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) + { + if (e.RowIndex < 0 || e.RowIndex >= dataGridView1.Rows.Count) return; + + var item = (MarcCopyItem)dataGridView1.Rows[e.RowIndex].DataBoundItem; + if (item == null) return; + + bool isMyData = (item.compidx == PUB.user.CompanyIdx); + + // Row background color + if (!isMyData) + { + dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightGray; + } + else + { + // Date check for yellow highlight + if (!string.IsNullOrEmpty(item.Date)) + { + try + { + DateTime saveDate = DateTime.ParseExact(item.Date, "yyyy-MM-dd HH:mm:ss", + System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None); + DateTime targetDate = DateTime.Today.AddDays(-14); + + if (DateTime.Compare(saveDate, targetDate) >= 0) + dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Yellow; + else + dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White; + } + catch { dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White; } + } + } + + // Grade color + dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = SetGradeColor(item.DisplayGrade, isMyData); + } + + private Color SetGradeColor(string Grade, bool isMyData = true) { if (!isMyData) @@ -188,36 +208,6 @@ namespace UniMarc } } - 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(); @@ -231,15 +221,18 @@ namespace UniMarc st.Color_change("▲", richTextBox1); } - /// - /// 마크데이터가 있는지 확인하고 메모장으로 출력 - /// - /// 해당 데이터의 row값 - /// void view_Marc(int row) { - // 마크 데이터 - string Marc_data = dataGridView1.Rows[row].Cells["marc"].Value.ToString(); + this.rtEtc1.Text = string.Empty; + this.rtEtc2.Text = string.Empty; + + var item = (MarcCopyItem)dataGridView1.Rows[row].DataBoundItem; + if (item == null || string.IsNullOrEmpty(item.Marc)) return; + + rtEtc1.Text = item.remark1; + rtEtc2.Text = item.remark2; + + string Marc_data = item.Marc; if (Marc_data.Length < 3) return; @@ -252,7 +245,6 @@ namespace UniMarc 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('▲'); // 리더부를 제외한 디렉터리, 가변길이필드 저장 @@ -289,35 +281,14 @@ namespace UniMarc if (e.RowIndex < 0) return; SelectMarc(e.RowIndex); } - public string[] GridData; + void SelectMarc(int row) { - GridData = new string[]{ - dataGridView1.Rows[row].Cells["idx"].Value.ToString(), - dataGridView1.Rows[row].Cells["compidx"].Value.ToString(), - dataGridView1.Rows[row].Cells["user"].Value.ToString(), - ChangeGrade(dataGridView1.Rows[row].Cells["grade"].Value.ToString()), - dataGridView1.Rows[row].Cells["date"].Value.ToString(), - dataGridView1.Rows[row].Cells["tag008"].Value.ToString(), - dataGridView1.Rows[row].Cells["marc"].Value.ToString() - }; - - var fullMarc = dataGridView1.Rows[row].Cells["marc"].Value.ToString(); + var item = (MarcCopyItem)dataGridView1.Rows[row].DataBoundItem; + if (item == null) return; + SelectedItem = item; this.DialogResult = DialogResult.OK; - //if (m2 != null) - //{ - // m2.SelectMarc_Sub(this.item, GridData); - //} - - - //if (am2 != null) - //{ - // string Marc = richTextBox1.Text; - // string isbn = dataGridView1.Rows[row].Cells["isbn"].Value.ToString(); - // am2.SelectMarc_Sub(fullMarc, isbn, GridData); - //} - //this.Close(); } private void btn_Close_Click(object sender, EventArgs e) @@ -327,15 +298,26 @@ namespace UniMarc private void btn_Delete_Click(object sender, EventArgs e) { - if (dataGridView1.CurrentCell.RowIndex < -1) + if (dataGridView1.CurrentRow == null) return; + int row = dataGridView1.CurrentRow.Index; + if (row < 0) return; + + var item = (MarcCopyItem)dataGridView1.Rows[row].DataBoundItem; + if (item == null) return; + + string idx = item.idx; + string compidx = item.compidx; + + if (compidx != PUB.user.CompanyIdx) + { + MessageBox.Show("해당 마크를 삭제할 권한이 없습니다.", "삭제"); + return; + } + + if (MessageBox.Show("삭제하시겠습니까?", "삭제!", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; - int row = dataGridView1.CurrentCell.RowIndex; - - string idx = dataGridView1.Rows[row].Cells["idx"].Value.ToString(); - string User = PUB.user.UserName; - string compidx = PUB.user.CompanyIdx; string NowDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string SelectArea = "`compidx`, `grade`, `ISBN`, `서명`, `총서명`, " + @@ -347,15 +329,6 @@ namespace UniMarc string SelectRes = db.self_Made_Cmd(SelectCMD); string[] SelectAry = SelectRes.Split('|'); - if (SelectAry[0] != compidx) - { - MessageBox.Show("해당 마크를 삭제할 권한이 없습니다.", "삭제"); - return; - } - - if (MessageBox.Show("삭제하시겠습니까?", "삭제!", MessageBoxButtons.OKCancel) == DialogResult.Cancel) - return; - string[] InsertCol = { "compidx", "grade", "ISBN", "서명", "총서명", "저자", "출판사", "출판년월", "가격", "008tag", @@ -363,20 +336,11 @@ namespace UniMarc "date", "user_Del", "marc" }; - string marc = ""; - - if (SelectAry[16] == "1") - marc = SelectAry[15]; - else if (SelectAry[18] == "1") - marc = SelectAry[17]; - else if (SelectAry[20] == "1") - marc = SelectAry[19]; - string[] InsertData = { SelectAry[0], SelectAry[1], SelectAry[2], SelectAry[3], SelectAry[4], SelectAry[5], SelectAry[6], SelectAry[7], SelectAry[8], SelectAry[9], SelectAry[10], SelectAry[11], SelectAry[12], SelectAry[13], SelectAry[14], - NowDate, User, marc + NowDate, User, item.Marc }; string InsertCmd = db.DB_INSERT("Marc_Del", InsertCol, InsertData); @@ -385,7 +349,7 @@ namespace UniMarc string DeleteCmd = string.Format("DELETE FROM `Marc` WHERE `idx` = {0};", idx); Helper_DB.ExcuteNonQuery(DeleteCmd); - dataGridView1.Rows.Remove(dataGridView1.Rows[row]); + _list.RemoveAt(_list.IndexOf(item)); } private void btn_ShowDeleteMarc_Click(object sender, EventArgs e) @@ -396,13 +360,12 @@ namespace UniMarc private void dataGridView1_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Enter) { - if (dataGridView1.CurrentCell.RowIndex < 0) - return; + if (dataGridView1.CurrentRow == null) return; + int row = dataGridView1.CurrentRow.Index; + if (row < 0) return; - int row = dataGridView1.CurrentCell.RowIndex; SelectMarc(row); } } diff --git a/unimarc/unimarc/마크/MarcCopySelect2.resx b/unimarc/unimarc/마크/MarcCopySelect2.resx index 80dc2f2..8074ff8 100644 --- a/unimarc/unimarc/마크/MarcCopySelect2.resx +++ b/unimarc/unimarc/마크/MarcCopySelect2.resx @@ -126,42 +126,42 @@ - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAExSURBVDhPY2AYNKBw1vP/TQue/8+c+Pg/uhwMhLc/wCnH - kDvz2f9VR97/x6UovvvB/+CGa1jlwCBjytP/C/d9wKoovufh/6X7///3r76AIQcHCT1P/k/b8h5DUUT7 - fbDmzFn//3uVnsBtQGTXo/+9qz+gKAptvQfW3Lru/3//zr//XfIP4DYgsPnh/7r57+CKglvu/l+09/// - jnX//2fM+fnfru7nf/uM7bgN8Ki6/z9/2hsURXbFt/+nz/n937/r23+dwnf/LRLW4zbAvvTu/+zJrzEU - 6aec/29S9OK/Stan/8aRy3AbYJF3539q/2usigySTvyXTfv6Xzd4HoYcHBhm3f4f1vISpyL91Mv/NXyn - YZUDA520G//9qh/iVaTiMQGnHINT7pX/IAV4FQ1KAADwdsCrWJS2HgAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wQAADsEBuJFr7QAAATFJREFUOE9jYBg0oHDW8/9NC57/z5z4+D+6HAyEtz/AKceQO/PZ/1VH3v/HpSi+ + +8H/4IZrWOXAIGPK0/8L933Aqii+5+H/pfv///evvoAhBwcJPU/+T9vyHkNRRPt9sObMWf//e5WewG1A + ZNej/72rP6AoCm29B9bcuu7/f//Ov/9d8g/gNiCw+eH/uvnv4IqCW+7+X7T3//+Odf//Z8z5+d+u7ud/ + +4ztuA3wqLr/P3/aGxRFdsW3/6fP+f3fv+vbf53Cd/8tEtbjNsC+9O7/7MmvMRTpp5z/b1L04r9K1qf/ + xpHLcBtgkXfnf2r/a6yKDJJO/JdN+/pfN3gehhwcGGbd/h/W8hKnIv3Uy/81fKdhlQMDnbQb//2qH+JV + pOIxAaccg1Pulf8gBXgVDUoAAPB2wKtYlLYeAAAAAElFTkSuQmCC - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAC7SURBVDhPY2AYMiC8/cF/dDGiQXz3g//BDdfIMyC+5+H/ - pfv///evvkC6ARHt98GaM2f9/+9VeoI0A0Jb74E1t677/9+/8+9/l/wDxBsQ3HL3/6K9//93rPv/P2PO - z/92dT//22dsJ94AELArvv0/fc7v//5d3/7rFL77b5GwnjQDQEA/5fx/k6IX/1WyPv03jlxGugEgYJB0 - 4r9s2tf/usHzyDMABPRTL//X8J1GvgEgoOIxgTIDBi8AANAUYJgsLP+3AAAAAElFTkSuQmCC + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wQAADsEBuJFr7QAAALtJREFUOE9jYBgyILz9wX90MaJBfPeD/8EN18gzIL7n4f+l+///96++QLoBEe33 + wZozZ/3/71V6gjQDQlvvgTW3rvv/37/z73+X/APEGxDccvf/or3//3es+/8/Y87P/3Z1P//bZ2wn3gAQ + sCu+/T99zu///l3f/usUvvtvkbCeNANAQD/l/H+Tohf/VbI+/TeOXEa6ASBgkHTiv2za1/+6wfPIMwAE + 9FMv/9fwnUa+ASCg4jGBMgMGLwAA0BRgmCws/7cAAAAASUVORK5CYII= - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACkSURBVDhPY2AYdKBw1vP/6GIkgdyZz/4ndN8j35CMKU// - z9v/+39C1x3yDEnoefJ/9r5f/zu3/v3vVnqZdEMiux79n7Lt1/+SpX//J0z/+98m9yxphgQ2P/zfuvY9 - WLNxyZf/0tHX/htHLiPeEI+q+/9L5r6Da1Z06SFeMwjYl979H9jyjDzNIGCRd+e/TcEV8jSDgGHWbfI1 - g4BO2g3yNQ9NAACgfl+gY6ualwAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wQAADsEBuJFr7QAAAKRJREFUOE9jYBh0oHDW8//oYiSB3JnP/id03yPfkIwpT//P2//7f0LXHfIMSeh5 + 8n/2vl//O7f+/e9Wepl0QyK7Hv2fsu3X/5Klf/8nTP/73yb3LGmGBDY//N+69j1Ys3HJl//S0df+G0cu + I94Qj6r7/0vmvoNrVnTpIV4zCNiX3v0f2PKMPM0gYJF3579NwRXyNIOAYdZt8jWDgE7aDfI1D00AAKB+ + X6Bjq5qXAAAAAElFTkSuQmCC - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAErSURBVDhPY2AYVKBw1vP/6GIwAJJrWvD8f+bExzjVMOTO - fPY/ofseVgUguVVH3v8Pb3+AVR4MMqY8/T9v/+//CV13MBSB5Bbu+/A/uOEahhwcJPQ8+T9736//nVv/ - /ncrvYyiECQ3bcv7//7VF3AbENn16P+Ubb/+lyz9+z9h+t//Nrln4YpBcr2rP/z3Kj2B24DA5of/W9e+ - B2s2LvnyXzr62n/jyGVgDSC5uvnv/rvkH8BtgEfV/f8lc9/BNSu69MAVg+Typ735b5+xHbcB9qV3/we2 - PMPQDJPLnvz6v0XCetwGWOTd+W9TcAVDM0wutf813EtYgWHWbayaQQAkF9by8r9u8Dys8mCgk3YDpyRI - zq/64X8N32k41eAFTrlX/qt4TABjdLmBBQC+0b+zZl1WGAAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wQAADsEBuJFr7QAAAStJREFUOE9jYBhUoHDW8//oYjAAkmta8Px/5sTHONUw5M589j+h+x5WBSC5VUfe + /w9vf4BVHgwypjz9P2//7/8JXXcwFIHkFu778D+44RqGHBwk9Dz5P3vfr/+dW//+dyu9jKIQJDdty/v/ + /tUXcBsQ2fXo/5Rtv/6XLP37P2H63/82uWfhikFyvas//PcqPYHbgMDmh/9b174HazYu+fJfOvraf+PI + ZWANILm6+e/+u+QfwG2AR9X9/yVz38E1K7r0wBWD5PKnvflvn7EdtwH2pXf/B7Y8w9AMk8ue/Pq/RcJ6 + 3AZY5N35b1NwBUMzTC61/zXcS1iBYdZtrJpBACQX1vLyv27wPKzyYKCTdgOnJEjOr/rhfw3faTjV4AVO + uVf+q3hMAGN0uYEFAL7Rv7NmXVYYAAAAAElFTkSuQmCC \ No newline at end of file diff --git a/unimarc/unimarc/마크/MarcEditorControl.Designer.cs b/unimarc/unimarc/마크/MarcEditorControl.Designer.cs index c6edabe..619f1bf 100644 --- a/unimarc/unimarc/마크/MarcEditorControl.Designer.cs +++ b/unimarc/unimarc/마크/MarcEditorControl.Designer.cs @@ -28,14 +28,14 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - 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(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); this.label31 = new System.Windows.Forms.Label(); this.label30 = new System.Windows.Forms.Label(); this.label33 = new System.Windows.Forms.Label(); @@ -357,11 +357,15 @@ // label1 // this.label1.AutoSize = true; + this.label1.Cursor = System.Windows.Forms.Cursors.Hand; + this.label1.Font = new System.Drawing.Font("돋움", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.label1.ForeColor = System.Drawing.Color.Blue; this.label1.Location = new System.Drawing.Point(454, 11); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(53, 12); this.label1.TabIndex = 14; this.label1.Text = "입력일자"; + this.label1.Click += new System.EventHandler(this.label1_Click); // // label2 // @@ -644,7 +648,6 @@ this.input_date.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.input_date.Location = new System.Drawing.Point(510, 7); this.input_date.Name = "input_date"; - this.input_date.ShowCheckBox = true; this.input_date.Size = new System.Drawing.Size(116, 21); this.input_date.TabIndex = 220; this.input_date.ValueChanged += new System.EventHandler(this.input_date_ValueChanged); @@ -800,8 +803,8 @@ this.GridView020.Name = "GridView020"; this.GridView020.RowHeadersVisible = false; this.GridView020.RowHeadersWidth = 30; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.GridView020.RowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.GridView020.RowsDefaultCellStyle = dataGridViewCellStyle17; this.GridView020.RowTemplate.Height = 23; this.GridView020.Size = new System.Drawing.Size(408, 80); this.GridView020.TabIndex = 0; @@ -875,8 +878,8 @@ this.GridView505.Name = "GridView505"; this.GridView505.RowHeadersVisible = false; this.GridView505.RowHeadersWidth = 30; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.GridView505.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.GridView505.RowsDefaultCellStyle = dataGridViewCellStyle18; this.GridView505.RowTemplate.Height = 23; this.GridView505.Size = new System.Drawing.Size(401, 71); this.GridView505.TabIndex = 2; @@ -1015,14 +1018,14 @@ this.GridView246.AllowDrop = true; this.GridView246.AllowUserToAddRows = false; this.GridView246.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle3.Font = new System.Drawing.Font("돋움", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.GridView246.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle19.Font = new System.Drawing.Font("돋움", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.GridView246.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19; this.GridView246.ColumnHeadersHeight = 29; this.GridView246.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Text246Jisi, @@ -1035,8 +1038,8 @@ this.GridView246.Name = "GridView246"; this.GridView246.RowHeadersVisible = false; this.GridView246.RowHeadersWidth = 30; - dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.GridView246.RowsDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle20.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.GridView246.RowsDefaultCellStyle = dataGridViewCellStyle20; this.GridView246.RowTemplate.Height = 23; this.GridView246.Size = new System.Drawing.Size(542, 138); this.GridView246.TabIndex = 31; @@ -1195,14 +1198,14 @@ this.GridView440.AllowDrop = true; this.GridView440.AllowUserToAddRows = false; this.GridView440.AllowUserToResizeRows = false; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle5.Font = new System.Drawing.Font("돋움", 9.75F, 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.GridView440.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle21.Font = new System.Drawing.Font("돋움", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle21.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle21.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.GridView440.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle21; this.GridView440.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.GridView440.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.text440a, @@ -1215,8 +1218,8 @@ this.GridView440.Name = "GridView440"; this.GridView440.RowHeadersVisible = false; this.GridView440.RowHeadersWidth = 30; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.GridView440.RowsDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle22.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.GridView440.RowsDefaultCellStyle = dataGridViewCellStyle22; this.GridView440.RowTemplate.Height = 23; this.GridView440.Size = new System.Drawing.Size(597, 71); this.GridView440.TabIndex = 18; @@ -1324,14 +1327,14 @@ this.GridView490.AllowDrop = true; this.GridView490.AllowUserToAddRows = false; this.GridView490.AllowUserToResizeRows = false; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle7.Font = new System.Drawing.Font("돋움", 9.75F, 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.GridView490.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle23.Font = new System.Drawing.Font("돋움", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.GridView490.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23; this.GridView490.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.GridView490.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.text490a, @@ -1340,8 +1343,8 @@ this.GridView490.Name = "GridView490"; this.GridView490.RowHeadersVisible = false; this.GridView490.RowHeadersWidth = 30; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.GridView490.RowsDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle24.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.GridView490.RowsDefaultCellStyle = dataGridViewCellStyle24; this.GridView490.RowTemplate.Height = 23; this.GridView490.Size = new System.Drawing.Size(370, 71); this.GridView490.TabIndex = 19; diff --git a/unimarc/unimarc/마크/MarcEditorControl.cs b/unimarc/unimarc/마크/MarcEditorControl.cs index b8d7829..0e790d4 100644 --- a/unimarc/unimarc/마크/MarcEditorControl.cs +++ b/unimarc/unimarc/마크/MarcEditorControl.cs @@ -152,7 +152,11 @@ namespace UniMarc } else { - text008.Text = "180507s2016 ulka c 000 f kor "; + string yyMMdd = DateTime.Now.ToString("yyMMdd"); + string yyyy = DateTime.Now.ToString("yyyy"); + string Empty_008 = yyMMdd + "s" + yyyy + " 000 kor "; + + text008.Text = Empty_008;// "180507s2016 ulka c 000 f kor "; data008 = text008.Text; } @@ -284,7 +288,11 @@ namespace UniMarc /// public string MakeMarcString() { - return st.made_Ori_marc(richTextBox1).Replace(@"\", "₩"); + //008태그를 본문에 추가해야하낟. + var tag_056 = Tag056(out string with008TagOutput); + + //008태그가 포함된 전체 문자를 사용해야한다 + return st.made_Ori_marc(with008TagOutput).Replace(@"\", "₩"); } private void etc_KeyDown(object sender, KeyEventArgs e) @@ -298,6 +306,7 @@ namespace UniMarc private void comboBox1_MouseClick(object sender, MouseEventArgs e) { ((ComboBox)sender).DroppedDown = true; + UpdateTextColor(); } private void text008col_KeyDown(object sender, KeyEventArgs e) @@ -461,8 +470,8 @@ namespace UniMarc if (!isTag) { - MessageBox.Show(msg + "태그가 없습니다."); - return false; + if (UTIL.MsgQ(msg + "태그가 없습니다.\n\n진행 할까요?") != DialogResult.Yes) + return false; } bool is1XX = false; @@ -477,8 +486,8 @@ namespace UniMarc if (!is1XX) { - MessageBox.Show("기본표목(100a | 110a | 111a)이 존재하지않습니다."); - return false; + if (UTIL.MsgQ("기본표목(100a | 110a | 111a)이 존재하지않습니다.\n\n진행 할까요?") != DialogResult.Yes) + return false; } bool is7XX = false; @@ -495,8 +504,8 @@ namespace UniMarc if (!is7XX) { - MessageBox.Show("부출표목(700a | 710a | 711a)이 존재하지않습니다."); - return false; + if (UTIL.MsgQ("부출표목(700a | 710a | 711a)이 존재하지않습니다.\n\n진행 할까요?") != DialogResult.Yes) + return false; } return true; @@ -506,8 +515,9 @@ namespace UniMarc /// 분류기호(056)추출 & 008태그 마크에 삽입 /// /// - public string Tag056() + public string Tag056(out string with008TagOutput) { + with008TagOutput = ""; string marc = richTextBox1.Text; string[] temp = marc.Split('\n'); List target = temp.ToList(); @@ -538,10 +548,11 @@ namespace UniMarc tag056 = GetMiddelString(tmp[2], "▼a", "▼"); } } - if (!isEight) - target.Insert(count, string.Format("{0}\t{1}\t{2}▲", "008", " ", text008.Text)); - richTextBox1.Text = string.Join("\n", target.ToArray()); + if (!isEight) + target.Insert(count, $"008\t \t{text008.Text}▲"); + + with008TagOutput = string.Join("\n", target.ToArray()); return tag056; } @@ -760,12 +771,12 @@ namespace UniMarc if (this.tabControl1.SelectedIndex == 1) { AR.UTIL.MsgE("[칸채우기]가 아닌 [마크 편집] 탭에서 저장해주세요!"); - return ; + return; } //data =data.PadRight(40,' '); - string oriMarc = MakeMarcString();// st.made_Ori_marc(richTextBox1).Replace("\\", "₩"); + //if (data == "" || data == null) { return; } @@ -773,30 +784,39 @@ namespace UniMarc // 삽화표시 이용대상자수준 개별자료형태 내용형식1 내용형식2 // 한국대학부호 수정레코드 회의간행물 기념논문집 색인 // 목록전거 문학형식 전기 언어 한국정부기관부호 + var parser = new UniMarc.MarcParser(); + parser.ParseMnemonic(this.richTextBox1.Text); + var v_260c = parser.GetTag("260c").FirstOrDefault() ?? string.Empty; + var v_260a = parser.GetTag("260a").FirstOrDefault() ?? string.Empty; + var v_300b = parser.GetTag("300b").FirstOrDefault() ?? string.Empty; + #region 사전에 선언된 string배열에 맞는 데이터를 배정. + + //string oriMarc = MakeMarcString();// st.made_Ori_marc(richTextBox1).Replace("\\", "₩"); + // 참조할 태그 배열선언 - string[] SearchTag = { "260c", "260a", "300b" }; - string[] ContentTag = st.Take_Tag(oriMarc, SearchTag); + //string[] SearchTag = { "260c", "260a", "300b" }; + string[] ContentTag = new string[] { v_260c, v_260a, v_300b };// st.Take_Tag(oriMarc, SearchTag); // 입력일자 (00-05) string day; - if (input_date.Checked) - day = string.Format("{0}{1}{2}", - DateTime.Now.ToString("yy"), DateTime.Now.ToString("MM"), DateTime.Now.ToString("dd")); - else - day = input_date.Value.ToString("yy") + input_date.Value.ToString("MM") + input_date.Value.ToString("dd"); + //if (input_date.Checked) + // day = string.Format("{0}{1}{2}", + // DateTime.Now.ToString("yy"), DateTime.Now.ToString("MM"), DateTime.Now.ToString("dd")); + //else + day = input_date.Value.ToString("yy") + input_date.Value.ToString("MM") + input_date.Value.ToString("dd"); // 발행년유형 (6), 발행년1 (07-10), 발행년2 (11-14) string DateSet = pubDateSet(ContentTag[0]); - if(string.IsNullOrEmpty(DateSet)) + if (string.IsNullOrEmpty(DateSet)) { return; } // 발행국 (15-17) string Country = pubCountry(ContentTag[1]); - if(Country.isEmpty()) + if (Country.isEmpty()) { return; } @@ -998,6 +1018,7 @@ namespace UniMarc Publication_008(chk.Checked, 31); break; } + this.UpdateTextColor(); } void Publication_008(bool check, int idx) @@ -1018,6 +1039,7 @@ namespace UniMarc string text = text008.Text; richTextBox1.Text = richTextBox1.Text.Replace(data008, text); data008 = text; + UpdateTextColor(); } //public void SetMarcString(string marcstr) //{ @@ -3061,5 +3083,12 @@ namespace UniMarc var zp = new Zoom_Picture(url, lbl_ISBN.Text.Trim()); zp.Show(); } + + private void label1_Click(object sender, EventArgs e) + { + var dlg = UTIL.MsgQ("입력일자를 오늘로 변경 할까요?"); + if (dlg != DialogResult.Yes) return; + input_date.Value = DateTime.Now; + } } } \ No newline at end of file diff --git a/unimarc/unimarc/마크/Marc_CopyForm.cs b/unimarc/unimarc/마크/Marc_CopyForm.cs index 596043e..cedd4c9 100644 --- a/unimarc/unimarc/마크/Marc_CopyForm.cs +++ b/unimarc/unimarc/마크/Marc_CopyForm.cs @@ -132,7 +132,7 @@ namespace UniMarc } // 008 태그 최신화 및 056 추출 - string tag056 = marcEditorControl1.Tag056(); + string tag056 = marcEditorControl1.Tag056(out string with008fullstring); var savedMarc = this.marcEditorControl1.MakeMarcString(); var date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); var v_008 = this.marcEditorControl1.text008.Text; diff --git a/unimarc/unimarc/마크/Zoom_Picture.cs b/unimarc/unimarc/마크/Zoom_Picture.cs index fe5085b..9436966 100644 --- a/unimarc/unimarc/마크/Zoom_Picture.cs +++ b/unimarc/unimarc/마크/Zoom_Picture.cs @@ -19,6 +19,7 @@ namespace UniMarc InitializeComponent(); url = _url; ISBN = _isbn; + this.Text = $"크기보기({_isbn})"; } private void Zoom_Picture_Load(object sender, EventArgs e)