public PatientDO GetPatientByPatientId(int patientId) { DataTable dtPatient = _objPatientDAL.GetPatientByPatientId(patientId); PatientDO p = null; if (dtPatient.Rows.Count > 0) { p = new PatientDO(); p.PatientId = Convert.ToInt32(dtPatient.Rows[0]["PatientId"].ToString()); p.FirstName = dtPatient.Rows[0]["FirstName"].ToString(); p.LastName = dtPatient.Rows[0]["LastName"].ToString(); p.PrimaryHolder = dtPatient.Rows[0]["PrimaryHolder"].ToString(); p.CountryName = dtPatient.Rows[0]["CountryName"].ToString(); p.CountryId = Convert.ToInt32(dtPatient.Rows[0]["CountryId"].ToString()); if (dtPatient.Rows[0]["DateofBirth"].ToString() != string.Empty) { p.DateofBirth = Convert.ToDateTime(dtPatient.Rows[0]["DateofBirth"].ToString()); p.Gender = Convert.ToBoolean(dtPatient.Rows[0]["Gender"].ToString()); if (dtPatient.Rows[0]["StateId"].ToString() != "") { p.StateId = Convert.ToInt32(dtPatient.Rows[0]["StateId"].ToString()); } else { p.StateId = 0; } if (dtPatient.Rows[0]["CityId"].ToString() != "") { p.CityId = Convert.ToInt32(dtPatient.Rows[0]["CityId"].ToString()); } else { p.CityId = 0; } p.Address = dtPatient.Rows[0]["Address"].ToString(); p.AddressLine1 = dtPatient.Rows[0]["AddressLine1"].ToString(); p.AddressLine2 = dtPatient.Rows[0]["AddressLine2"].ToString(); p.PostalCode = dtPatient.Rows[0]["PostalCode"].ToString(); p.Phone = dtPatient.Rows[0]["Phone"].ToString(); } p.Mobile = dtPatient.Rows[0]["Mobile"].ToString(); p.RelationshipId = Convert.ToInt32(dtPatient.Rows[0]["RelationshipId"].ToString()); p.ParentId = Convert.ToInt32(dtPatient.Rows[0]["ParentId"].ToString()); p.ReferenceToken = dtPatient.Rows[0]["ReferenceToken"].ToString(); p.ReferedPatientId = Convert.ToInt32(dtPatient.Rows[0]["ReferedPatientId"].ToString()); List <PastHistoryDO> ph = GetPastHistory(p.PatientId); p.PastHistory = ph; List <PersonalHistoryDO> phy = GetPersonalHistory(p.PatientId); p.PersonalHistory = phy; List <FamilyHistoryDO> fh = GetFamilyHistory(p.PatientId); p.FamilyHistory = fh; p.CreatedOn = Convert.ToDateTime(dtPatient.Rows[0]["CreatedOn"].ToString()); p.IsDeleted = Convert.ToBoolean(dtPatient.Rows[0]["IsDeleted"].ToString()); } return(p); }
public PatientDO GetPatient(string signInId) { DataTable dtPatient = _objPatientDAL.GetPatient(signInId); PatientDO p = null; if (dtPatient.Rows.Count > 0) { p = new PatientDO(); p.PatientId = Convert.ToInt32(dtPatient.Rows[0]["PatientId"].ToString()); p.FirstName = dtPatient.Rows[0]["FirstName1"].ToString(); p.LastName = dtPatient.Rows[0]["LastName1"].ToString(); p.CountryId = Convert.ToInt32(dtPatient.Rows[0]["CountryId"].ToString()); if (dtPatient.Rows[0]["DateofBirth"].ToString() != string.Empty) { p.DateofBirth = Convert.ToDateTime(dtPatient.Rows[0]["DateofBirth"].ToString()); p.Gender = Convert.ToBoolean(dtPatient.Rows[0]["Gender"].ToString()); if (dtPatient.Rows[0]["StateId"].ToString() != "") p.StateId = Convert.ToInt32(dtPatient.Rows[0]["StateId"].ToString()); else p.StateId = 0; if (dtPatient.Rows[0]["CityId"].ToString() != "") p.CityId = Convert.ToInt32(dtPatient.Rows[0]["CityId"].ToString()); else p.CityId = 0; p.Address = dtPatient.Rows[0]["Address"].ToString(); p.AddressLine1 = dtPatient.Rows[0]["AddressLine1"].ToString(); p.AddressLine2 = dtPatient.Rows[0]["AddressLine2"].ToString(); p.PostalCode = dtPatient.Rows[0]["PostalCode"].ToString(); p.Phone = dtPatient.Rows[0]["Phone"].ToString(); } p.Mobile = dtPatient.Rows[0]["Mobile"].ToString(); p.RelationshipId = Convert.ToInt32(dtPatient.Rows[0]["RelationshipId"].ToString()); p.ParentId = Convert.ToInt32(dtPatient.Rows[0]["ParentId"].ToString()); p.ReferenceToken = dtPatient.Rows[0]["ReferenceToken"].ToString(); p.ReferedPatientId = Convert.ToInt32(dtPatient.Rows[0]["ReferedPatientId"].ToString()); List<PastHistoryDO> ph = GetPastHistory(p.PatientId); p.PastHistory = ph; List<PersonalHistoryDO> phy = GetPersonalHistory(p.PatientId); p.PersonalHistory = phy; List<FamilyHistoryDO> fh = GetFamilyHistory(p.PatientId); p.FamilyHistory = fh; p.CreatedOn = Convert.ToDateTime(dtPatient.Rows[0]["CreatedOn"].ToString()); p.IsDeleted = Convert.ToBoolean(dtPatient.Rows[0]["IsDeleted"].ToString()); } return p; }
public bool SavePatient(PatientDO p) { try { int?stateId = null; if (p.StateId == 0) { stateId = null; } else { stateId = p.StateId; } int?cityId = null; if (p.CityId == 0) { cityId = null; } else { cityId = p.CityId; } int patientId = 0; if (p.DateofBirth.ToString() != "1/1/0001 12:00:00 AM") { patientId = _objPatientDAL.SavePatient(p.PatientId, p.LoginId, p.FirstName, p.LastName, p.DateofBirth, p.Gender, p.CountryId, stateId, cityId, p.Address, p.AddressLine1, p.AddressLine2, p.PostalCode, p.Phone, p.Mobile, p.RelationshipId, p.ParentId, p.ReferenceToken, p.ReferedPatientId); } else { patientId = _objPatientDAL.SavePatient(p.PatientId, p.LoginId, p.FirstName, p.LastName, null, p.Gender, p.CountryId, stateId, cityId, p.Address, p.AddressLine1, p.AddressLine2, p.PostalCode, p.Phone, p.Mobile, p.RelationshipId, p.ParentId, p.ReferenceToken, p.ReferedPatientId); } if (patientId > 0) { _objPatientDAL.DeletePatientPastHistory(patientId); foreach (PastHistoryDO item in p.PastHistory) { item.PatientId = patientId; _objPatientDAL.SavePatientPastHistory(item.PatientId, item.PastHistoryId); } _objPatientDAL.DeletePatientPersonalHistory(patientId); foreach (PersonalHistoryDO item in p.PersonalHistory) { item.PatientId = patientId; _objPatientDAL.SavePatientPersonalHistory(item.PatientId, item.PersonalHistoryId); } _objPatientDAL.DeletePatientFamilyHistory(patientId); foreach (FamilyHistoryDO item in p.FamilyHistory) { item.PatientId = patientId; _objPatientDAL.SavePatientFamilyHistory(item.PatientId, item.FamilyHistoryId); } } return(true); } catch { return(false); } }
public bool SavePatient(PatientDO p) { try { int? stateId = null; if (p.StateId == 0) stateId = null; else stateId = p.StateId; int? cityId = null; if (p.CityId == 0) cityId = null; else cityId = p.CityId; int patientId = 0; if (p.DateofBirth.ToString() != "1/1/0001 12:00:00 AM") patientId = _objPatientDAL.SavePatient(p.PatientId, p.LoginId, p.FirstName, p.LastName, p.DateofBirth, p.Gender, p.CountryId, stateId, cityId, p.Address, p.AddressLine1, p.AddressLine2, p.PostalCode, p.Phone, p.Mobile, p.RelationshipId, p.ParentId, p.ReferenceToken, p.ReferedPatientId); else patientId = _objPatientDAL.SavePatient(p.PatientId, p.LoginId, p.FirstName, p.LastName, null, p.Gender, p.CountryId, stateId, cityId, p.Address, p.AddressLine1, p.AddressLine2, p.PostalCode, p.Phone, p.Mobile, p.RelationshipId, p.ParentId, p.ReferenceToken, p.ReferedPatientId); if (patientId > 0) { _objPatientDAL.DeletePatientPastHistory(patientId); foreach (PastHistoryDO item in p.PastHistory) { item.PatientId = patientId; _objPatientDAL.SavePatientPastHistory(item.PatientId, item.PastHistoryId); } _objPatientDAL.DeletePatientPersonalHistory(patientId); foreach (PersonalHistoryDO item in p.PersonalHistory) { item.PatientId = patientId; _objPatientDAL.SavePatientPersonalHistory(item.PatientId, item.PersonalHistoryId); } _objPatientDAL.DeletePatientFamilyHistory(patientId); foreach (FamilyHistoryDO item in p.FamilyHistory) { item.PatientId = patientId; _objPatientDAL.SavePatientFamilyHistory(item.PatientId, item.FamilyHistoryId); } } return true; } catch { return false; } }