private void btnSave_Click(object sender, EventArgs e) { //변경버튼 if (MessageBox.Show($"\"{dtpTobeDate.Value.ToShortDateString()}\"으로 변경하시겠습니까?", "날짜변경", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { vo.order_pdate = dtpTobeDate.Value.ToShortDateString(); try { PurchasingService service = new PurchasingService(); bool result = service.UpdateOrderDate(vo); if (result) { MessageBox.Show("납기일이 성공적으로 변경되었습니다.", "날짜변경", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("납기일 변경에 실패하였습니다.", "날짜변경", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } } else { return; } }
private void btnSearch_Click(object sender, EventArgs e) { //조회 버튼 try { SupplierVO vo = new SupplierVO(); //vo.order_state = "O_COMPLETE"; vo.start_date = dtpStartDate.Value.ToShortDateString(); vo.end_date = dtpEndDate.Value.ToShortDateString(); if (cboCompany.Text != "선택") { vo.company_name = cboCompany.Text; } if (txtOrderID.Text != "") { vo.order_id = txtOrderID.Text; } PurchasingService service = new PurchasingService(); dt = service.GetOrderList(vo); dataGridView1.DataSource = dt; } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } }
private void BtnCancel_Click(object sender, EventArgs e) { List <OrderVO> list = new List <OrderVO>(); foreach (DataGridViewRow row in dataGridView1.Rows) { bool isCellChecked = Convert.ToBoolean(row.Cells["chk"].EditedFormattedValue); if (isCellChecked) { OrderVO vo = new OrderVO(); vo.order_id = row.Cells[1].Value.ToString(); vo.plan_id = row.Cells[2].Value.ToString(); vo.order_count = Convert.ToInt32(row.Cells[9].Value); list.Add(vo); } } //발주취소 버튼 (발주번호, PlanID 값) PurchasingService service = new PurchasingService(); if (MessageBox.Show("발주 취소하시겠습니까?", "발주취소", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { bool result = service.UpdateOrder(list); if (result) { MessageBox.Show("성공적으로 발주취소가 완료되었습니다.", "발주취소", MessageBoxButtons.OK, MessageBoxIcon.Information); SetBottomStatusLabel("성공적으로 발주취소가 완료되었습니다."); btnSearch.PerformClick(); } else { MessageBox.Show("발주취소 실패하였습니다. 다시 시도하여 주십시오.", "발주취소", MessageBoxButtons.OK, MessageBoxIcon.Error); SetBottomStatusLabel("발주취소 실패하였습니다. 다시 시도하여 주십시오."); } } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } } else { return; } }
private void OrderDialog_Load(object sender, EventArgs e) { SetDataGridCompany(); SetDataGridOrdering(); PurchasingService service = new PurchasingService(); try { DataSet ds = service.GetOrderList(planID); dgvOrdering.DataSource = ds.Tables[0]; dgvCompany.DataSource = ds.Tables[1]; } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } //SetRowNumber(dgvCompany); }
private void btnAddOrder_Click(object sender, EventArgs e) { //발주버튼 List <OrderVO> list = new List <OrderVO>(); foreach (DataGridViewRow row in dgvOrdering.Rows) { bool isCellChecked = Convert.ToBoolean(row.Cells["chk"].EditedFormattedValue); if (isCellChecked) { OrderVO vo = new OrderVO(); vo.product_codename = row.Cells[3].Value.ToString(); for (int i = 0; i < dgvCompany.Rows.Count; i++) { if (dgvCompany.Rows[i].Cells[0].Value.ToString() == row.Cells[2].Value.ToString()) { vo.order_id = dgvCompany.Rows[i].Cells[1].Value.ToString(); } } vo.order_count = Convert.ToInt32(row.Cells[8].Value); vo.plan_id = row.Cells[1].Value.ToString().Trim(); vo.order_pdate = row.Cells[5].Value.ToString().Trim(); list.Add(vo); } } for (int i = 0; i < dgvCompany.Rows.Count; i++) { List <int> orders = new List <int>(); int num = 1; for (int c = 0; c < list.Count; c++) { if (dgvCompany.Rows[i].Cells[1].Value.ToString() == list[c].order_id) { if (!orders.Contains(Convert.ToInt32(dgvCompany.Rows[i].Cells[1].Value))) { list[c].order_id += "-" + string.Format("{0:D4}", num); orders.Add(Convert.ToInt32(dgvCompany.Rows[i].Cells[1].Value)); } else { list[c].order_id += "-" + string.Format("{0:D4}", num); } num++; } } } if (MessageBox.Show("발주하시겠습니까?", "발주신청", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { PurchasingService service = new PurchasingService(); bool result = service.InsertOrder(list); if (result) { MessageBox.Show("성공적으로 발주 완료하였습니다.", "발주신청", MessageBoxButtons.OK, MessageBoxIcon.Question); this.Close(); } else { MessageBox.Show("발주 실패하였습니다. 다시 시도하여 주십시오.", "발주신청", MessageBoxButtons.OK, MessageBoxIcon.Question); return; } } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } } else { return; } }