コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            var patientBll = new PatientBLL();

            patientBll.Delete(id);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            try
            {
                patientBusiness.Delete(id);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                return(View());
            }
        }
コード例 #3
0
        public ActionResult Delete(int id)
        {
            try
            {
                var pateintToDelete = _PatientBLL.GetItemById(id);
                var nokToDelete     = _NextOfKinBLL.GetAll().Where(a => a.Id == pateintToDelete.NextOfKinId).FirstOrDefault();
                _PatientBLL.Delete(pateintToDelete);
                _NextOfKinBLL.Delete(nokToDelete);
                _NextOfKinBLL.Save();

                return(Json(new { data = "Delete", Success = true, msg = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { data = "Delete", Success = false, msg = "Not Deleted" }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
ファイル: main.cs プロジェクト: roytaner/ZebraPrinter
        private void dgvPatient_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                return;
            }

            if (e.ColumnIndex > 5)
            {
                int id = ConvertHelper.ConvertToInt(this.dgvPatient.Rows[e.RowIndex].Cells[0].Value.ToString(), 0);
                PatientFullEntity entity = listPatient.Find(p => p.Id == id);
                if (entity == null)
                {
                    return;
                }

                switch (e.ColumnIndex)
                {
                case 6: // 修改
                    var patientForm = new Patient(entity);
                    var result      = patientForm.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        patientBLL.Update(patientForm.Entity);
                        RefreshData();
                        BindData();
                    }
                    break;

                case 7: // 删除
                    patientBLL.Delete(id);
                    RefreshData();
                    BindData();
                    break;

                case 8: // 打印
                    Print p = new Print(entity, printBLL);
                    p.ShowDialog();
                    break;
                }
            }
        }