public DataSet SaveMentalHealth(MentalHealth mentalhealth) { DataSet dataSet = new DataSet(); try { string storedProcedure = "pSRGs_MentalHealth"; string parameterName = "@aXMLString"; string parameterValue = ObjectHelper.GetXMLFromObject(mentalhealth); sqlCommand = new SqlCommand(storedProcedure, sqlConnection); sqlCommand.Parameters.AddWithValue(parameterName, parameterValue); sqlCommand.CommandType = CommandType.StoredProcedure; sqlConnection.Open(); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(dataSet); dataSet.Tables[0].TableName = "MENTALHEALTH"; } catch (Exception) { throw; } finally { sqlConnection.Close(); } return(dataSet); }
public async Task <IActionResult> PutProblem(MentalHealth id, Problem problem) { if (id != problem.ProblemId) { return(BadRequest()); } _context.Entry(problem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProblemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Problem> > GetProblem(MentalHealth id) { var problem = await _context.Problem.FindAsync(id); if (problem == null) { return(NotFound()); } return(problem); }
public async Task <ActionResult <Problem> > DeleteProblem(MentalHealth id) { var problem = await _context.Problem.FindAsync(id); if (problem == null) { return(NotFound()); } _context.Problem.Remove(problem); await _context.SaveChangesAsync(); return(problem); }
// Use this for initialization void Start() { //Class References instanceGameManager = GameManager.instanceGameManager; instanceMentalHealth = ScriptableObject.CreateInstance <MentalHealth>(); dbReference = FirebaseDatabase.DefaultInstance.RootReference; auth = instanceGameManager.auth; //Deactivating ui panels. foreach (GameObject p in panels) { p.SetActive(false); } panels [0].SetActive(true); }
private bool ValidateMedicalInfoForm(MentalHealth medicalhealth, out string responseMessage) { bool boolResponse = true; responseMessage = "<ul>"; List <FormData> IsMedicalHelathFormData = new List <FormData>(); IsMedicalHelathFormData.Add(new FormData(FormInputType.DropDownListValue, Convert.ToString(medicalhealth.Depression), "DEPRESSION", "Have you ever experienced post partum depression? ", true)); IsMedicalHelathFormData.Add(new FormData(FormInputType.DropDownListValue, Convert.ToString(medicalhealth.Illness), "ILLNESS", "Have you ever been diagnosed with an emotional condition or illness?", true)); IsMedicalHelathFormData.Add(new FormData(FormInputType.DropDownListValue, Convert.ToString(medicalhealth.Suicide), "SUICIDE", "Have you ever attempted suicide?", true)); IsMedicalHelathFormData.Add(new FormData(FormInputType.DropDownListValue, Convert.ToString(medicalhealth.Thoughts), "THOUGHTS", "Have you ever had suicidal thoughts?", true)); IsMedicalHelathFormData.Add(new FormData(FormInputType.DropDownListValue, Convert.ToString(medicalhealth.Professional), "PROFESSIONAL", "Have you ever been treated by a mental health professional?", true)); boolResponse = FormValidator.validateForm(IsMedicalHelathFormData, out responseMessage); return(boolResponse); }
public ActionResult MentalHealth() { SurrogateService mentalhealthservice = new SurrogateService(); MentalHealth mentalhealth = new MentalHealth(); try { mentalhealth.UserID = ApplicationManager.LoggedInUser.UserID; mentalhealth.EntityState = EntityState.View; mentalhealth = mentalhealthservice.SaveMentalHealth(mentalhealth); } catch (Exception ex) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000"); LoggerHelper.WriteToLog(ex); } return(View("MentalHealth", mentalhealth)); }
public ActionResult MentalHealth(MentalHealth mentalhealth) { SurrogateService mentalhealthservice = new SurrogateService(); string validationMessage = string.Empty; try { if (ValidateMedicalInfoForm(mentalhealth, out validationMessage)) { mentalhealth.EntityState = mentalhealth.MentalHealthID != null ? EntityState.Edit : EntityState.Save; mentalhealth.ChangeBy = ApplicationManager.LoggedInUser.UserID; mentalhealth.UserID = ApplicationManager.LoggedInUser.UserID; mentalhealth = mentalhealthservice.SaveMentalHealth(mentalhealth); if (mentalhealth.responseDetail.responseType == ResponseType.Error) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), mentalhealth.responseDetail.ResponseMessage, "5000"); return(View("MentalHealth", mentalhealth)); } else { WebHelper.SetMessageBoxProperties(this, ResponseType.Success); } } else { WebHelper.SetMessageBoxProperties(this, ResponseType.Error, validationMessage); return(View("MentalHealth", mentalhealth)); } } catch (Exception ex) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000"); LoggerHelper.WriteToLog(ex); } return(View("MentalHealth", mentalhealth)); }
public MentalHealth SaveMentalHealth(MentalHealth mentalhealth) { MentalHealth localmentalhealth = new MentalHealth(); SurrogateData mentalhealthdata = new SurrogateData(); DataSet dataSet = new DataSet(); try { dataSet = mentalhealthdata.SaveMentalHealth(mentalhealth); if (dataSet.Tables["MentalHealth"].Rows.Count > 0) { localmentalhealth = new MentalHealth(); localmentalhealth.MentalHealthID = dataSet.Tables["MentalHealth"].Rows[0]["MENTALHEALTHID"].ToString(); localmentalhealth.UserID = dataSet.Tables["MentalHealth"].Rows[0]["USERID"].ToString(); localmentalhealth.Depression = Convert.ToInt16(dataSet.Tables["MentalHealth"].Rows[0]["DEPRESSION"].ToString()); localmentalhealth.Illness = Convert.ToInt16(dataSet.Tables["MentalHealth"].Rows[0]["ILLNESS"].ToString()); localmentalhealth.Suicide = Convert.ToInt16(dataSet.Tables["MentalHealth"].Rows[0]["SUICIDE"].ToString()); localmentalhealth.Thoughts = Convert.ToInt16(dataSet.Tables["MentalHealth"].Rows[0]["THOUGHTS"].ToString()); localmentalhealth.Professional = Convert.ToInt16(dataSet.Tables["MentalHealth"].Rows[0]["PROFESSIONAL"].ToString()); localmentalhealth.Details = dataSet.Tables["MentalHealth"].Rows[0]["DETAILS"].ToString(); localmentalhealth.IsSubmit = Convert.ToInt32(dataSet.Tables["MentalHealth"].Rows[0]["ISSUBMIT"].ToString()); } } catch (SqlException sqlEx) { localmentalhealth.responseDetail.responseType = ResponseType.Error; localmentalhealth.responseDetail.ResponseMessage = sqlEx.Message; } catch (Exception ex) { localmentalhealth.responseDetail.responseType = ResponseType.Error; localmentalhealth.responseDetail.ResponseMessage = ApplicationManager.GenericErrorMessage; LoggerHelper.WriteToLog(ex); } return(localmentalhealth == null ? new MentalHealth() : localmentalhealth); }
public bool SaveMentalHealth(MentalHealthViewModel model, string UserId) { var result = false; try { var pregnancy = _repository.GetContext().Pregnancy.Where(p => p.PatientId == model.PatientId).FirstOrDefault(); if (model.Id > 0) { //Update Existing var mentalHealth = _repository.GetContext().MentalHealth.Where(p => p.Id == model.Id).FirstOrDefault(); Mapper.Map(model, mentalHealth); mentalHealth.SetUpdateDetails(UserId); _repository.SaveExisting(mentalHealth); } else { //Add new Record var mentalHealth = new MentalHealth(); Mapper.Map(model, mentalHealth); mentalHealth.PregnancyId = pregnancy.Id; mentalHealth.SetCreateDetails(UserId); var saveNew = _repository.SaveNew(mentalHealth); } result = true; } catch (Exception ex) { result = false; } return(result); }
private bool ProblemExists(MentalHealth id) { return(_context.Problem.Any(e => e.ProblemId == id)); }
public void MentalHealth_Is_Not_Null() { Assert.IsNotNull(MentalHealth.GetMentalHealth()); }
public void IQ_Is_Not_Null() { Assert.IsNotNull(MentalHealth.GetIQ()); }