/// <summary> /// override /// US:878 /// saves the checklist /// </summary> /// <param name="lStatusCode"></param> /// <param name="strStatusComment"></param> /// <returns></returns> public override CStatus SaveControl() { CPatChecklistData pcld = new CPatChecklistData(BaseMstr.BaseData); CPatChecklistDataItem di = null; CStatus status = pcld.GetPatChecklistDI(Convert.ToInt64(ddlPatChecklist.SelectedValue), out di); if (!status.Status) { return(status); } di.ChecklistStateID = (k_CHECKLIST_STATE_ID)Convert.ToInt64(ddlChecklistState.SelectedValue); di.ProcedureDate = CDataUtils.GetDate( tbProcedureDate.Text, ucProcedureTime.HH, ucProcedureTime.MM, ucProcedureTime.SS); status = pcld.UpdatePatChecklist(di); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// override /// US:838 /// validates the user's search filters /// </summary> /// <param name="plistStatus"></param> /// <returns></returns> public override CStatus ValidateUserInput(out CParameterList plistStatus) { plistStatus = new CParameterList(); CStatus status = new CStatus(); //if date in either from or to make sure to is greater that from if (chkFilterByEvent.Checked) { if (txtFromDate.Text != String.Empty || txtToDate.Text != String.Empty) { if (txtFromDate.Text == String.Empty || txtToDate.Text == String.Empty) { plistStatus.AddInputParameter("ERROR_DATE_RANGE", Resources.ErrorMessages.ERROR_DATE_RANGE); status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; } else { DateTime dtFrom = CDataUtils.GetDate(txtFromDate.Text); DateTime dtTo = CDataUtils.GetDate(txtToDate.Text); k_COMPARE nCompare = CDataUtils.CompareDates(dtFrom, dtTo); if (!((nCompare == k_COMPARE.EQUALTO) || (nCompare == k_COMPARE.LESSTHAN))) { plistStatus.AddInputParameter("ERROR_DATE_RANGE", Resources.ErrorMessages.ERROR_DATE_RANGE); status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; } } } } //if lssn make sure 5 chars and last 4 are numbers if (chkLSSN.Checked) { if (txtLSSN.Text != String.Empty) { if (txtLSSN.Text.Length < 5) { plistStatus.AddInputParameter("ERROR_LSSN", Resources.ErrorMessages.ERROR_LSSN); status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; } } } if (!status.Status) { ShowStatusInfo(status.StatusCode, plistStatus); } return(status); }
/// <summary> /// US:891 /// US:894 /// event /// refreshes the page with vista data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnRefresh(object sender, EventArgs e) { //if MDWS is on, transfer data from mdws to the vappct db if (Master.MDWSTransfer) { //set the date from and date to DateTime dtFrom = CDataUtils.GetNullDate(); DateTime dtTo = CDataUtils.GetNullDate(); if (chkFilterByEvent.Checked) { dtFrom = CDataUtils.GetDate(txtFromDate.Text); dtTo = CDataUtils.GetDate(txtToDate.Text); } //checklist id long lChecklistID = -1; if (chkChecklist.Checked) { lChecklistID = ChecklistID; } //set the checklist Status long lChecklistStatus = -1; if (chkChecklistStatus.Checked && ddlChecklistStatus.SelectedItem != null && ddlChecklistStatus.SelectedValue != "-1") { lChecklistStatus = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue); } //set the checklist Status long lChecklistServiceID = -1; if (chkFilterByCLService.Checked && ddlFilterByService.SelectedItem != null && ddlFilterByService.SelectedValue != "-1") { lChecklistServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue); } ThreadType = k_MULTI_PAT_THREAD_TYPE.Refresh; GetPatCLIDs( dtFrom, dtTo, lChecklistID, lChecklistStatus, lChecklistServiceID); ProcessingCancelled = false; Master.ShowStatusInfo(ThreadMultiPatient()); } }
/// <summary> ///US:1883 Abstract save control method /// </summary> /// <returns></returns> public override CStatus SaveControl() { CPatientItemData itemData = new CPatientItemData(BaseMstr.BaseData); CStatus status = new CStatus(); long lPatItemID = -1; if (ddlItems.SelectedItem.Text == "[New Result]") { //load an item for insert CPatientItemDataItem di = new CPatientItemDataItem(); di.PatientID = PatientID; di.ItemID = ItemID; di.SourceTypeID = (long)k_SOURCE_TYPE_ID.VAPPCT; //get the date time, which is a combination of the 2 controls di.EntryDate = CDataUtils.GetDate(txtEntryDate.Text, ucTimePicker.HH, ucTimePicker.MM, ucTimePicker.SS); // build a list of all the item components in the grid view CPatientItemCompList PatItemCompList = null; status = BuildPatItemCompList(out PatItemCompList); if (!status.Status) { return(status); } // insert the patient item and all of its item components status = itemData.InsertPatientItem(di, PatItemCompList, out lPatItemID); if (!status.Status) { return(status); } } else { lPatItemID = CDropDownList.GetSelectedLongID(ddlItems); } // update the comments if there is a new one if (!string.IsNullOrEmpty(txtComment.Text)) { status = itemData.InsertPatientItemComment(lPatItemID, ItemID, txtComment.Text); if (!status.Status) { return(status); } } //show status return(new CStatus()); }
/// <summary> /// override /// validates the checklist's fields /// </summary> /// <param name="lStatusCode"></param> /// <param name="plistStatus"></param> /// <returns></returns> public override CStatus ValidateUserInput(out CParameterList plistStatus) { plistStatus = new CParameterList(); CPatChecklistData pcld = new CPatChecklistData(BaseMstr.BaseData); CPatChecklistDataItem di = null; CStatus status = pcld.GetPatChecklistDI(Convert.ToInt64(ddlPatChecklist.SelectedValue), out di); if (!status.Status) { plistStatus.AddInputParameter("ERROR_SP_CURCHECKLIST", Resources.ErrorMessages.ERROR_SP_CURCHECKLIST); return(status); } if (ChecklistStateID != di.ChecklistStateID && (di.ChecklistStateID == k_CHECKLIST_STATE_ID.Cancelled || di.ChecklistStateID == k_CHECKLIST_STATE_ID.Closed)) { plistStatus.AddInputParameter("ERROR_SP_CHECKLISTSTATE", Resources.ErrorMessages.ERROR_SP_CHECKLISTSTATE); status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; return(status); } DateTime dtProceduteDate = CDataUtils.GetDate( tbProcedureDate.Text, ucProcedureTime.HH, ucProcedureTime.MM, ucProcedureTime.SS); if (dtProceduteDate != CDataUtils.GetNullDate() && dtProceduteDate < DateTime.Now) { plistStatus.AddInputParameter("ERROR_PROCEDURE_DATE", Resources.ErrorMessages.ERROR_PROCEDURE_DATE); } if (plistStatus.Count > 0) { status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; } return(status); }
/// <summary> /// US:894 /// US:899 /// Abstract validate user input method /// </summary> /// <param name="plistStatus"></param> /// <returns></returns> public CStatus ValidateUserInput(out CParameterList plistStatus) { plistStatus = new CParameterList(); CStatus status = new CStatus(); //if date in either from or to make sure to is greater that from if (chkFilterByEvent.Checked) { if (txtFromDate.Text != String.Empty || txtToDate.Text != String.Empty) { if (txtFromDate.Text == String.Empty || txtToDate.Text == String.Empty) { plistStatus.AddInputParameter("ERROR_DATE_RANGE", Resources.ErrorMessages.ERROR_DATE_RANGE); status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; status.StatusComment = Resources.ErrorMessages.ERROR_DATE_RANGE; } else { DateTime dtFrom = CDataUtils.GetDate(txtFromDate.Text); DateTime dtTo = CDataUtils.GetDate(txtToDate.Text); k_COMPARE nCompare = CDataUtils.CompareDates(dtFrom, dtTo); if (!((nCompare == k_COMPARE.EQUALTO) || (nCompare == k_COMPARE.LESSTHAN))) { plistStatus.AddInputParameter("ERROR_DATE_RANGE", Resources.ErrorMessages.ERROR_DATE_RANGE); status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; status.StatusComment = Resources.ErrorMessages.ERROR_DATE_RANGE; } } } } return(status); }
/// <summary> /// US:1880 /// override /// Abstract validate user input method /// </summary> /// <param name="plistStatus"></param> /// <returns></returns> public override CStatus ValidateUserInput(out CParameterList plistStatus) { plistStatus = new CParameterList(); CStatus status = new CStatus(); if (ddlItems.SelectedItem.Text != "[New Result]") { return(status); } //make sure date range is valid DateTime dtEntryDate = CDataUtils.GetDate( txtEntryDate.Text, ucTimePicker.HH, ucTimePicker.MM, ucTimePicker.SS); if (dtEntryDate > DateTime.Now) { plistStatus.AddInputParameter("ERROR_FUTURE_DATE", Resources.ErrorMessages.ERROR_FUTURE_DATE); } //validate components bool bHasSelectedValue = false; foreach (GridViewRow gr in gvComponents.Rows) { TextBox txtValue = (TextBox)gr.FindControl("txtValue"); Label lblComponent = (Label)gr.FindControl("lblComponent"); RadioButton rbSelect = (RadioButton)gr.FindControl("rbSelComponent"); if (txtValue == null || lblComponent == null || rbSelect == null) { return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //switch on the type and get the value switch ((k_ITEM_TYPE_ID)ItemTypeID) { case k_ITEM_TYPE_ID.Laboratory: { bHasSelectedValue = true; //get the min and max from the keys double dblLegalMin = Convert.ToDouble(gvComponents.DataKeys[gr.DataItemIndex][nLegalMinIndex]); double dblLegalMax = Convert.ToDouble(gvComponents.DataKeys[gr.DataItemIndex][nLegalMaxIndex]); string strError = "Please enter a valid '" + lblComponent.Text + "' value, valid range is from" + dblLegalMin.ToString() + " to " + dblLegalMax.ToString() + "."; // if the value is not numeric // or if the value is outside the legal ranges double dblValue = 0; if (!double.TryParse(txtValue.Text, out dblValue) || dblValue < dblLegalMin || dblValue > dblLegalMax) { plistStatus.AddInputParameter("ERROR", strError); } break; } case k_ITEM_TYPE_ID.NoteTitle: bHasSelectedValue = true; break; case k_ITEM_TYPE_ID.QuestionFreeText: { bHasSelectedValue = true; if (txtValue.Text.Length < 1) { string strError = "Please enter a valid '" + lblComponent.Text + "' value!"; plistStatus.AddInputParameter("ERROR", strError); } break; } case k_ITEM_TYPE_ID.QuestionSelection: if (rbSelect.Checked) { bHasSelectedValue = true; } break; } } //make sure the user selected a radio button if (!bHasSelectedValue) { plistStatus.AddInputParameter("ERROR", "Please select a valid option!"); } if (plistStatus.Count > 0) { status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; } return(status); }
/// <summary> /// method /// US:838 /// do the actual search for patients /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <param name="strUserID"></param> /// <returns></returns> protected CStatus PatientLookup( Object sender, EventArgs e, string strUserID) { CParameterList pListStatus = null; //validate the user input CStatus status = ValidateUserInput(out pListStatus); if (!status.Status) { return(status); } //get values for the query //date from and date to DateTime dtFrom = CDataUtils.GetNullDate(); DateTime dtTo = CDataUtils.GetNullDate(); if (chkFilterByEvent.Checked) { dtFrom = CDataUtils.GetDate(txtFromDate.Text); dtTo = CDataUtils.GetDate(txtToDate.Text); } //last name string strLastName = String.Empty; if (chkLastName.Checked) { strLastName = txtLastName.Text; } //lssn string strLSSN = String.Empty; if (chkLSSN.Checked) { strLSSN = txtLSSN.Text; } //checklist id long lChecklistID = -1; if (chkChecklist.Checked) { lChecklistID = ChecklistID; } //checklist Status long lChecklistStatus = -1; if (chkChecklistStatus.Checked) { if (ddlChecklistStatus.SelectedItem != null) { if (ddlChecklistStatus.SelectedValue != "-1") { lChecklistStatus = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue); } } } //service long lServiceID = -1; if (chkFilterByCLService.Checked) { if (ddlFilterByService.SelectedItem != null) { if (ddlFilterByService.SelectedValue != "-1") { lServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue); } } } //do we have left side checklist criteria for the query bool bHasChecklistCriteria = HasChecklistCriteria(strUserID); //team string strTeamID = String.Empty; status = GetSelectedOptionID( OPTION_TEAMS, bHasChecklistCriteria, out strTeamID); if (!status.Status) { return(status); } //specialty string strSpecialtyID = String.Empty; status = GetSelectedOptionID( OPTION_SPECIALTIES, bHasChecklistCriteria, out strSpecialtyID); if (!status.Status) { return(status); } //ward string strWardID = String.Empty; status = GetSelectedOptionID( OPTION_WARDS, bHasChecklistCriteria, out strWardID); if (!status.Status) { return(status); } //clinic string strClinicID = String.Empty; status = GetSelectedOptionID( OPTION_CLINICS, bHasChecklistCriteria, out strClinicID); if (!status.Status) { return(status); } //if team, ward or specialty are loaded then we have criteria //beacause the user can search for patients without cl criteria //for team,ward,specialty searches if (!String.IsNullOrEmpty(strTeamID)) { bHasChecklistCriteria = true; } if (!String.IsNullOrEmpty(strWardID)) { bHasChecklistCriteria = true; } if (!String.IsNullOrEmpty(strSpecialtyID)) { bHasChecklistCriteria = true; } if (!String.IsNullOrEmpty(strClinicID)) { bHasChecklistCriteria = true; } //make sure some criteria is selected before searching if (!bHasChecklistCriteria) { status.Status = false; status.StatusCode = k_STATUS_CODE.Failed; status.StatusComment = "Please select at least one checklist search criteria before searching."; return(status); } //get a dataset matching criteria CPatientData pat = new CPatientData(BaseMstr.BaseData); DataSet ds = null; status = pat.GetPatientSearchDS(dtFrom, dtTo, strLastName, strLSSN, lChecklistID, lChecklistStatus, strUserID, strTeamID, strWardID, strSpecialtyID, strClinicID, lServiceID, out ds); if (status.Status) { //keep a copy of the full DS for paging if needed PatientDataTable = ds.Tables[0]; //raise the event if (_Search != null) { _Search(sender, e); } } return(status); }
/// <summary> /// method /// US:838 /// helper to determine if the user has selected criteria /// from the left side checklist options for the query /// </summary> /// <returns></returns> protected bool HasChecklistCriteria(string strUserID) { //has date range bool bHasDateRange = false; DateTime dtFrom = CDataUtils.GetNullDate(); DateTime dtTo = CDataUtils.GetNullDate(); if (chkFilterByEvent.Checked) { dtFrom = CDataUtils.GetDate(txtFromDate.Text); dtTo = CDataUtils.GetDate(txtToDate.Text); } if (!CDataUtils.IsDateNull(dtFrom)) { if (chkFilterByEvent.Checked) { bHasDateRange = true; } } //has last name bool bHasLastName = false; if (!String.IsNullOrEmpty(txtLastName.Text)) { bHasLastName = true; if (chkLastName.Checked) { bHasLastName = true; } } //has lssn bool bHasLSSN = false; if (!String.IsNullOrEmpty(txtLSSN.Text)) { if (chkLSSN.Checked) { bHasLSSN = true; } } //has checklist bool bHasChecklist = false; if (ChecklistID > 0) { if (chkChecklist.Checked) { bHasChecklist = true; } } //has checklist status bool bHasChecklistStatus = false; if (ddlChecklistStatus.SelectedIndex > 0) { if (chkChecklistStatus.Checked) { bHasChecklistStatus = true; } } //has checklist service bool bHasChecklistService = false; if (ddlFilterByService.SelectedIndex > 0) { if (chkFilterByCLService.Checked) { bHasChecklistService = true; } } bool bHasChecklistCriteria = false; if (bHasDateRange || bHasLastName || bHasLSSN || bHasChecklist || bHasChecklistStatus || bHasChecklistService) { bHasChecklistCriteria = true; } if (!String.IsNullOrEmpty(strUserID)) { bHasChecklistCriteria = true; } return(bHasChecklistCriteria); }
/// <summary> /// US:894 /// US:899 /// user clicked the search button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnClickSearch(object sender, EventArgs e) { Master.ClearStatusInfo(); CParameterList pListStatus = null; CStatus status = ValidateUserInput(out pListStatus); if (!status.Status) { Master.ShowStatusInfo(status.StatusCode, pListStatus); return; } //set the date from and date to DateTime dtFrom = CDataUtils.GetNullDate(); DateTime dtTo = CDataUtils.GetNullDate(); if (chkFilterByEvent.Checked) { dtFrom = CDataUtils.GetDate(txtFromDate.Text); dtTo = CDataUtils.GetDate(txtToDate.Text); } //checklist id long lChecklistID = -1; if (chkChecklist.Checked) { lChecklistID = ChecklistID; } //set the checklist Status long lChecklistStatusID = -1; if (chkChecklistStatus.Checked && ddlChecklistStatus.SelectedItem != null && ddlChecklistStatus.SelectedValue != "-1") { lChecklistStatusID = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue); } ThreadType = k_MULTI_PAT_THREAD_TYPE.Logic; //service long lServiceID = -1; if (chkFilterByCLService.Checked) { if (ddlFilterByService.SelectedItem != null) { if (ddlFilterByService.SelectedValue != "-1") { lServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue); } } } //has checklist service bool bHasChecklistService = false; if (ddlFilterByService.SelectedIndex > 0) { if (chkFilterByCLService.Checked) { bHasChecklistService = true; } } //get patient checklist ids GetPatCLIDs( dtFrom, dtTo, lChecklistID, lChecklistStatusID, lServiceID); ProcessingCancelled = false; //thread off the multi patient search status = ThreadMultiPatient(); //handle a bad status that comes back with no message if (!status.Status) { if (String.IsNullOrEmpty(status.StatusComment)) { status.StatusComment = "An error occured while processing records!"; } } //show the status Master.ShowStatusInfo(status); }
/// <summary> /// loads the gridview after we are done updating the checklists /// </summary> protected CStatus LoadGridView() { //done processing the logic so now load the gridview //set the date from and date to DateTime dtFrom = CDataUtils.GetNullDate(); DateTime dtTo = CDataUtils.GetNullDate(); if (chkFilterByEvent.Checked) { dtFrom = CDataUtils.GetDate(txtFromDate.Text); dtTo = CDataUtils.GetDate(txtToDate.Text); } MPEventStartDate = dtFrom; MPEventEndDate = dtTo; //checklist id long lChecklistID = -1; if (chkChecklist.Checked) { lChecklistID = ChecklistID; } MPChecklistID = lChecklistID; //set the checklist Status long lChecklistStatusID = -1; if (chkChecklistStatus.Checked && ddlChecklistStatus.SelectedItem != null && ddlChecklistStatus.SelectedValue != "-1") { lChecklistStatusID = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue); } MPChecklistStatusID = lChecklistStatusID; long lChecklistServiceID = -1; if (chkFilterByCLService.Checked && ddlFilterByService.SelectedItem != null && ddlFilterByService.SelectedValue != "-1") { lChecklistServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue); } MPChecklistServiceID = lChecklistServiceID; CStatus status = GetPatients(dtFrom, dtTo, lChecklistID, lChecklistStatusID, lChecklistServiceID); if (!status.Status) { return(status); } AddColumns(); gvMultiPatientView.EmptyDataText = "No result(s) found."; gvMultiPatientView.DataSource = MultiPatients; gvMultiPatientView.DataBind(); //now that the grid is loaded check for new versions... //get all the patients for the mulitpatient string strCLIDs = string.Empty; string strPatIDs = string.Empty; CPatientData pat = new CPatientData(Master.BaseData); DataSet dsMultiPatientSearch = null; status = pat.GetMultiPatientSearchDS( MPEventStartDate, MPEventEndDate, MPChecklistID, MPChecklistStatusID, MPChecklistServiceID, out dsMultiPatientSearch); if (!status.Status) { return(status); } //patient ids CDataUtils.GetDSDelimitedData( dsMultiPatientSearch, "PATIENT_ID", ",", out strPatIDs); strPatIDs = "," + strPatIDs; //pat cl ids CDataUtils.GetDSDelimitedData( dsMultiPatientSearch, "CHECKLIST_ID", ",", out strCLIDs); strCLIDs = "," + strCLIDs; CPatChecklistData dta = new CPatChecklistData(Master.BaseData); DataSet dsCL = null; status = dta.GetOutOfDatePatCLDS( MPEventStartDate, MPEventEndDate, MPChecklistID, MPChecklistStatusID, strPatIDs, strCLIDs, out dsCL); if (!status.Status) { return(status); } btnUpdateCLVersion.Enabled = (!CDataUtils.IsEmpty(dsCL)) ? true : false; //EnableVersionUpdate = (!CDataUtils.IsEmpty(dsCL)) ? true : false; upLookup.Update(); return(new CStatus()); }