Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            string resultTrans = "success";

            try
            {
                var diagnosisList = diagnosisReposityory.GetDiagnosisByPatientId(id);
                if (diagnosisList.Count() == 0)
                {
                    Patient originPatient = patientRepository.GetPatientById(id);
                    var     newPatient    = ObjectCopier.Copy <Patient>(originPatient);

                    newPatient.Status = 0;//For Delete
                    patientRepository.UpdateFieldChangedOnly(originPatient, newPatient);

                    /*For Add New Record to LogTable*/
                    var objSession = Session["user"] as MyClinic.Infrastructure.SessUser;
                    int userId     = objSession.UserId;

                    logTran.UserId      = userId;
                    logTran.ProcessType = "Delete Patient";
                    logTran.Description = "Delete Patient Name :" + originPatient.Name;
                    logTran.LogDate     = DateTime.Now;
                    logRepository.Add(logTran);
                }
                else
                {
                    resultTrans = "failure";
                    return(Json(new { result = resultTrans, proccessType = "Delete", Id = id, strName = Translator.ThisPatient, strUsed = Translator.MsgDiagnosis }));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(Json(new { result = resultTrans, proccessType = "Delete", Id = id }));
        }