* unimarc
a. 팩스전송 완료. b. 마크목록 폼 작성중 1. 엑셀반출 기능 추가중 사용 작업중 2. 마크편집 폼 수정 중 (마크 반출 test프로젝트 진행완료, 본 프로젝트에 적용중. / 저장기능활성화 작업완료) 2-1. 기존의 칸채우기에서 예상되지 못한 버그가 발생하여 칸채우기 숨김. 2-2. 008태크 재배치 => TextBox에 적용완료. 변경사항 메모장으로 넘기는 작업 진행해야함. 2-3. 현재 TODO : 저장기능 * ISBN 체크 프로그램 - ★작업완료★ a. 현재 마크팀 배포완료. - 추후 수정사항발생시 수정할 것. TODOLIST 1. 팩스로 전송될 엑셀파일 밑작업마무리 (입력될 파라미터만 적용하면 실사용가능)
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ISBN_Check_test
|
||||
@@ -20,8 +21,9 @@ namespace ISBN_Check_test
|
||||
}
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
string[] api_list = { "알라딘", "네이버" };
|
||||
string[] api_list = { "알라딘", "네이버", "다음" };
|
||||
cb_api.Items.AddRange(api_list);
|
||||
|
||||
}
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -38,13 +40,19 @@ namespace ISBN_Check_test
|
||||
button2_Click(null, null);
|
||||
if(cb_api.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
|
||||
if(cb_filter.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
|
||||
|
||||
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
int start = Convert.ToInt32(start_idx.Text) - 1;
|
||||
int end = Convert.ToInt32(end_idx.Text) - 1;
|
||||
|
||||
progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
progressBar1.Minimum = start;
|
||||
progressBar1.Maximum = end;
|
||||
progressBar1.Step = 1;
|
||||
progressBar1.Value = 0;
|
||||
|
||||
if (start_idx.Text != "1" || end_idx.Text != dataGridView1.Rows.Count.ToString()) {
|
||||
start = Convert.ToInt32(start_idx.Text) - 1;
|
||||
end = Convert.ToInt32(end_idx.Text) - 1;
|
||||
@@ -58,6 +66,9 @@ namespace ISBN_Check_test
|
||||
case 1:
|
||||
Naver_API(dataGridView1, start, end);
|
||||
break;
|
||||
case 2:
|
||||
Daum_API(dataGridView1, start, end);
|
||||
break;
|
||||
}
|
||||
|
||||
stopwatch.Stop();
|
||||
@@ -112,6 +123,7 @@ namespace ISBN_Check_test
|
||||
|
||||
query = Set_query(type, a);
|
||||
insert_By_Aladin(api.Aladin(query, type, param), a);
|
||||
process_Sub();
|
||||
}
|
||||
}
|
||||
private void Naver_API(DataGridView gridview, int start, int end)
|
||||
@@ -179,13 +191,57 @@ namespace ISBN_Check_test
|
||||
L_Array.Add(gridview.Rows[a].Cells["author"].Value.ToString());
|
||||
L_Array.Add(gridview.Rows[a].Cells["book_comp"].Value.ToString());
|
||||
break;
|
||||
}
|
||||
} // 필터 적용
|
||||
|
||||
string[] arrayType = L_type.ToArray();
|
||||
string[] arrayValue = L_Array.ToArray();
|
||||
string result = api.Naver(arrayValue, arrayType, param);
|
||||
insert_By_Naver(result, a);
|
||||
process_Sub();
|
||||
Thread.Sleep(700);
|
||||
}
|
||||
}
|
||||
private void Daum_API(DataGridView gridview, int start, int end)
|
||||
{
|
||||
string[] param = { "title", "authors", "publisher", "isbn", "price",
|
||||
"datetime", "status" };
|
||||
string type = string.Empty;
|
||||
string query = string.Empty;
|
||||
API api = new API();
|
||||
|
||||
for(int a = start; a < end; a++)
|
||||
{
|
||||
if (gridview.Rows[a].DefaultCellStyle.BackColor == Color.Yellow)
|
||||
continue;
|
||||
else if (gridview.Rows[a].DefaultCellStyle.BackColor == Color.LightGray)
|
||||
gridview.Rows[a].DefaultCellStyle.BackColor = Color.Empty;
|
||||
|
||||
switch (cb_filter.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
type = "title";
|
||||
query = gridview.Rows[a].Cells["book_name"].Value.ToString();
|
||||
break;
|
||||
case 1:
|
||||
type = "person";
|
||||
query = gridview.Rows[a].Cells["author"].Value.ToString();
|
||||
break;
|
||||
case 2:
|
||||
type = "publisher";
|
||||
query = gridview.Rows[a].Cells["book_comp"].Value.ToString();
|
||||
break;
|
||||
}
|
||||
|
||||
string result = api.Daum(query, type, param);
|
||||
richTextBox1.Text = result;
|
||||
insert_By_Daum(result, a);
|
||||
process_Sub();
|
||||
}
|
||||
}
|
||||
private void process_Sub()
|
||||
{
|
||||
progressBar1.PerformStep();
|
||||
}
|
||||
string Set_query(string type, int idx)
|
||||
{
|
||||
string result = string.Empty;
|
||||
@@ -305,11 +361,68 @@ namespace ISBN_Check_test
|
||||
dataGridView1.Rows[row].Cells["Column1"].Value += string.Join("|", grid) + "|";
|
||||
dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.LightGray;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (sp_data.Length > 1) return;
|
||||
|
||||
if (row > 0) { dataGridView1.Rows[row - 1].Selected = false; }
|
||||
dataGridView1.Rows[row].Selected = true;
|
||||
#endregion
|
||||
|
||||
bool[] chk = { false, false, false };
|
||||
string book_name = dataGridView1.Rows[row].Cells["book_name"].Value.ToString();
|
||||
string author = dataGridView1.Rows[row].Cells["author"].Value.ToString();
|
||||
string book_comp = dataGridView1.Rows[row].Cells["book_comp"].Value.ToString();
|
||||
string newstring = DateTime.ParseExact(grid[5], "yyyyMMdd", null).ToString("yyyy-MM-dd");
|
||||
|
||||
if (grid[0] == book_name) chk[0] = true;
|
||||
if (grid[1].Contains(author) == true) chk[1] = true;
|
||||
if (grid[2] == book_comp) chk[2] = true;
|
||||
|
||||
if (chk[0] == true && chk[1] == true && chk[2] == true)
|
||||
{
|
||||
dataGridView1.Rows[row].Cells["isbn"].Value = grid[3];
|
||||
dataGridView1.Rows[row].Cells["price2"].Value = grid[4];
|
||||
dataGridView1.Rows[row].Cells["pubDate"].Value = newstring;
|
||||
dataGridView1.Rows[row].Cells["category"].Value = grid[6];
|
||||
dataGridView1.Rows[row].Cells["sold_out"].Value = grid[7];
|
||||
dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.Yellow;
|
||||
}
|
||||
}
|
||||
void insert_By_Daum(string value, int row)
|
||||
{
|
||||
if (row > 0) { dataGridView1.Rows[row - 1].Selected = false; }
|
||||
dataGridView1.Rows[row].Selected = true;
|
||||
|
||||
if (value == "") return;
|
||||
|
||||
string[] sp_data = value.Split('\n');
|
||||
string[] grid = { "", "", "", "", "", "", "", "" };
|
||||
|
||||
for (int a = 0; a < sp_data.Length-1; a++)
|
||||
{
|
||||
string[] data = sp_data[a].Split('|');
|
||||
grid[0] = data[0];
|
||||
grid[1] = data[1];
|
||||
grid[2] = data[2];
|
||||
string[] tmp_isbn = data[3].Split(' ');
|
||||
if (tmp_isbn.Length < 2)
|
||||
grid[3] = data[3].Replace(" ", "");
|
||||
|
||||
else
|
||||
grid[3] = tmp_isbn[1];
|
||||
|
||||
grid[4] = data[4];
|
||||
grid[5] = data[5].Substring(0, data[5].IndexOf('T'));
|
||||
grid[7] = data[6];
|
||||
|
||||
dataGridView1.Rows[row].Cells["Column1"].Value += string.Join("|", grid) + "|";
|
||||
dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.LightGray;
|
||||
}
|
||||
|
||||
if (sp_data.Length > 1) return;
|
||||
|
||||
if (row > 0) dataGridView1.Rows[row - 1].Selected = false;
|
||||
dataGridView1.Rows[row].Selected = true;
|
||||
|
||||
bool[] chk = { false, false, false };
|
||||
string book_name = dataGridView1.Rows[row].Cells["book_name"].Value.ToString();
|
||||
@@ -330,7 +443,6 @@ namespace ISBN_Check_test
|
||||
dataGridView1.Rows[row].Cells["sold_out"].Value = grid[7];
|
||||
dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.Yellow;
|
||||
}
|
||||
|
||||
}
|
||||
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
@@ -343,8 +455,16 @@ namespace ISBN_Check_test
|
||||
sg.DataGrid_to_Delete(sender, e);
|
||||
}
|
||||
if (e.KeyCode == Keys.Enter) { dataGridView1_CellDoubleClick(null, null); rowidx++; }
|
||||
if (e.KeyCode == Keys.Up) { rowidx--; }
|
||||
if (e.KeyCode == Keys.Down) { rowidx++; }
|
||||
if (e.KeyCode == Keys.Up) {
|
||||
rowidx--;
|
||||
if (rowidx < 0)
|
||||
rowidx = 0;
|
||||
}
|
||||
if (e.KeyCode == Keys.Down) {
|
||||
rowidx++;
|
||||
if (rowidx > dataGridView1.Rows.Count - 1)
|
||||
rowidx = dataGridView1.Rows.Count - 1;
|
||||
}
|
||||
end_idx.Text = dataGridView1.Rows.Count.ToString();
|
||||
}
|
||||
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||||
@@ -364,7 +484,7 @@ namespace ISBN_Check_test
|
||||
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (dataGridView1.Rows[rowidx].Cells["Column1"].Value == null ||
|
||||
dataGridView1.Rows[rowidx].Cells["Column1"].Value == "") { return; }
|
||||
dataGridView1.Rows[rowidx].Cells["Column1"].Value.ToString() == "") { return; }
|
||||
Form2 f2 = new Form2(this);
|
||||
f2.row = rowidx;
|
||||
f2.Call_API = cb_api.Text;
|
||||
@@ -389,6 +509,10 @@ namespace ISBN_Check_test
|
||||
"도서명 + 저자 + 출판사" };
|
||||
cb_filter.Items.AddRange(naver);
|
||||
}
|
||||
else if (cb_api.SelectedIndex == 2) {
|
||||
string[] daum = { "도서명", "저자", "출판사" };
|
||||
cb_filter.Items.AddRange(daum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user