=====* ISBN 조회 *=====

Yes24 - 바뀐 예스 양식에 따라 수정

=====* unimarc *=====
- ISBN 조회 -
세트 분할 추가 - INSERT키 입력시 분할을 도와줄 폼이 표출됨. (Check_ISBN_Split.cs)
도서 정보 추가 - F12키 입력시 도서 정보가 표출되는 폼이 등장함. (Book_Lookup.cs)
ㄴ> DB 재정리중 치이는 상황이 많아 작업이 더 늘어남.

기타 소스코드 함수 정리
This commit is contained in:
SeungHo Yang
2021-09-10 17:50:07 +09:00
parent 0deaacc70e
commit b8e6da4371
16 changed files with 322 additions and 210 deletions

Binary file not shown.

View File

@@ -9,6 +9,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp1.Mac;
using WindowsFormsApp1.;
namespace WindowsFormsApp1.Delivery
@@ -20,6 +21,7 @@ namespace WindowsFormsApp1.Delivery
Purchase pur;
List_Lookup ll;
Bring_Back bb;
Check_ISBN cisbn;
string compidx;
string list_name;
int idx;
@@ -51,6 +53,13 @@ namespace WindowsFormsApp1.Delivery
idx = bb.grididx;
compidx = bb.compidx;
}
public Book_Lookup(Check_ISBN _isbn)
{
InitializeComponent();
cisbn = _isbn;
idx = cisbn.rowidx;
compidx = cisbn.compidx;
}
private void Book_Lookup_Load(object sender, EventArgs e)
{
db.DBcon();

View File

@@ -61,6 +61,26 @@ namespace WindowsFormsApp1.Delivery
mk_combo_list_name();
mk_charge();
}
#region Load_Sub
/// <summary>
/// 담당자 콤보박스(cb_charge)에 작성
/// </summary>
private void mk_charge()
{
cb_charge.Items.Clear();
string tmp_data = db.DB_Select_Search("comp_name",
"Comp", "idx", compidx);
string[] tmp_db = tmp_data.Split('|');
tmp_data = db.DB_Select_Search("name", "User_Data", "affil", tmp_db[0]);
string[] data = tmp_data.Split('|');
cb_charge.Items.Add("전체");
for (int a = 0; a < data.Length - 1; a++)
{
cb_charge.Items.Add(data[a]);
}
cb_charge.SelectedIndex = 0;
}
#endregion
int cnt = 0, pageNo = 1;
private void btn_print_Click(object sender, EventArgs e) // 인쇄 기능
{
@@ -109,12 +129,13 @@ namespace WindowsFormsApp1.Delivery
int startHeight = 140; // 시작 y좌표
int avgHeight = dataGridView1.Rows[0].Height; // girdview 컬럼 하나의 높이
int temp = 0; // row 개수 세어줄 것. cnt의 역할
avgHeight = avgHeight/3*4;
avgHeight = avgHeight / 3 * 4;
e.Graphics.DrawString("목록 조회", new Font("Arial", 20, FontStyle.Bold), Brushes.Black, dialogWidth / 2, 40);
e.Graphics.DrawString("인쇄일: " + DateTime.Now.ToString("yyyy/MM/dd"), new Font("Arial", 13), Brushes.Black, dialogWidth - 20, 80);
e.Graphics.DrawString("페이지번호: " + pageNo, new Font("Arial", 13), Brushes.Black, dialogWidth - 20, 100);
for(int a = 0; a < dataGridView1.ColumnCount; a++) // columnCount는 일정
{
{
if (!dataGridView1.Columns[a].Visible) { continue; }
if (a == 0) {
width = 0;
width1 = dataGridView1.Columns[a].Width + 15;
@@ -127,19 +148,21 @@ namespace WindowsFormsApp1.Delivery
width = dataGridView1.Columns[a - 1].Width + 15;
width1 = dataGridView1.Columns[a].Width + 40;
}
RectangleF drawRect = new RectangleF((float)(startWidth + width)/4*3, (float)startHeight,
(float)width1/4*3, avgHeight);
e.Graphics.DrawRectangle(Pens.Black, (float)(startWidth + width)/4*3, (float)startHeight,
(float)width1/4*3, avgHeight);
RectangleF drawRect = new RectangleF((float)(startWidth + width) / 4 * 3,
(float)startHeight, (float)width1 / 4 * 3, avgHeight);
e.Graphics.DrawRectangle(Pens.Black, (float)(startWidth + width) / 4 * 3,
(float)startHeight, (float)width1 / 4 * 3, avgHeight);
e.Graphics.DrawString(dataGridView1.Columns[a].HeaderText,
new Font("Arial", 12, FontStyle.Bold), Brushes.Black, drawRect, sf);
startWidth += width;
}
startHeight += avgHeight;
for(int a = cnt; a < dataGridView1.RowCount - 1; a++) {
for(int a = cnt; a < dataGridView1.RowCount - 1; a++)
{
startWidth = 10;
for(int b = 0; b < dataGridView1.ColumnCount; b++) {
if (!dataGridView1.Columns[b].Visible) { continue; }
if (b == 0) {
width = 0;
width1 = dataGridView1.Columns[b].Width + 15;
@@ -154,10 +177,10 @@ namespace WindowsFormsApp1.Delivery
}
if (b == 2) { sf.LineAlignment = StringAlignment.Near; }
else { sf.LineAlignment = StringAlignment.Center; }
RectangleF drawRect = new RectangleF((float)(startWidth + width)/4*3, (float)startHeight,
(float)width1/4*3, avgHeight);
e.Graphics.DrawRectangle(Pens.Black, (float)(startWidth + width)/4*3, (float)startHeight,
(float)width1/4*3, avgHeight);
RectangleF drawRect = new RectangleF((float)(startWidth + width) / 4 * 3,
(float)startHeight, (float)width1 / 4 * 3, avgHeight);
e.Graphics.DrawRectangle(Pens.Black, (float)(startWidth + width) / 4 * 3,
(float)startHeight, (float)width1 / 4 * 3, avgHeight);
e.Graphics.DrawString(dataGridView1.Rows[a].Cells[b].FormattedValue.ToString(),
new Font("Arial", 7), Brushes.Black, drawRect, sf);
startWidth += width;
@@ -180,6 +203,107 @@ namespace WindowsFormsApp1.Delivery
res_total();
Column_Text_Color();
}
#region Lookup_Sub
/// <summary>
/// 그리드 내에 데이터 삽입
/// TODO: 09.10 수정필요!
/// </summary>
private void mk_grid()
{
dataGridView1.Rows.Clear();
string list = cb_list_name.Text;
string area = "`idx`, `header`, `num`, `book_name`, `author`, `book_comp`, " +
"`count`, `pay`, `total`, `stat`, `etc`, " +
"`list_name`, `order`, `import`, `export`, `set_book_name`";
string tmp_data = db.DB_Select_Search(area, "Obj_List_Book", "compidx", compidx);
string[] data = tmp_data.Split('|');
string[] mkgrid = { "", "", "", "", "",
"", "", "", "", "",
"", "", "", "", "" };
int num = 16;
for (int a = 0; a < data.Length; a++)
{
if (a % num == 0) { mkgrid[0] = data[a]; }
if (a % num == 1) { mkgrid[2] = data[a] + " "; }
if (a % num == 2) { mkgrid[2] += data[a]; }
if (a % num == 3) { mkgrid[3] = data[a]; }
if (a % num == 4) { mkgrid[4] = data[a]; }
if (a % num == 5) { mkgrid[5] = data[a]; }
if (a % num == 6) { mkgrid[6] = data[a]; }
if (a % num == 7) { mkgrid[7] = data[a]; }
if (a % num == 8) { mkgrid[8] = data[a]; }
if (a % num == 9) { mkgrid[9] = data[a]; }
if (a % num == 10) { mkgrid[10] = data[a]; }
if (a % num == 11) { mkgrid[11] = data[a]; }
if (a % num == 12) { mkgrid[12] = data[a]; }
if (a % num == 13) { mkgrid[13] = data[a]; }
if (a % num == 14) { mkgrid[14] = data[a]; }
if (a % num == 15)
{
if (data[a] != "") // 세트분할도서 미표시
continue;
if (filter(mkgrid))
{
dataGridView1.Rows.Add(mkgrid);
}
}
}
}
private bool filter(string[] array)
{
/* 주 | 번호 | 도서명 | 저자 | 출판사
* 수량 | 단가 | 합계 | 상태 | 비고
* 구분 | 주문처 | 입고상태 | 출고상태 */
if (tb_search.Text != "")
{
if (cb_search.SelectedIndex == 0)
{
if (!array[3].Contains(tb_search.Text))
{
return false;
}
}
else if (cb_search.SelectedIndex == 1)
{
if (!array[5].Contains(tb_search.Text))
{
return false;
}
}
}
if (tb_clt.Text != "")
{
if (!array[12].Contains(tb_clt.Text))
{
return false;
}
}
if (cb_list_name.SelectedIndex != 0)
{
if (!array[11].Contains(cb_list_name.Text))
{
return false;
}
}
if (cb_import.SelectedIndex != 0)
{
if (array[13] != cb_import.Text)
{
return false;
}
}
if (cb_export.SelectedIndex != 0)
{
if (array[14] != cb_export.Text)
{
return false;
}
}
return true;
}
private void res_total()
{
int itcount = 0;
@@ -195,6 +319,22 @@ namespace WindowsFormsApp1.Delivery
lbl_pay.Text = "단가: " + String.Format("{0:#,0}", itpay);
lbl_total.Text = "합계: " + String.Format("{0:#,0}", ittotal);
}
void Column_Text_Color()
{
for (int a = 0; a < dataGridView1.Rows.Count; a++)
{
if (dataGridView1.Rows[a].Cells["Column2"].Value.ToString() == "입고")
{
dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Blue;
}
else if (dataGridView1.Rows[a].Cells["Column2"].Value.ToString() == "미입고")
{
dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Red;
}
}
}
#endregion
private void btn_close_Click(object sender, EventArgs e)
{
this.Close();
@@ -204,23 +344,6 @@ namespace WindowsFormsApp1.Delivery
mk_combo_list_name();
}
/// <summary>
/// 담당자 콤보박스(cb_charge)에 작성
/// </summary>
private void mk_charge()
{
cb_charge.Items.Clear();
string tmp_data = db.DB_Select_Search("comp_name",
"Comp", "idx", compidx);
string[] tmp_db = tmp_data.Split('|');
tmp_data = db.DB_Select_Search("name", "User_Data", "affil", tmp_db[0]);
string[] data = tmp_data.Split('|');
cb_charge.Items.Add("전체");
for (int a = 0; a < data.Length - 1; a++) {
cb_charge.Items.Add(data[a]);
}
cb_charge.SelectedIndex = 0;
}
/// <summary>
/// 검색 필터 콤보박스(cb_list_name)에 작성
/// </summary>
private void mk_combo_list_name()
@@ -255,45 +378,6 @@ namespace WindowsFormsApp1.Delivery
else { cb_list_name.SelectedIndex = 0; }
}
}
/// <summary>
/// 그리드 내에 데이터 삽입
/// TODO: 09.10 수정필요!
/// </summary>
private void mk_grid()
{
dataGridView1.Rows.Clear();
string list = cb_list_name.Text;
string area = "`idx`, `header`, `num`, `book_name`, `author`, `book_comp`, " +
"`count`, `pay`, `total`, `stat`, `etc`, " +
"`list_name`, `order`, `import`, `export`";
string tmp_data = db.DB_Select_Search(area, "Obj_List_Book", "compidx", compidx);
string[] data = tmp_data.Split('|');
string[] mkgrid = { "", "", "", "", "",
"", "", "", "", "",
"", "", "", "", "" };
int num = 15;
for(int a = 0; a < data.Length; a++) {
if (a % num == 0) { mkgrid[0] = data[a]; }
if (a % num == 1) { mkgrid[2] = data[a] + " "; }
if (a % num == 2) { mkgrid[2] += data[a]; }
if (a % num == 3) { mkgrid[3] = data[a]; }
if (a % num == 4) { mkgrid[4] = data[a]; }
if (a % num == 5) { mkgrid[5] = data[a]; }
if (a % num == 6) { mkgrid[6] = data[a]; }
if (a % num == 7) { mkgrid[7] = data[a]; }
if (a % num == 8) { mkgrid[8] = data[a]; }
if (a % num == 9) { mkgrid[9] = data[a]; }
if (a % num == 10) { mkgrid[10] = data[a]; }
if (a % num == 11) { mkgrid[11] = data[a]; }
if (a % num == 12) { mkgrid[12] = data[a]; }
if (a % num == 13) { mkgrid[13] = data[a]; }
if (a % num == 14) { mkgrid[14] = data[a];
if (filter(mkgrid)) {
dataGridView1.Rows.Add(mkgrid);
}
}
}
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Book_Lookup bl = new Book_Lookup(this);
@@ -310,46 +394,6 @@ namespace WindowsFormsApp1.Delivery
}
}
private bool filter(string[] array)
{
/* 주 | 번호 | 도서명 | 저자 | 출판사
* 수량 | 단가 | 합계 | 상태 | 비고
* 구분 | 주문처 | 입고상태 | 출고상태 */
if (tb_search.Text != "") {
if (cb_search.SelectedIndex == 0) {
if (array[3].Contains(tb_search.Text) == false) {
return false;
}
}
else if (cb_search.SelectedIndex == 1) {
if (array[5].Contains(tb_search.Text) == false) {
return false;
}
}
}
if (tb_clt.Text != "") {
if (array[12].Contains(tb_clt.Text) == false) {
return false;
}
}
if (cb_list_name.SelectedIndex != 0) {
if (array[11].Contains(cb_list_name.Text) == false){
return false;
}
}
if (cb_import.SelectedIndex != 0) {
if (array[13] != cb_import.Text) {
return false;
}
}
if (cb_export.SelectedIndex != 0) {
if (array[14] != cb_export.Text) {
return false;
}
}
return true;
}
private void tb_order_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
@@ -360,17 +404,5 @@ namespace WindowsFormsApp1.Delivery
}
}
void Column_Text_Color()
{
for(int a = 0; a < dataGridView1.Rows.Count; a++)
{
if (dataGridView1.Rows[a].Cells["Column2"].Value.ToString() == "입고") {
dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Blue;
}
else if (dataGridView1.Rows[a].Cells["Column2"].Value.ToString() == "미입고") {
dataGridView1.Rows[a].DefaultCellStyle.ForeColor = Color.Red;
}
}
}
}
}

