Esempio n. 1
0
        private void GridViewChallan_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string Action = this.GridViewChallan.Columns[e.ColumnIndex].HeaderText;

            if (Action == "Edit")
            {
                frmEntryChallan frm = new frmEntryChallan();
                ChallanId         = Convert.ToInt32(GridViewChallan.Rows[e.RowIndex].Cells[0].Value);
                frm.ChallanId     = ChallanId;
                frm.FormClosed   += frmParty_FormClosed;
                frm.ShowInTaskbar = false;
                frm.Show();
            }

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

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