예제 #1
0
 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);
         }
     }
 }
예제 #2
0
        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);
                    }
                }
            }
        }