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

            if (Action == "Edit")
            {
                frmEntryLRNote frm = new frmEntryLRNote();
                ConsignmentId     = Convert.ToInt32(GridViewLR.Rows[e.RowIndex].Cells[0].Value);
                frm.Consignmentid = ConsignmentId;
                frm.FormClosed   += frm_FormClosed;
                frm.ShowInTaskbar = false;
                frm.ShowDialog();
            }

            if (Action == "Delete")
            {
                try
                {
                    ConsignmentId = Convert.ToInt32(GridViewLR.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 = ConsignmentNoteBusinessLogic.Delete(ConsignmentId);
                        MessageBox.Show("Party deleted successfully.");
                        fillgriddata();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Party already used some where else can't deleted successfully.");
                }
            }
        }
        public JsonResult DeleteConsignmentNote(int ConsignmentNoteId)
        {
            var result = ConsignmentNoteBusinessLogic.Delete(ConsignmentNoteId);

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