private void btnXoa_Click(object sender, EventArgs e) { if (status == "NORMAL") { if (_cusType != null) { try { //if (_phanQuyen == null || _phanQuyen.Xoa == false) //{ // MessageBox.Show("Không có quyền thực hiện chức năng này", "Phân quyền", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} CodeType.Delete(long.Parse(txtMa.Text)); _ClearForm(); _LoadDSNHom(); _setFormStatus("NORMAL"); } catch { MessageBox.Show("Không thể xoá dữ liệu đang sử dụng"); } } else { MessageBox.Show("Chưa có dữ liệu được chọn"); } } else { _setFormStatus("NORMAL"); } }
public ActionResult Delete(string id, FormCollection collection) { if (!CheckAccessToController()) { return(View("Error")); } try { // TODO: Add delete logic here var codeType = new CodeType(); // codeType.ConnectionStringUsed = ConnectionString.GetConnectionString("makkframework"); codeType.Code = id; codeType.Delete(); return(RedirectToAction("Index")); } catch { return(View()); } }