private void btnDelete_Click(object sender, EventArgs e) { if (dgvMain.SelectedRows.Count != 0) { DataGridViewRow row = dgvMain.SelectedRows[0]; try { BillTypeDal billTypeDal = new BillTypeDal(); billTypeDal.DeleteBillType(row.Cells[0].Value.ToString()); bsMain.DataSource = billTypeDal.GetBillType(); } catch (Exception exp) { MessageBox.Show("ɾ������������Ϣʧ�ܣ�ԭ��" + exp.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void btnAdd_Click(object sender, EventArgs e) { BillTypeDialog billTypeDialog = new BillTypeDialog(); if (billTypeDialog.ShowDialog() == DialogResult.OK) { try { BillTypeDal billTypeDal = new BillTypeDal(); billTypeDal.AddBillType(billTypeDialog.BillCode, billTypeDialog.BillName, billTypeDialog.BillType, billTypeDialog.TaskLevel, billTypeDialog.Memo); bsMain.DataSource = billTypeDal.GetBillType(); } catch (Exception exp) { MessageBox.Show("��������������Ϣʧ�ܣ�ԭ��" + exp.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void btnModify_Click(object sender, EventArgs e) { if (dgvMain.SelectedRows.Count != 0) { DataGridViewRow row = dgvMain.SelectedRows[0]; BillTypeDialog billTypeDialog = new BillTypeDialog(row.Cells[0].Value.ToString(), row.Cells[1].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[3].Value.ToString(), row.Cells[4].Value.ToString()); if (billTypeDialog.ShowDialog() == DialogResult.OK) { try { BillTypeDal billTypeDal = new BillTypeDal(); billTypeDal.SaveBillType(billTypeDialog.BillCode, billTypeDialog.BillName, billTypeDialog.BillType, billTypeDialog.TaskLevel, billTypeDialog.Memo); bsMain.DataSource = billTypeDal.GetBillType(); } catch (Exception exp) { MessageBox.Show("�ĵ���������Ϣʧ�ܣ�ԭ��" + exp.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void pnlMain_ParentChanged(object sender, EventArgs e) { try { BillTypeDal billTypeDal = new BillTypeDal(); bsMain.DataSource = billTypeDal.GetBillType(); } catch (Exception exp) { MessageBox.Show("��ȡ����������Ϣʧ�ܣ�ԭ��" + exp.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }