Ejemplo n.º 1
0
        private void grdEntryBill_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string Action = this.grdEntryBill.Columns[e.ColumnIndex].HeaderText;

            if (Action == "Edit")
            {
                frmChildBill frmchilbill = new frmChildBill();
                int billid = Convert.ToInt32(grdEntryBill.Rows[e.RowIndex].Cells["SrNo"].Value);
                frmchilbill.billdata = CommonClass.tblBillEntryDTO.Where(h => h.SrNo == billid).FirstOrDefault();
                frmchilbill.FormClosed += frmchilbill_FormClosed;
                frmchilbill.ShowDialog();
            }

            if (Action == "Delete")
            {
                try
                {
                    var messageBoxResult = MessageBox.Show("Are you sure want to delete this record?", "Delete", MessageBoxButtons.YesNo);
                    if (messageBoxResult == DialogResult.Yes)
                    {
                        int billid = Convert.ToInt32(grdEntryBill.Rows[e.RowIndex].Cells[0].Value);
                        tblBillEntryDTO billdata = CommonClass.tblBillEntryDTO.Where(h => h.SrNo == billid).FirstOrDefault();
                        CommonClass.tblBillEntryDTO.Remove(billdata);
                        fillGridData();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Bill already used some where else can't deleted successfully.");
                }

            }
        }
Ejemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            var frmbill = new frmChildBill();

            frmbill.ShowDialog();
        }
Ejemplo n.º 3
0
 private void btnEntry_Click(object sender, EventArgs e)
 {
     frmChildBill frmchilbill = new frmChildBill();
     frmchilbill.FormClosed += frmchilbill_FormClosed;
     frmchilbill.ShowDialog();
 }