762 lines
27 KiB
C#
762 lines
27 KiB
C#
//using Microsoft.Office.Interop.Excel;
|
|
using AR;
|
|
using OpenQA.Selenium.DevTools.V136.Animation;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Drawing.Drawing2D;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Web.UI;
|
|
using System.Windows.Forms;
|
|
using UniMarc;
|
|
using UniMarc.ListOfValue;
|
|
using UniMarc.마크;
|
|
using WindowsFormsApp1;
|
|
using WindowsFormsApp1.Mac;
|
|
|
|
namespace ExcelTest
|
|
{
|
|
public partial class Marc2 : Form
|
|
{
|
|
/// <summary>
|
|
/// isbn / 도서명 / 저자 / 출판사 / 가격
|
|
/// </summary>
|
|
string[] data_book = { "", "", "", "", "" };
|
|
int SaveRowIdx = -1;
|
|
public string mUserName;
|
|
string mCompidx = UniMarc.Properties.Settings.Default.compidx;
|
|
string mListIdx = "";
|
|
public string find;
|
|
public string change;
|
|
public string call = "";
|
|
private string data008 = string.Empty;
|
|
private bool mLoadCompleted = false;
|
|
string tbName = "";
|
|
public int checkCout = 0;
|
|
public bool gridViewChk = false; // True / False
|
|
Helper_DB db = new Helper_DB();
|
|
Help008Tag tag008 = new Help008Tag();
|
|
Skill_Search_Text search_Text = new Skill_Search_Text();
|
|
String_Text st = new String_Text();
|
|
Mac_List ml;
|
|
|
|
public Marc2()
|
|
{
|
|
InitializeComponent();
|
|
this.ml = null;
|
|
mUserName = string.Empty;
|
|
marcEditorControl1.db = this.db;
|
|
marcEditorControl1.BookSaved += MarcEditorControl_BookSaved;
|
|
marcEditorControl1.FillBlankClicked += MarcEditorControl_FillBlankClicked;
|
|
}
|
|
public Marc2(Mac_List _ml)
|
|
{
|
|
InitializeComponent();
|
|
ml = _ml;
|
|
mUserName = ml.user_name;
|
|
marcEditorControl1.db = this.db;
|
|
marcEditorControl1.BookSaved += MarcEditorControl_BookSaved;
|
|
marcEditorControl1.FillBlankClicked += MarcEditorControl_FillBlankClicked;
|
|
}
|
|
|
|
string l_idx = string.Empty;
|
|
string c_idx = string.Empty;
|
|
private void Marc_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 가져온 목록을 책목록과 연동하여 Grid에 집어넣음.
|
|
/// </summary>
|
|
/// <param name="date">목록일자</param>
|
|
/// <param name="value">목록명</param>
|
|
public void input_list(string l_idx, string value, string C_idx, string custidx, string custname)
|
|
{
|
|
db.DBcon();
|
|
if (value.isEmpty() == false)
|
|
{
|
|
if (value.IndexOf("]") != -1)
|
|
this.Text = $"마크 작성(1)-{value.Substring(value.IndexOf("]") + 1)}";
|
|
else
|
|
this.Text = $"마크 작성(1){value}";
|
|
}
|
|
|
|
this.l_idx = l_idx;
|
|
this.c_idx = C_idx;
|
|
string Area = "`idx`, `isbn_marc`, `header`, `num`, `book_name`, `author`, `book_comp`, `count`, `pay`, `image_url`, `m_idx`";
|
|
string[] sear_tbl = { "l_idx", "compidx" };
|
|
string[] sear_col = { l_idx, C_idx };
|
|
|
|
lbl_BookList.Text = value;
|
|
tbCustName.Text = custname;
|
|
lbCustIDX.Text = custidx;
|
|
|
|
string cmd =
|
|
string.Format("SELECT {0} " +
|
|
"FROM {1} " +
|
|
"WHERE `{2}` = \"{4}\" AND `{3}` = \"{5}\"" +
|
|
"ORDER BY `idx` ASC;", Area, "Obj_List_Book", sear_tbl[0], sear_tbl[1], sear_col[0], sear_col[1]);
|
|
string db_res = db.DB_Send_CMD_Search(cmd);
|
|
string[] db_data = db_res.Split('|');
|
|
string[] grid = {
|
|
"", "", "", "", "",
|
|
"", "", "", "", "",
|
|
"", "", "V", "", "" };
|
|
|
|
|
|
|
|
mLoadCompleted = false;
|
|
for (int a = 0; a < db_data.Length - 1; a += 11)
|
|
{
|
|
|
|
grid[0] = db_data[a]; // 0: idx
|
|
grid[1] = db_data[a + 1]; // 1: isbn
|
|
grid[2] = db_data[a + 2]; // 2: header
|
|
grid[2] += db_data[a + 3]; // 2: num
|
|
grid[3] = db_data[a + 4]; // 3: book_num
|
|
grid[4] = db_data[a + 5]; // 4: author
|
|
grid[5] = db_data[a + 6]; // 5: book_comp
|
|
grid[6] = db_data[a + 7]; // 6: count
|
|
grid[7] = db_data[a + 8]; // 7: pay
|
|
grid[8] = db_data[a + 9]; // 8: image_url
|
|
grid[9] = db_data[a + 10]; // 9: m_idx
|
|
|
|
List_Book.Rows.Add(grid);
|
|
//if (a % 11 == 0) { grid[0] = db_data[a]; } // 0: idx
|
|
//if (a % 11 == 1) { grid[1] = db_data[a+1]; } // 1: isbn
|
|
//if (a % 11 == 2) { grid[2] = db_data[a+2]; } // 2: header
|
|
//if (a % 11 == 3) { grid[2] += db_data[a+3]; } // 2: num
|
|
//if (a % 11 == 4) { grid[3] = db_data[a+4]; } // 3: book_num
|
|
//if (a % 11 == 5) { grid[4] = db_data[a+5]; } // 4: author
|
|
//if (a % 11 == 6) { grid[5] = db_data[a+6]; } // 5: book_comp
|
|
//if (a % 11 == 7) { grid[6] = db_data[a+7]; } // 6: count
|
|
//if (a % 11 == 8) { grid[7] = db_data[a+8]; } // 7: pay
|
|
//if (a % 11 == 9) { grid[8] = db_data[a+9]; } // 8: image_url
|
|
//if (a % 11 == 10) { grid[9] = db_data[a+10]; // 9: m_idx
|
|
// List_Book.Rows.Add(grid);
|
|
//}
|
|
}
|
|
chk_Marc();
|
|
mLoadCompleted = true;
|
|
|
|
List_Book.ClearSelection();
|
|
if (this.List_Book.RowCount > 0)
|
|
List_Book.Rows[0].Selected = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 마크 유무 확인하는 함수
|
|
/// </summary>
|
|
void chk_Marc()
|
|
{
|
|
for (int a = 0; a < List_Book.Rows.Count; a++)
|
|
{
|
|
string Area =
|
|
// 0 1
|
|
"`idx`, `compidx`, " +
|
|
// 2 3 4 5 6 7
|
|
"`marc`, `marc_chk`, `marc1`, `marc_chk1`, `marc2`, `marc_chk2`, " +
|
|
// 8 9 10 11
|
|
"`grade`, `008tag`, `user`, `date`";
|
|
|
|
string Table = "Marc";
|
|
|
|
string[] sear_tbl = { "ISBN" };
|
|
string[] sear_col = { List_Book.Rows[a].Cells["ISBN13"].Value.ToString() };
|
|
|
|
//if (List_Book.Rows[a].Cells["marc_idx"].Value.ToString() != "0") {//여기 조건이 이상함.. 여기 조건때문에 순서가 잘 못 뜨는 경우 발생..
|
|
// sear_tbl[0] = "idx";
|
|
// sear_col[0] = List_Book.Rows[a].Cells["marc_idx"].Value.ToString();
|
|
//}
|
|
|
|
string Chk_Cmd = string.Format("SELECT {0} FROM {1} WHERE `{2}` = \"{3}\" ORDER BY FIELD(`compidx`, {4}) DESC;",
|
|
Area, Table, sear_tbl[0], sear_col[0], mCompidx);
|
|
|
|
string Chk_Res = db.DB_Send_CMD_Search(Chk_Cmd);
|
|
string[] Chk_Arr = Chk_Res.Split('|');
|
|
|
|
bool isMyData = true;
|
|
if (Chk_Arr.Length < 2)
|
|
{
|
|
List_Book.Rows[a].Cells["grade"].Value = "3";
|
|
List_Book.Rows[a].DefaultCellStyle.ForeColor = Color.Red;
|
|
continue;
|
|
}
|
|
|
|
if (Chk_Arr[1] != mCompidx)
|
|
isMyData = false;
|
|
|
|
string[] MarcData = { Chk_Arr[2], Chk_Arr[4], Chk_Arr[6] };
|
|
string[] CheckData = { Chk_Arr[3], Chk_Arr[5], Chk_Arr[7] };
|
|
|
|
List_Book.Rows[a].DefaultCellStyle.ForeColor = SetGradeColor(Chk_Arr[8], isMyData);
|
|
List_Book.Rows[a].Cells["marc_idx"].Value = Chk_Arr[0];
|
|
List_Book.Rows[a].Cells["db_marc"].Value = MarcData[0];//NewestMarc(MarcData, CheckData);
|
|
List_Book.Rows[a].Cells["grade"].Value = Chk_Arr[8];
|
|
// text008.Text = Chk_Arr[9];
|
|
List_Book.Rows[a].Cells["user"].Value = Chk_Arr[10];
|
|
List_Book.Rows[a].Cells["SaveDate"].Value = Chk_Arr[11];
|
|
|
|
if (isMyData)
|
|
SaveDateCheck(Chk_Arr[11], a);
|
|
|
|
else
|
|
{
|
|
string FindCompCmd = string.Format("SELECT `comp_name` FROM `Comp` WHERE `idx` = {0}", Chk_Arr[1]);
|
|
List_Book.Rows[a].Cells["user"].Value = db.DB_Send_CMD_Search(FindCompCmd).Replace("|", "");
|
|
List_Book.Rows[a].DefaultCellStyle.BackColor = Color.LightGray;
|
|
}
|
|
}
|
|
}
|
|
|
|
private string NewestMarc(string[] marc, string[] marc_chk)
|
|
{
|
|
string result = "";
|
|
int count = 0;
|
|
foreach (string chk in marc_chk)
|
|
{
|
|
if (chk == "1")
|
|
result = marc[count];
|
|
|
|
count++;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private Color SetGradeColor(string Grade, bool isMyData = true)
|
|
{
|
|
if (!isMyData)
|
|
return Color.Orange;
|
|
|
|
switch (Grade)
|
|
{
|
|
case "0": // A
|
|
return Color.Blue;
|
|
|
|
case "1": // B
|
|
return Color.Black;
|
|
|
|
case "2": // C
|
|
return Color.Gray;
|
|
|
|
case "3": // D
|
|
return Color.Red;
|
|
|
|
default:
|
|
return Color.Black;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 마지막 저장시각 14일이전일 경우 배경 색 변경
|
|
/// </summary>
|
|
/// <param name="Date">마지막 저장시각</param>
|
|
/// <param name="row">해당 행</param>
|
|
private void SaveDateCheck(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가 같거나 큼
|
|
List_Book.Rows[row].DefaultCellStyle.BackColor = Color.Yellow;
|
|
|
|
else // TargetDate가 큼
|
|
List_Book.Rows[row].DefaultCellStyle.BackColor = Color.White;
|
|
|
|
}
|
|
|
|
|
|
private string mOldMarc = string.Empty;
|
|
private void List_Book_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (!mLoadCompleted) return;
|
|
int row_idx = List_Book.CurrentCell.RowIndex;
|
|
int col_idx = List_Book.CurrentCell.ColumnIndex;
|
|
if (row_idx == -1 || col_idx == -1) { return; }
|
|
SaveRowIdx = row_idx;
|
|
|
|
mOldMarc = List_Book.Rows[row_idx].Cells["db_marc"].Value.ToString();
|
|
string isbn = List_Book.Rows[row_idx].Cells["ISBN13"].Value.ToString();
|
|
if (isbn != "")
|
|
{
|
|
string CountQuery = string.Format("SELECT Count(isbn) FROM Marc WHERE isbn = {0} GROUP BY isbn;", isbn);
|
|
string CountResult = db.self_Made_Cmd(CountQuery).Replace("|", "");
|
|
|
|
if (CountResult == "")
|
|
btn_CopySelect.Text = "0";
|
|
|
|
if (CountResult == "0")
|
|
{
|
|
btn_CopySelect.Enabled = false;
|
|
btn_CopySelect.BackColor = Color.Silver;
|
|
}
|
|
else
|
|
{
|
|
btn_CopySelect.Enabled = true;
|
|
btn_CopySelect.BackColor = Color.Khaki;
|
|
}
|
|
|
|
btn_CopySelect.Text = CountResult;
|
|
}
|
|
|
|
if (check_V(row_idx, col_idx))
|
|
return;
|
|
|
|
string isbn13 = List_Book.Rows[row_idx].Cells["ISBN13"].Value?.ToString() ?? "";
|
|
string bookName = List_Book.Rows[row_idx].Cells["book_name"].Value?.ToString() ?? "";
|
|
string author = List_Book.Rows[row_idx].Cells["author"].Value?.ToString() ?? "";
|
|
string publisher = List_Book.Rows[row_idx].Cells["book_comp"].Value?.ToString() ?? "";
|
|
string price = List_Book.Rows[row_idx].Cells["pay"].Value?.ToString() ?? "";
|
|
string url = List_Book.Rows[row_idx].Cells["url"].Value?.ToString() ?? ""; // or image_url?
|
|
string marcIdx = List_Book.Rows[row_idx].Cells["marc_idx"].Value?.ToString() ?? "";
|
|
string dbMarc = List_Book.Rows[row_idx].Cells["db_marc"].Value?.ToString() ?? "";
|
|
string grade = List_Book.Rows[row_idx].Cells["grade"].Value?.ToString() ?? "";
|
|
string user = List_Book.Rows[row_idx].Cells["user"].Value?.ToString() ?? "";
|
|
string saveDate = List_Book.Rows[row_idx].Cells["SaveDate"].Value?.ToString() ?? "";
|
|
string listIdx = List_Book.Rows[row_idx].Cells["list_idx"].Value?.ToString() ?? ""; // verify this column name in input_list
|
|
|
|
marcEditorControl1.LoadBookData(isbn13, bookName, author, publisher, price, url, marcIdx, dbMarc, grade, user, saveDate, listIdx);
|
|
}
|
|
|
|
bool check_V(int row, int col)
|
|
{
|
|
string name = List_Book.Columns[col].Name;
|
|
if (name == "colCheck")
|
|
{
|
|
if (List_Book.Rows[row].Cells[col].Value.ToString() == "V")
|
|
List_Book.Rows[row].Cells[col].Value = "";
|
|
|
|
else
|
|
List_Book.Rows[row].Cells["colCheck"].Value = "V";
|
|
|
|
return true;
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
|
|
|
|
private void btn_Search_Click(object sender, EventArgs e)
|
|
{
|
|
if (List_Book.RowCount < 0) return;
|
|
|
|
Search_ReSet();
|
|
|
|
bool isSort = rb_Sort.Checked;
|
|
int combo = comboBox8.SelectedIndex; // 0: 등급 / 1: 복본
|
|
|
|
if (isSort)
|
|
{
|
|
if (combo == 0)
|
|
{
|
|
List_Book.Sort(List_Book.Columns["grade"], System.ComponentModel.ListSortDirection.Ascending);
|
|
}
|
|
else
|
|
{
|
|
List_Book.Sort(List_Book.Columns["ISBN13"], System.ComponentModel.ListSortDirection.Ascending);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
int comboIdx;
|
|
if (combo == 0)
|
|
{
|
|
comboIdx = comboBox9.SelectedIndex;
|
|
Search_Filter("grade", comboIdx);
|
|
}
|
|
else
|
|
{ // 수정필요
|
|
|
|
}
|
|
}
|
|
}
|
|
#region Search_Click_Sub
|
|
private void Search_ReSet()
|
|
{
|
|
DataGridViewBand reSet;
|
|
for (int a = 0; a < List_Book.RowCount; a++)
|
|
{
|
|
reSet = List_Book.Rows[a];
|
|
reSet.Visible = true;
|
|
}
|
|
}
|
|
|
|
private void Search_Filter(string target, int comboIdx)
|
|
{
|
|
int count = List_Book.Rows.Count;
|
|
DataGridViewBand band;
|
|
if (comboIdx == 0)
|
|
{
|
|
for (int a = 0; a < count; a++)
|
|
{
|
|
band = List_Book.Rows[a];
|
|
band.Visible = true;
|
|
}
|
|
return;
|
|
}
|
|
|
|
comboIdx--;
|
|
for (int a = 0; a < count; a++)
|
|
{
|
|
if (List_Book.Rows[a].Cells[target].Value.ToString() != comboIdx.ToString())
|
|
{
|
|
band = List_Book.Rows[a];
|
|
band.Visible = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void btn_CopySelect_Click(object sender, EventArgs e)
|
|
{
|
|
//TODO: 마크 물리는쪽
|
|
int row = List_Book.CurrentCell.RowIndex;
|
|
string isbn = List_Book.Rows[row].Cells["ISBN13"].Value.ToString();
|
|
|
|
MarcCopySelect copySelect = new MarcCopySelect(this);
|
|
copySelect.MarcFormRowIndex = row;
|
|
copySelect.Init("isbn", isbn);
|
|
copySelect.Show();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 선택된 마크에 대한 정보를 그리드뷰에 저장.
|
|
/// </summary>
|
|
/// <param name="row"></param>
|
|
/// <param name="GridData">[0] idx, [1] compidx, [2] user, [3] date, [4] grade, [5] tag008, [6] marc </param>
|
|
public void SelectMarc_Sub(int row, string[] GridData)
|
|
{
|
|
List_Book.Rows[row].Cells["marc_idx"].Value = GridData[0];
|
|
List_Book.Rows[row].Cells["user"].Value = GridData[2];
|
|
List_Book.Rows[row].Cells["SaveDate"].Value = GridData[4];
|
|
List_Book.Rows[row].Cells["grade"].Value = GridData[3];
|
|
// text008.Text = GridData[5];
|
|
List_Book.Rows[row].Cells["db_marc"].Value = GridData[6];
|
|
mOldMarc = GridData[6];
|
|
List_Book.Rows[row].DefaultCellStyle.ForeColor = SetGradeColor(GridData[4]);
|
|
List_Book.Rows[row].DefaultCellStyle.BackColor = Color.Yellow;
|
|
|
|
if (List_Book.CurrentRow != null && List_Book.CurrentRow.Index == row)
|
|
{
|
|
List_Book_SelectionChanged(null, null);
|
|
}
|
|
}
|
|
|
|
private void MarcEditorControl_BookSaved(object sender, ExcelTest.MarcEditorControl.BookSavedEventArgs e)
|
|
{
|
|
if (SaveRowIdx >= 0 && SaveRowIdx < List_Book.Rows.Count)
|
|
{
|
|
string currentListIdx = List_Book.Rows[SaveRowIdx].Cells["list_idx"].Value?.ToString();
|
|
// If list_idx column name differs, check input_list. Assuming "list_idx" or "idx".
|
|
// In input_list: grid[0] = db_data[a]; (idx).
|
|
// And MarcEditorControl uses "list_idx" passed from List_Book_SelectionChanged.
|
|
// We need to match what we passed.
|
|
|
|
// Just update based on SaveRowIdx for now, assuming modal blocking or single user interaction.
|
|
List_Book.Rows[SaveRowIdx].Cells["grade"].Value = e.Grade;
|
|
List_Book.Rows[SaveRowIdx].Cells["SaveDate"].Value = e.SaveDate;
|
|
List_Book.Rows[SaveRowIdx].Cells["user"].Value = e.User;
|
|
List_Book.Rows[SaveRowIdx].Cells["db_marc"].Value = e.DBMarc;
|
|
List_Book.Rows[SaveRowIdx].Cells["marc_idx"].Value = e.MarcIdx;
|
|
List_Book.Rows[SaveRowIdx].DefaultCellStyle.ForeColor = SetGradeColor(e.Grade);
|
|
}
|
|
}
|
|
|
|
private void MarcEditorControl_FillBlankClicked(object sender, EventArgs e)
|
|
{
|
|
if (List_Book.CurrentRow == null) return;
|
|
int row = List_Book.CurrentRow.Index;
|
|
string ISBN = List_Book.Rows[row].Cells["ISBN13"].Value?.ToString();
|
|
|
|
if (string.IsNullOrEmpty(ISBN))
|
|
{
|
|
MessageBox.Show("ISBN이 존재하지않습니다!");
|
|
return;
|
|
}
|
|
|
|
UniMarc.Marc_FillBlank fb = new UniMarc.Marc_FillBlank(this);
|
|
for (int a = 0; a < List_Book.Rows.Count; a++)
|
|
{
|
|
if (List_Book.Rows[a].DefaultCellStyle.ForeColor == Color.Red)
|
|
{
|
|
string[] GridData =
|
|
{
|
|
a.ToString(),
|
|
List_Book.Rows[a].Cells["ISBN13"].Value?.ToString() ?? "",
|
|
List_Book.Rows[a].Cells["book_name"].Value?.ToString() ?? "",
|
|
List_Book.Rows[a].Cells["author"].Value?.ToString() ?? "",
|
|
List_Book.Rows[a].Cells["book_comp"].Value?.ToString() ?? "",
|
|
List_Book.Rows[a].Cells["pay"].Value?.ToString() ?? "",
|
|
""
|
|
};
|
|
fb.InitFillBlank(GridData);
|
|
}
|
|
}
|
|
fb.ISBN = ISBN;
|
|
fb.Show();
|
|
}
|
|
|
|
private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
comboBox9.Items.Clear();
|
|
|
|
ComboBox cb = sender as ComboBox;
|
|
if (cb.SelectedIndex == 0)
|
|
{
|
|
comboBox9.Enabled = true;
|
|
string[] grade = { "전체", "A", "B", "C", "D" };
|
|
comboBox9.Items.AddRange(grade);
|
|
comboBox9.SelectedIndex = 0;
|
|
}
|
|
else
|
|
comboBox9.Enabled = false;
|
|
}
|
|
|
|
private void Radio_Sort_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = sender as RadioButton;
|
|
string text = rb.Text;
|
|
if (text == "정렬")
|
|
comboBox9.Enabled = false;
|
|
|
|
else
|
|
comboBox9.Enabled = true;
|
|
}
|
|
|
|
|
|
private void btn_mk_marcList_Click(object sender, EventArgs e)
|
|
{
|
|
Marc_mkList mkList = new Marc_mkList(this);
|
|
mkList.StartPosition = FormStartPosition.CenterScreen;
|
|
mkList.Show();
|
|
}
|
|
#region 마크생성목록_Sub
|
|
public bool Check_BackColor(int row)
|
|
{
|
|
if (List_Book.Rows[row].DefaultCellStyle.ForeColor != Color.Red)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
public bool Check_List_V(int row)
|
|
{
|
|
if (List_Book.Rows[row].Cells["colCheck"].Value.ToString() == "V")
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
#endregion
|
|
|
|
private void checkBox3_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
bool isCheck = checkBox3.Checked;
|
|
if (isCheck)
|
|
{
|
|
for (int a = 0; a < List_Book.Rows.Count; a++)
|
|
{
|
|
List_Book.Rows[a].Cells["colCheck"].Value = "V";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int a = 0; a < List_Book.Rows.Count; a++)
|
|
{
|
|
List_Book.Rows[a].Cells["colCheck"].Value = "";
|
|
}
|
|
}
|
|
}
|
|
|
|
private void List_Book_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
int row = List_Book.CurrentCell.RowIndex;
|
|
if (e.KeyCode == Keys.Space)
|
|
{
|
|
if (List_Book.Rows[row].Cells["colCheck"].Value.ToString() == "V")
|
|
List_Book.Rows[row].Cells["colCheck"].Value = "";
|
|
|
|
else
|
|
List_Book.Rows[row].Cells["colCheck"].Value = "V";
|
|
}
|
|
}
|
|
|
|
private void FillTextBox_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
TextBox tb = sender as TextBox;
|
|
|
|
//if (e.KeyCode == Keys.F3)
|
|
//{
|
|
// int line = tb.SelectionStart;
|
|
// tb.Text = tb.Text.Insert(line, "▽");
|
|
// tb.SelectionStart = line + 1;
|
|
//}
|
|
if (e.KeyCode == Keys.F3)
|
|
{
|
|
tb.InvokeInsertText("▽");
|
|
//tb.Select(tb.Text.Length, 0);
|
|
}
|
|
else if (e.KeyCode == Keys.F4)
|
|
{
|
|
tb.InvokeInsertText("△");
|
|
//tb.Select(tb.Text.Length, 0);
|
|
}
|
|
|
|
//tb.SelectionStart = tb.Text.Length;
|
|
//tb.Select(tb.Text.Length, 0);
|
|
}
|
|
|
|
|
|
#region DataGridView 드래그 행이동 이벤트 함수
|
|
|
|
Skill_Grid sg = new Skill_Grid();
|
|
|
|
private void List_Book_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
sg.MouseMove(sender, e);
|
|
}
|
|
|
|
private void List_Book_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
sg.MouseDown(sender, e);
|
|
}
|
|
|
|
private void List_Book_DragOver(object sender, DragEventArgs e)
|
|
{
|
|
sg.DragOver(sender, e);
|
|
}
|
|
|
|
private void List_Book_DragDrop(object sender, DragEventArgs e)
|
|
{
|
|
sg.DragDrop(sender, e);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
private bool isEmpty(string boxText)
|
|
{
|
|
if (boxText == "")
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
private bool isEmpty(string[] boxText)
|
|
{
|
|
bool[] isText = new bool[boxText.Length];
|
|
int count = 0;
|
|
int chkCount = 0;
|
|
foreach (string Check in boxText)
|
|
{
|
|
if (Check == "")
|
|
isText[count] = false;
|
|
else
|
|
{
|
|
isText[count] = true;
|
|
chkCount++;
|
|
}
|
|
count++;
|
|
}
|
|
|
|
if (chkCount == 0)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
private void btn_FilterReturn_Click(object sender, EventArgs e)
|
|
{
|
|
rb_Filter.Checked = false;
|
|
rb_Sort.Checked = false;
|
|
|
|
comboBox8.SelectedIndex = 0;
|
|
comboBox9.SelectedIndex = 0;
|
|
|
|
List_Book.Sort(list_idx, System.ComponentModel.ListSortDirection.Ascending);
|
|
}
|
|
|
|
private void List_Book_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
|
{
|
|
Skill_Grid sg = new Skill_Grid();
|
|
sg.Print_Grid_Num(sender, e);
|
|
}
|
|
|
|
private void lbl_BookList_Click(object sender, EventArgs e)
|
|
{
|
|
LovCustom();
|
|
|
|
}
|
|
|
|
void LovCustom()
|
|
{
|
|
var inputsearch = "";// tbCustName.Text.Trim();
|
|
var where = "";
|
|
if (inputsearch.isEmpty() == false)
|
|
{
|
|
where = $"c_sangho like '%{inputsearch.Replace("'", "''")}%'";
|
|
}
|
|
var dt = DB2.GetDT("Client", columns: "idx,c_sangho", orders: "c_sangho", wheres: where);
|
|
using (var f = new fSelectDT(dt))
|
|
if (f.ShowDialog() == DialogResult.OK)
|
|
{
|
|
var dr = f.SelectedRow;
|
|
if (dr == null) return;
|
|
lbCustIDX.Text = dr["idx"]?.ToString() ?? string.Empty;
|
|
tbCustName.Text = dr["c_sangho"]?.ToString() ?? string.Empty;
|
|
|
|
if (int.TryParse(lbCustIDX.Text, out int custidx) && custidx >= 0)
|
|
{
|
|
var sql = $"update Obj_List set customer={custidx} where idx = {l_idx} and comp_num={c_idx}";
|
|
var cnt = DB2.ExcuteNonQuery(sql);
|
|
if (cnt != 1)
|
|
UTIL.MsgE($"데이터 저장시 오류가 발생했습니다. 영향을 받은 행 수 = {cnt}");
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void Marc_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Escape)
|
|
{
|
|
if (UTIL.MsgQ("현재 화면을 닫을까요?") != DialogResult.Yes) return;
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
// 현재 데이터를 한줄 복사하고 ISBN 값을 삭제한다
|
|
// 생성된 자료는 좌측 목록에 추가되어야하고, 그 목록이 선택되도록 한다.
|
|
if (List_Book.SelectedRows.Count == 0)
|
|
return;
|
|
|
|
DataGridViewRow selectedRow = List_Book.SelectedRows[0];
|
|
int nRow = List_Book.Rows.Add();
|
|
DataGridViewRow newRow = List_Book.Rows[nRow];
|
|
|
|
for (int i = 0; i < selectedRow.Cells.Count; i++)
|
|
{
|
|
newRow.Cells[i].Value = selectedRow.Cells[i].Value;
|
|
}
|
|
|
|
newRow.Cells["ISBN13"].Value = "";
|
|
newRow.Cells["marc_idx"].Value = "";
|
|
newRow.Cells["list_idx"].Value = "";
|
|
//newRow.Cells["grade"].Value = "3"; // 등급 초기화 (D)
|
|
newRow.DefaultCellStyle.ForeColor = Color.Red; // 색상 초기화 (D급 색상)
|
|
|
|
List_Book.ClearSelection();
|
|
newRow.Selected = true;
|
|
List_Book.FirstDisplayedScrollingRowIndex = nRow;
|
|
}
|
|
}
|
|
} |