/// <summary> /// 删除事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { if (BasicInfo.LoginName != dgv_Show.CurrentRow.Cells["LRRY"].Value.ToString()) { MessageDialog.ShowPromptMessage("您不是此记录的编制者无法进行此操作"); return; } if (dgv_Show.CurrentRow.Cells["DJH"].Value.ToString() == "") { MessageDialog.ShowPromptMessage("请选择需要删除的记录"); return; } string strDJZT = UniversalFunction.GetBillStatus("S_MarketingBill", "DJZT_FlAG", "DJH", dgv_Show.CurrentRow.Cells["DJH"].Value.ToString()); if (strDJZT == "已确认") { MessageBox.Show("请重新核实单据状态", "提示"); return; } if (MessageBox.Show("您是否确定要删除单据号为【" + dgv_Show.CurrentRow.Cells["DJH"].Value.ToString() + "】的单据吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (m_findSellIn.DeleteBill(Convert.ToInt32(dgv_Show.CurrentRow.Cells["ID"].Value), out m_err)) { if (dgv_Show.CurrentRow.Cells["YWFS"].Value.ToString().Contains("生产入库")) { if (!m_serverDeliveryInSpection.DeleteDeliveryInspection( dgv_Show.CurrentRow.Cells["DJH"].Value.ToString(), out m_err)) { MessageDialog.ShowPromptMessage(m_err); } } MessageBox.Show("删除成功", "提示"); m_billNoControl.CancelBill(dgv_Show.CurrentRow.Cells["DJH"].Value.ToString()); m_msgPromulgator.DestroyMessage(dgv_Show.CurrentRow.Cells["DJH"].Value.ToString()); RefreshDataGridView(); } else { MessageDialog.ShowErrorMessage(m_err); return; } } } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); return; } }