View File

@@ -28,9 +28,9 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
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();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.num = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.isbn = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -72,13 +72,13 @@
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.num,
@@ -104,17 +104,17 @@
this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnF2;
this.dataGridView1.Location = new System.Drawing.Point(12, 35);
this.dataGridView1.Name = "dataGridView1";
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle8.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dataGridView1.RowHeadersWidth = 20;
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(1608, 547);
this.dataGridView1.TabIndex = 0;

View File

@@ -23,7 +23,7 @@ namespace WindowsFormsApp1.Mac
Helper_DB db = new Helper_DB();
public string compidx;
public string list_name = string.Empty;
private int rowidx;
public int rowidx;
private bool save = true;
public Check_ISBN(Main _main)
{
@@ -46,7 +46,7 @@ namespace WindowsFormsApp1.Mac
private void Check_ISBN_Load(object sender, EventArgs e)
{
tb_list_name.Text = compidx + " " + list_name;
tb_list_name.Text = list_name;
string[] list_combo = { "알라딘", "네이버", "다음" };
cb_api.Items.AddRange(list_combo);
@@ -56,12 +56,79 @@ namespace WindowsFormsApp1.Mac
string[] search_col = { compidx, list_name };
string search_data = "`header`, `num`, `isbn`, `book_name`, `author`, `book_comp`, " +
"`count`, `pay`, `total`, `import`, `price`, " +
"`etc`, `pubDate`, `persent`, `category`, `image_url`";
"`etc`, `pubDate`, `persent`, `category`, `image_url`, `set_book_name`";
string tmp_data = db.More_DB_Search("Obj_List_Book", search_tbl, search_col, search_data);
string[] data = tmp_data.Split('|');
made_Grid(data);
}
#region Load_Sub
void made_Grid(string[] data)
{
/* 번호 isbn 도서명 저자 출판사
* 수량 단가 합계 상태 정가
* 비고 발행일 % 도서분류 */
string[] grid = { "", "", "", "", "",
"", "", "", "", "",
"", "", "", "", "",
"", "", "", "" };
int sdc = 17; // search_data_count
for (int a = 0; a < data.Length; a++)
{
if (a % sdc == 1) { grid[0] = data[a - 1] + " " + data[a]; } // 번호
if (a % sdc == 2) { grid[1] = data[a]; } // isbn
if (a % sdc == 3) { grid[2] = data[a]; } // 도서명
if (a % sdc == 4) { grid[4] = data[a]; } // 저자
if (a % sdc == 5) { grid[6] = data[a]; } // 출판사
if (a % sdc == 6) { grid[8] = data[a]; } // 수량
if (a % sdc == 7) { grid[9] = data[a]; } // 단가
if (a % sdc == 8) { grid[10] = data[a]; } // 합계
if (a % sdc == 9) { grid[11] = data[a]; } // 상태
if (a % sdc == 10) { grid[12] = data[a]; } // 정가
if (a % sdc == 11) { grid[13] = data[a]; } // 비고
if (a % sdc == 12) { grid[14] = data[a]; } // 발행일
if (a % sdc == 13) { grid[15] = data[a]; } // %
if (a % sdc == 14) { grid[16] = data[a]; } // 도서분류
if (a % sdc == 15) { grid[18] = data[a]; } // 도서 URL
if (a % sdc == 16) {
if (data[a] != "") {
grid[2] = data[a];
}
dataGridView1.Rows.Add(grid);
}
}
for (int a = 0; a < dataGridView1.Rows.Count; a++)
{
if (dataGridView1.Rows[a].Cells["isbn"].Value.ToString() != "")
{
if (dataGridView1.Rows[a].Cells["unit"].Value.ToString() !=
dataGridView1.Rows[a].Cells["price"].Value.ToString())
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.Orange;
else
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.Yellow;
}
}
Set_grid();
}
void Set_grid()
{
for (int a = 0; a < dataGridView1.Columns.Count; a++)
{
if (dataGridView1.Columns[a].HeaderText == "ISBN13" ||
dataGridView1.Columns[a].Name == "book_name" ||
dataGridView1.Columns[a].Name == "author" ||
dataGridView1.Columns[a].Name == "book_comp")
{
dataGridView1.Columns[a].ReadOnly = false;
}
else { dataGridView1.Columns[a].ReadOnly = true; }
}
}
#endregion
private void btn_lookup_Click(object sender, EventArgs e)
{
if (cb_api.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
@@ -459,64 +526,6 @@ namespace WindowsFormsApp1.Mac
dataGridView1.Rows[idx].DefaultCellStyle.BackColor = Color.Yellow;
}
}
void made_Grid(string[] data)
{
/* 번호 isbn 도서명 저자 출판사
* 수량 단가 합계 상태 정가
* 비고 발행일 % 도서분류 */
string[] grid = { "", "", "", "", "",
"", "", "", "", "",
"", "", "", "", "",
"", "", "", "" };
int sdc = 16; // search_data_count
for (int a = 0; a < data.Length; a++)
{
if (a % sdc == 1) { grid[0] = data[a-1] + " " + data[a]; } // 번호
if (a % sdc == 2) { grid[1] = data[a]; } // isbn
if (a % sdc == 3) { grid[2] = data[a]; } // 도서명
if (a % sdc == 4) { grid[4] = data[a]; } // 저자
if (a % sdc == 5) { grid[6] = data[a]; } // 출판사
if (a % sdc == 6) { grid[8] = data[a]; } // 수량
if (a % sdc == 7) { grid[9] = data[a]; } // 단가
if (a % sdc == 8) { grid[10] = data[a]; } // 합계
if (a % sdc == 9) { grid[11] = data[a]; } // 상태
if (a % sdc == 10) { grid[12] = data[a]; } // 정가
if (a % sdc == 11) { grid[13] = data[a]; } // 비고
if (a % sdc == 12) { grid[14] = data[a]; } // 발행일
if (a % sdc == 13) { grid[15] = data[a]; } // %
if (a % sdc == 14) { grid[16] = data[a]; } // 도서분류
if (a % sdc == 15) { grid[18] = data[a]; // 도서 URL
dataGridView1.Rows.Add(grid); }
}
for(int a = 0; a < dataGridView1.Rows.Count; a++)
{
if (dataGridView1.Rows[a].Cells["isbn"].Value.ToString() != "")
{
if (dataGridView1.Rows[a].Cells["unit"].Value.ToString() !=
dataGridView1.Rows[a].Cells["price"].Value.ToString()) {
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.Orange;
}
else {
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.Yellow;
}
}
}
Set_grid();
}
void Set_grid()
{
for(int a = 0; a < dataGridView1.Columns.Count; a++)
{
if (dataGridView1.Columns[a].HeaderText == "ISBN13" ||
dataGridView1.Columns[a].Name == "book_name" ||
dataGridView1.Columns[a].Name == "author" ||
dataGridView1.Columns[a].Name == "book_comp") {
dataGridView1.Columns[a].ReadOnly = false;
}
else { dataGridView1.Columns[a].ReadOnly = true; }
}
}
private void btn_Save_Click(object sender, EventArgs e)
{
for (int a = 0; a < dataGridView1.Rows.Count; a++)
@@ -528,12 +537,16 @@ namespace WindowsFormsApp1.Mac
dataGridView1.Rows[a].Cells["pubDate"].Value.ToString(),
dataGridView1.Rows[a].Cells["category"].Value.ToString(),
dataGridView1.Rows[a].Cells["image"].Value.ToString() };
string[] Search_tbl = { "book_name", "author", "book_comp", "list_name" };
string[] Search_col = {dataGridView1.Rows[a].Cells["book_name"].Value.ToString(),
dataGridView1.Rows[a].Cells["author"].Value.ToString(),
dataGridView1.Rows[a].Cells["book_comp"].Value.ToString(),
list_name };
db.More_Update("Obj_List_Book", Edit_tbl, Edit_Col, Search_tbl, Search_col);
string[] Search_tbl = { "book_name", "author", "book_comp", "list_name", "compidx" };
string[] Search_col = { dataGridView1.Rows[a].Cells["book_name"].Value.ToString(),
dataGridView1.Rows[a].Cells["author"].Value.ToString(),
dataGridView1.Rows[a].Cells["book_comp"].Value.ToString(),
list_name, compidx };
if (dataGridView1.Rows[a].Cells["etc"].Value.ToString().Contains("세트분할"))
Search_tbl[0] = "set_book_name";
db.More_Update("Obj_List_Book", Edit_tbl, Edit_Col, Search_tbl, Search_col, 1);
}
MessageBox.Show("저장되었습니다!");
save = true;
@@ -547,7 +560,7 @@ namespace WindowsFormsApp1.Mac
if (rowidx >= dataGridView1.Rows.Count) return;
if (dataGridView1.Rows[rowidx].Cells["api_data"].Value == null ||
dataGridView1.Rows[rowidx].Cells["api_data"].Value.ToString() == "") {
return;
return;
}
Check_ISBN_Sub sub = new Check_ISBN_Sub(this);
sub.row = rowidx;
@@ -567,11 +580,18 @@ namespace WindowsFormsApp1.Mac
split.book_data[4] = dataGridView1.Rows[rowidx].Cells["unit"].Value.ToString();
split.book_data[5] = dataGridView1.Rows[rowidx].Cells["count"].Value.ToString();
split.row_idx = rowidx;
split.compidx = compidx;
split.Show();
}
if (e.KeyCode == Keys.F12)
{
// 도서정보
Book_Lookup bl = new Book_Lookup(this);
bl.TopMost = true;
string book_name = dataGridView1.Rows[rowidx].Cells["book_name"].Value.ToString();
string author = dataGridView1.Rows[rowidx].Cells["author"].Value.ToString();
string book_comp = dataGridView1.Rows[rowidx].Cells["book_comp"].Value.ToString();
bl.Lookup_Load(book_name, author, book_comp, list_name);
bl.Show();
}
if (e.KeyCode == Keys.Up)
{
@@ -607,6 +627,12 @@ namespace WindowsFormsApp1.Mac
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
rowidx = e.RowIndex;
richTextBox1.Text += dataGridView1.Rows[rowidx].Cells["etc"].Value.ToString().Contains("세트분할").ToString();
if (rowidx < 0) {
Skill_Grid sg = new Skill_Grid();
sg.Grid_Sort(dataGridView1, e.ColumnIndex);
return;
}
if (dataGridView1.Rows[rowidx].Cells["api_data"].Value == null) {
return;
}

View File

@@ -19,8 +19,10 @@ namespace UniMarc.마크
/// 번호 / 도서명 / 저자 / 출판사 / 정가 / 수량
/// </summary>
public string[] book_data = { "", "", "", "", "", "" };
public string compidx;
public int row_idx;
Check_ISBN isbn;
Helper_DB db = new Helper_DB();
public Check_ISBN_Split()
{
InitializeComponent();
@@ -33,6 +35,7 @@ namespace UniMarc.마크
private void Check_ISBN_Split_Load(object sender, EventArgs e)
{
db.DBcon();
TextBox[] tb = { tb_num, tb_book_name, tb_author, tb_book_comp, tb_price, tb_count };
for (int a = 0; a < tb.Length; a++)
{
@@ -52,11 +55,11 @@ namespace UniMarc.마크
{
dataGridView1.Rows.Clear();
int start = Convert.ToInt32(num_Start.Value);
string[] grid = { book_data[0], book_data[1], book_data[2], book_data[3], book_data[4], book_data[5], "" };
string[] grid = { book_data[0], tb_c_book_name.Text, book_data[2], book_data[3], book_data[4], book_data[5], "" };
for (int a = 0; a < num_Line.Value; a++)
{
grid[1] = string.Format("{0} {1}", book_data[1], start);
grid[1] = string.Format("{0} {1}", tb_c_book_name.Text, start);
grid[5] = num_Count.Value.ToString();
grid[6] = Total(grid[4], grid[5]);
@@ -95,10 +98,52 @@ namespace UniMarc.마크
grid_data[6], "", "", "", "",
"", "", "", "", ""
};
Set_Insert(grid_data);
isbn.dataGridView1.Rows.Insert(row_idx + 1, grid);
}
btn_Close_Click(null, null);
}
#region Save_Sub
/// <summary>
/// 세트도서에 해당하는 DB를 먼저 Select한 후
/// 그 정보를 set_book_name만 수정하여 Insert한다
/// </summary>
private void Set_Insert(string[] grid_data)
{
string list_name = isbn.list_name;
string Area = "`compidx`, `list_name`, `date`, `header`, `num`, `book_name`";
string[] Search_col = {
"list_name", "compidx", "book_name", "author", "book_comp", "pay", "count"
};
string[] Search_data = {
list_name, compidx, book_data[1], book_data[2], book_data[3], book_data[4], book_data[5]
};
string search_book = db.More_DB_Search("Obj_List_Book", Search_col, Search_data, Area);
string[] tmp_db = search_book.Split('|');
List<string> Search_List = new List<string>();
for (int a = 0; a < tmp_db.Length - 1; a++) {
Search_List.Add(tmp_db[a]);
}
for (int a = 1; a < grid_data.Length; a++) {
Search_List.Add(grid_data[a]);
}
Search_List.Add("세트분할");
// 회사인덱스, 목록명, 목록일자, 헤더, 넘버, 도서명, 세트도서명, 저자, 출판사, 수량, 단가, 합계, 비고
tmp_db = Search_List.ToArray();
string[] Insert_col = {
"compidx", "list_name", "date", "header", "num",
"book_name", "set_book_name", "author", "book_comp", "count",
"pay", "total", "etc"
};
// 정가 != 단가 일경우 INSERT 오류 발생.
db.DB_INSERT("Obj_List_Book", Insert_col, tmp_db);
}
#endregion
private void btn_Clear_Click(object sender, EventArgs e)
{