示例#1
0
        private void gridViewAccount_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string Action = this.gridViewAccount.Columns[e.ColumnIndex].HeaderText;

            if (Action == "Edit")
            {
                frmEntryAccount frmaccount = new frmEntryAccount();

                frmaccount.AccountId     = Convert.ToInt32(gridViewAccount.Rows[e.RowIndex].Cells[0].Value);
                frmaccount.FormClosed   += frmaccount_FormClosed;
                frmaccount.ShowInTaskbar = false;
                frmaccount.Show();
            }

            if (Action == "Delete")
            {
                try
                {
                    var messageBoxResult = MessageBox.Show("Are you sure want to delete this record?", "Delete", MessageBoxButtons.YesNo);
                    if (messageBoxResult == DialogResult.Yes)
                    {
                        var result = AccountsMasterBusinessLogic.Delete(Convert.ToInt32(gridViewAccount.Rows[e.RowIndex].Cells[0].Value));
                        MessageBox.Show("Account deleted successfully.");
                        FillGridData();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Account already used some where else can't deleted successfully.");
                }
            }
        }
示例#2
0
        public JsonResult DeleteAccountsMaster(int id)
        {
            var result = AccountsMasterBusinessLogic.Delete(id);

            if (result)
            {
                return(Json(new { Success = true, Message = "Delete Successfully." }));
            }
            return(Json(new { Success = false, Message = "Error in transaction." }));
        }