public ActionResult getDropDowns(int id) { BusinessLayer.PatientsBL patient = new BusinessLayer.PatientsBL(); Common.Patient CurrPat = patient.GetPatient(id); BusinessLayer.PatientsBL p = new BusinessLayer.PatientsBL(); Models.UIModel.StoreDropDown Model = new Models.UIModel.StoreDropDown(); Model.DecPlace = CurrPat.DeceasedPlace_fk;//Guid if (CurrPat.DiagnosisPatient != null) { Model.Diagnosis = CurrPat.DiagnosisPatient.DiagnosisType_fk;//Guid } if (CurrPat.DiagnosisPatient != null) { Model.DiagnosisDate = CurrPat.DiagnosisPatient.DiagnosisDate; } Model.FileStatus = CurrPat.FileStatus_fk;//Guid Model.Gender = CurrPat.Person.Gender_fk; if (CurrPat.Person.Property != null) { Model.Island = CurrPat.Person.Property.Street.Locality.Island_fk; //Guid Model.Locality = CurrPat.Person.Property.Street.Locality_fk; //Guid Model.Property = CurrPat.Person.Property_fk; //Guid Model.Street = CurrPat.Person.Property.Street_fk; //Guid } Model.OriginReferral = CurrPat.OriginOfReferral_fk; //Guid Model.PatientAware = CurrPat.PatientAware_fk; //Guid Model.RelativesAware = CurrPat.RelativesAware_fk; //Guid Model.Title = CurrPat.Person.Title_fk; //Guid if (CurrPat.PatientsEmployees.SingleOrDefault(pat => pat.PatientFileNumber_fk == id) != null) { Model.KeyWorker = CurrPat.PatientsEmployees.SingleOrDefault(pat => pat.PatientFileNumber_fk == id).EmployeeId_fk; } BusinessLayer.UsersBL emp = new BusinessLayer.UsersBL(); Common.Doctor d = new Common.Doctor(); if (CurrPat.FamilyDoctor_fk != null) { Model.FamilyDoctorEmp = emp.GetDoctor(CurrPat.FamilyDoctor_fk).DEmployeeId_FK; Model.FamilyDoctorName = emp.GetDoctor(CurrPat.FamilyDoctor_fk).DoctorName; } if (CurrPat.Oncologist_fk != null) { Model.OncologistEmp = emp.GetDoctor(CurrPat.Oncologist_fk).DEmployeeId_FK; Model.OncologistName = emp.GetDoctor(CurrPat.Oncologist_fk).DoctorName; } if (CurrPat.Consultant_fk != null) { Model.ConsultantEmp = emp.GetDoctor(CurrPat.Consultant_fk).DEmployeeId_FK; Model.ConsultantName = emp.GetDoctor(CurrPat.Consultant_fk).DoctorName; } return(Json(Model, JsonRequestBehavior.AllowGet)); }
public ActionResult AddPatient(Common.Doctor d, Common.DiagnosisPatient dp, Common.PatientsEmployee pe, Common.Patient pat, Common.Person per, string txtStreetP, string txtPropertyP, Guid?locality, Guid?street, string txtOnc, Guid?ddOnc, string txtCon, Guid?ddCon, string txtFD, Guid?ddFD) { BusinessLayer.PatientsBL patient = new BusinessLayer.PatientsBL(); try { if (per.IdCardNumber != null) { if (patient.CheckRegister(per.IdCardNumber)) { patient.RegisterPerson(per, txtStreetP, txtPropertyP, locality, street); pat.Personfk = per.PersonID; patient.RegisterPatient(pat); if (pe.EmployeeId_fk != Guid.Empty) { patient.AddKeyWorker(pe); } if (dp.DiagnosisType_fk != Guid.Empty && dp.DiagnosisType_fk != null)//Issue Fix it { patient.AddDiagnosis(dp); } patient.AddDoctor(d, txtCon, txtOnc, txtFD, ddCon, ddFD, ddOnc); } } else { patient.RegisterPerson(per, txtStreetP, txtPropertyP, locality, street); pat.Personfk = per.PersonID; patient.RegisterPatient(pat); if (pe.EmployeeId_fk != Guid.Empty) { patient.AddKeyWorker(pe); } if (dp.DiagnosisType_fk != Guid.Empty && dp.DiagnosisType_fk != null)//Issue Fix it { patient.AddDiagnosis(dp); } patient.AddDoctor(d, txtCon, txtOnc, txtFD, ddCon, ddFD, ddOnc); } } catch (Exception ex) { throw ex; } return(Json("Valid", JsonRequestBehavior.AllowGet)); }