protected void cmdSaveQuestion_Click(object sender, EventArgs e) { try { int QuestionID = 0; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.AddParameter("@ParamQuestionText", txtQuestion.Text); object o = DBAgent.ExecuteScalar("dbo.spAddQuestion"); if (o != null) { QuestionID = int.Parse(o.ToString()); if (QuestionID > 0) { int AnswerSortOrder = 1; foreach (ListEditItem li in lbSelectedAnswers.Items) { DBAgent.ClearParams(); DBAgent.AddParameter("@ParamQuestionID", QuestionID); DBAgent.AddParameter("@ParamAnswerID", li.Value); DBAgent.AddParameter("@ParamAnswerSortOrder", AnswerSortOrder); DBAgent.ExecuteNonQuery("dbo.spAddQuestionAnswerMapping"); AnswerSortOrder++; } DBAgent.ClearParams(); DBAgent.AddParameter("@ParamQuestionnaireID", cmbQuestionnaireList.SelectedItem.Value); DBAgent.AddParameter("@ParamQuestionID", QuestionID); DBAgent.ExecuteNonQuery("dbo.spAddQuestionnaireQuestionMapping"); QuestionsGridView.DataBind(); RefreshForm(); } } QuestionsGridView.DataBind(); } catch (Exception ex) { CommonHelpers.writeLogToFile("cmdSaveQuestion_Click: EditQuestionnaire.aspx", ex.Message); } }
private void GetPhysicianList() { try { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamShowDeleted", 1); string data = DBAgent.ExecuteStoredProcedure("dbo.spGetallPhysicians"); if (!String.IsNullOrEmpty(data)) { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { Session["PhysicianDS"] = ds.Tables[0]; } } } catch (Exception ex) { CommonHelpers.writeLogToFile("GetPhysicianList: PatientList.aspx", ex.Message); } }
public PatientListResponse PostPatientList([FromBody] PatientListRequest request) { PatientListResponse response = new PatientListResponse(); try { if (CommonHelpers.ValidateRequest(request.UserToken)) { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); if (!String.IsNullOrEmpty(request.AccountNumber)) { DBAgent.AddParameter("@ParamAccountNumber", request.AccountNumber); } string data = DBAgent.ExecuteStoredProcedure("dbo.spGetPatientListByAccount"); if (data.Length > 0) { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { DataTable dTable = ds.Tables[0]; //response.PatientListDataTable = dTable; ArrayList PatientList = new ArrayList(); List <PatientDetails> PatientDetailsList = new List <PatientDetails>(); foreach (DataRow dr in dTable.Rows) { string PatientNameRow = String.Format("{0}, {1} ({2} - {3})", dr["PatientLastName"], dr["PatientFirstName"], dr["PatientAccountNumber"], dr["PatientDOB"]); PatientList.Add(String.Format("{0}, {1} ({2} - {3})", dr["PatientLastName"], dr["PatientFirstName"], dr["PatientAccountNumber"], dr["PatientDOB"])); PatientDetailsList.Add(new PatientDetails(PatientNameRow, dr["PatientID"].ToString())); } response.PatientList = PatientList; response.PatientDetailsList = PatientDetailsList; } else { response.ErrorMessage = "No Data"; } } else { response.ErrorMessage = "No Data"; } } else { response.ErrorMessage = "Invalid Request"; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", request.LoginID); DBAgent.AddParameter("@ParamRefType", "Users"); DBAgent.AddParameter("@ParamAction", "IR"); DBAgent.AddParameter("@ParamComment", "Invalid Requestv from Mobile App - PatientListController - " + request.UserToken); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } catch (Exception ex) { response.ErrorMessage = ex.Message; CommonHelpers.writeLogToFile("API: PostPatientList - PatientListController.cs", ex.Message + Environment.NewLine + ex.StackTrace); } return(response); }
public IHttpActionResult PostQuestionnaireQuestions([FromBody] QuestionnaireQuestionsRequest request) { QuestionaireQuestionResponse response = new QuestionaireQuestionResponse(); try { if (CommonHelpers.ValidateRequest(request.UserToken)) { List <QuestionDetail> QuestionAnswerList = new List <QuestionDetail>(); DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamQuestionnaireID", request.QuestionnaireID); DBAgent.AddParameter("@ParamPQID", request.PQID); string data = DBAgent.ExecuteStoredProcedure("dbo.spGetAllQuestionAnswersForQuestionnaire"); if (data.Length > 0) { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { int CurrentQuestionID = 0; QuestionDetail qd = null; foreach (DataRow dr in ds.Tables[0].Rows) { if (CurrentQuestionID != int.Parse(dr["QuestionID"].ToString())) { if (qd != null) { //Save Previous Question QuestionAnswerList.Add(qd); } //New Question qd = new QuestionDetail(); qd.QuestionText = dr["QuestionText"].ToString(); qd.QuestionID = dr["QuestionID"].ToString(); CurrentQuestionID = int.Parse(dr["QuestionID"].ToString()); } AnswerDetail ans = new AnswerDetail(); ans.AnswerID = dr["AnswerID"].ToString(); ans.AnswerText = dr["AnswerText"].ToString(); ans.SelectedAnswer = bool.Parse(dr["SelectedAnswer"].ToString()); ans.AnswerPoints = int.Parse(dr["AnswerPoints"].ToString()); qd.QuestionAnswers.Add(ans); } QuestionAnswerList.Add(qd); //Adding last Question response.QuestionAnswerList = QuestionAnswerList; } } else { response.ErrorMessage = "No Data"; } } else { response.ErrorMessage = "Invalid Request"; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", request.PQID); DBAgent.AddParameter("@ParamRefType", "PQID"); DBAgent.AddParameter("@ParamAction", "IR"); DBAgent.AddParameter("@ParamComment", "Invalid Request from Mobile App - QuestionnaireQuestionsController - " + request.UserToken); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } catch (Exception ex) { response.ErrorMessage = ex.Message; CommonHelpers.writeLogToFile("API: PostQuestionnaireQuestions - QuestionnaireQuestionsController.cs", ex.Message + Environment.NewLine + ex.StackTrace); } return(Ok(response)); }
public IHttpActionResult PostPatientVerificaiton([FromBody] PatientVerifiactionRequest request) { PatientVerificationResponse response = new PatientVerificationResponse(); try { if (CommonHelpers.ValidateRequest(request.UserToken)) { if (!request.LogVerificaiton) { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamPatientID", request.PatientID); string data = DBAgent.ExecuteStoredProcedure("dbo.spGetPatientDetails"); if (data.Length > 0) { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; response.PatientFirstName = dr["PatientFirstName"].ToString(); response.PatientLastName = dr["PatientLastName"].ToString(); response.DOB = dr["FormattedDOB"].ToString(); response.MaskedName = dr["MaskedName"].ToString(); response.PhysicianName = dr["PhysicianName"].ToString(); response.AccountNumber = dr["PatientAccountNumber"].ToString(); } else { response.ErrorMessage = "No Data"; } } else { response.ErrorMessage = "No Data"; } } else { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", request.PatientID); DBAgent.AddParameter("@ParamRefType", "PatientInfo"); DBAgent.AddParameter("@ParamAction", "VR"); DBAgent.AddParameter("@ParamComment", "Patient Verificaiton from Mobile App"); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } else { response.ErrorMessage = "Invalid Request"; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", request.PatientID); DBAgent.AddParameter("@ParamRefType", "PatientID"); DBAgent.AddParameter("@ParamAction", "IR"); DBAgent.AddParameter("@ParamComment", "Invalid Request from Mobile App - PatientVerification - " + request.UserToken); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } catch (Exception ex) { response.ErrorMessage = ex.Message; CommonHelpers.writeLogToFile("API: PostPatientVerificaiton - PatientVerificaitonController.cs", ex.Message + Environment.NewLine + ex.StackTrace); } return(Ok(response)); }
public IHttpActionResult PostSaveQuestionnaire([FromBody] SaveQuestionnaireRequest request) { SaveQuestionnaireResponse response = new SaveQuestionnaireResponse(); try { if (CommonHelpers.ValidateRequest(request.UserToken)) { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); List <QuestionDetail> QuestionAnswerList = request.QuestionAnswerList; int Score = 0; foreach (QuestionDetail Qn in QuestionAnswerList) { DBAgent.ClearParams(); DBAgent.AddParameter("@ParamPQID", request.PatientQuestionnaireID); DBAgent.AddParameter("@ParamQuestionID", Qn.QuestionID); int Points = 0; foreach (AnswerDetail An in Qn.QuestionAnswers) { if (An.SelectedAnswer) { Points = An.AnswerPoints; DBAgent.AddParameter("@ParamAnswerID", An.AnswerID); break; } } Score += Points; //Save Answer one by one DBAgent.ExecuteNonQuery("dbo.spAddPatientResponse"); } DBAgent.ClearParams(); DBAgent.AddParameter("@ParamPQID", request.PatientQuestionnaireID); DBAgent.AddParameter("@ParamStartDate", request.QuestionnaireStartDate); DBAgent.AddParameter("@ParamScore", Score); DBAgent.ExecuteNonQuery("dbo.spUpdatePatientQuestionnare"); response.SaveStatus = true; } else { response.ErrorMessage = "Invalid Request"; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", request.PatientQuestionnaireID); DBAgent.AddParameter("@ParamRefType", "PQID"); DBAgent.AddParameter("@ParamAction", "IR"); DBAgent.AddParameter("@ParamComment", "Invalid Request from Mobile App - SaveQuestionnaire - " + request.UserToken); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } catch (Exception ex) { response.ErrorMessage = ex.Message; response.SaveStatus = false; CommonHelpers.writeLogToFile("API: PostSaveQuestionnaire - SaveQuestionnaireController.cs", ex.Message + Environment.NewLine + ex.StackTrace); } return(Ok(response)); }
public IHttpActionResult PostPatientQuestionnaire([FromBody] PatientQuestionnaireRequest request) { PatientQuestionnaireResponse response = new PatientQuestionnaireResponse(); try { if (CommonHelpers.ValidateRequest(request.UserToken)) { List <QuestionnaireDetails> QuestionnaireList = new List <QuestionnaireDetails>(); //Assigned Questionnaires DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamPatientID", request.PatientID); DBAgent.AddParameter("@ParamHistoryList", 0); string data = DBAgent.ExecuteStoredProcedure("dbo.spGetPatientQuestionnaireList"); if (data.Length > 0) { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { QuestionnaireDetails qd = new QuestionnaireDetails(dr["QuestionnaireID"].ToString(), dr["QuestionnaireName"].ToString(), dr["ScheduledDate"].ToString(), dr["Score"].ToString(), dr["RiskCategory"].ToString(), dr["PQID"].ToString()); QuestionnaireList.Add(qd); } } } //Completed Questionnaires DBAgent.ClearParams(); DBAgent.AddParameter("@ParamPatientID", request.PatientID); DBAgent.AddParameter("@ParamHistoryList", 1); data = DBAgent.ExecuteStoredProcedure("dbo.spGetPatientQuestionnaireList"); if (data.Length > 0) { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { QuestionnaireDetails qd = new QuestionnaireDetails(dr["QuestionnaireID"].ToString(), dr["QuestionnaireName"].ToString(), dr["ScheduledDate"].ToString(), dr["Score"].ToString(), dr["RiskCategory"].ToString(), dr["PQID"].ToString()); QuestionnaireList.Add(qd); } } } if (QuestionnaireList.Count == 0) { response.ErrorMessage = "No Data"; } else { response.QuestionnaireList = QuestionnaireList; } } else { response.ErrorMessage = "Invalid Request"; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", request.PatientID); DBAgent.AddParameter("@ParamRefType", "PatientID"); DBAgent.AddParameter("@ParamAction", "IR"); DBAgent.AddParameter("@ParamComment", "Invalid Request from Mobile App - PatientQuestionnaire - " + request.UserToken); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } catch (Exception ex) { response.ErrorMessage = ex.StackTrace; CommonHelpers.writeLogToFile("API: PostPatientQuestionnaire - PatientQuestionnaireController.cs", ex.Message + Environment.NewLine + ex.StackTrace); } return(Ok(response)); }
public IHttpActionResult PostStaffLogin([FromBody] StaffAuthenticationRequest request) { StaffAuthenticationResponse response = new StaffAuthenticationResponse(); try { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.AddParameter("@ParamUserName", request.UserName); string data = DBAgent.ExecuteStoredProcedure("dbo.spGetUserDetails"); if (string.IsNullOrEmpty(data)) { response.ErrorMessage = "Invalid Username/Password conbination. Please try again"; response.IsAuthenticated = false; response.LoginID = -1; DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", 0); DBAgent.AddParameter("@ParamRefType", "Users"); DBAgent.AddParameter("@ParamAction", "FL"); DBAgent.AddParameter("@ParamComment", "Login Failed from Mobile App- " + request.UserName); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } else { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { securityAgent = new CryptoProvider(); DataRow dRow = ds.Tables[0].Rows[0]; string upassword = securityAgent.decryptText(dRow["Password"].ToString().Replace(" ", "+")); if (upassword.Equals(request.Password)) { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", dRow["LoginID"].ToString()); DBAgent.AddParameter("@ParamRefType", "Users"); DBAgent.AddParameter("@ParamAction", "LI"); DBAgent.AddParameter("@ParamComment", "Successful Login from Mobile App- " + request.UserName); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); response.IsAuthenticated = true; response.UserFirstName = dRow["FirstName"].ToString(); response.UserLastName = dRow["LastName"].ToString(); response.UserToken = ConfigurationManager.AppSettings["UserToken"]; } else { response.IsAuthenticated = false; response.ErrorMessage = "Invalid Username/Password conbination. Please try again"; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", 0); DBAgent.AddParameter("@ParamRefType", "Users"); DBAgent.AddParameter("@ParamAction", "FL"); DBAgent.AddParameter("@ParamComment", "Login Failed from Mobile App- " + request.UserName); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } } } catch (Exception ex) { response.ErrorMessage = ex.Message; response.IsAuthenticated = false; CommonHelpers.writeLogToFile("API: PostStaffLogin - StaffLoginController.cs", ex.Message + Environment.NewLine + ex.StackTrace); } return(Ok(response)); }