private void dgv_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { string measureId = dgv.Rows[e.RowIndex].Cells[1].Value.ToString(); Measure ob = measureBLL.GetMeasureWithID(measureId); if (ob != null) { txtMeasureId.Text = ob.MeasureId; rtbNote.Text = ob.MeasureNote; cboProduct.SelectedValue = ob.ProductId; // get detail LoadDetails(measureId); } //// Xóa if (e.ColumnIndex == 4) { if (CustomMessageBox.MessageBox.ShowCustomMessageBox("Bạn có chắc muốn xóa định lượng này", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO) == DialogResult.Yes) { int Xoa = measureBLL.Delete(measureId); if (Xoa == 1) // xóa thành côg { CustomMessageBox.MessageBox.ShowCustomMessageBox("Xóa Thành Công", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); dgv.Rows.RemoveAt(e.RowIndex); foreach (Control c in this.pInput.Controls) { if (c is TextBox) { ((TextBox)c).Text = String.Empty; } if (c is RichTextBox) { ((RichTextBox)c).Text = String.Empty; } if (c is ComboBox) { ((ComboBox)c).SelectedIndex = 0; } if (c is CheckBox) { ((CheckBox)c).Checked = false; } lblTB1.Text = "..."; lblTB.Text = "..."; } DanhLaiSTT(); } } } } }
public ActionResult Delete(List <int> id) { if (string.IsNullOrEmpty(id.ToString())) { TempData["Error"] = "Data has already been deleted by other user!"; return(RedirectToAction("Index")); } List <string> lstMsg = new List <string>(); int returnCode = _measureBLL.Delete(id, out lstMsg); if (((int)Common.ReturnCode.Succeed == returnCode)) { return(Json(new { Message = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Message = false }, JsonRequestBehavior.AllowGet)); } }