private void btnOK_Click(object sender, EventArgs e) { //입고처리 버튼 //order_state = P_COMPLETE 로 바꾸고 //warehouse에 insert // List <MaterialReceivingVO> list = new List <MaterialReceivingVO>(); foreach (DataGridViewRow row in dgvMaterialReceiving.Rows) { bool isCellChecked = Convert.ToBoolean(row.Cells["chk"].EditedFormattedValue); if (isCellChecked) { MaterialReceivingVO vo = new MaterialReceivingVO(); vo.order_serial = row.Cells[1].Value.ToString(); vo.product_codename = row.Cells[4].Value.ToString(); vo.order_count = Convert.ToInt32(row.Cells[7].Value); vo.order_pdate = row.Cells[8].Value.ToString().Trim(); vo.product_name = row.Cells[5].Value.ToString().Trim(); vo.order_sdate = row.Cells[8].Value.ToString().Trim(); list.Add(vo); } } if (MessageBox.Show("입고처리하시겠습니까?", "입고처리", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { MaterialLedgerService service = new MaterialLedgerService(); bool result = service.AddMaterialQauntity(list); if (result) { MessageBox.Show("성공적으로 입고처리가 완료되었습니다.", "입고처리", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvMaterialReceiving.Rows.Clear(); } else { MessageBox.Show("입고처리 실패하였습니다. 다시 시도하여 주십시오.", "입고처리", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } } else { return; } }
private void BtnCancel_Click(object sender, EventArgs e) { //입고취소 버튼 List <MaterialReceivingVO> list = new List <MaterialReceivingVO>(); foreach (DataGridViewRow row in dataGridView1.Rows) { bool isCellChecked = Convert.ToBoolean(row.Cells["chk"].EditedFormattedValue); if (isCellChecked) { MaterialReceivingVO vo = new MaterialReceivingVO(); vo.order_serial = row.Cells[1].Value.ToString(); vo.product_codename = row.Cells[4].Value.ToString(); vo.order_count = Convert.ToInt32(row.Cells[7].Value); vo.product_name = row.Cells[5].Value.ToString(); list.Add(vo); } } MaterialLedgerService service = new MaterialLedgerService(); if (MessageBox.Show("입고 취소하시겠습니까?", "입고취소", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { bool result = service.CancelMaterial(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; } }