public static MethodResult GetByPatientName(PatientName patientName) { string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList(); ClientOrderCollection clientOrderCollection = new ClientOrderCollection(); string commandText = $"Select * from tblClientOrder where ClientId in ({clientIdList}) and PanelSetId = 400 "; if (patientName.LastName != null && patientName.FirstName != null) { commandText = commandText + "and PLastName like '" + patientName.LastName + "%' and pFirstName like '" + patientName.FirstName + "%' order by OrderDate desc"; } if (patientName.LastName != null && patientName.FirstName == null) { commandText = commandText + "and PLastName like '" + patientName.LastName + "%' order by OrderDate desc;"; } if (patientName.LastName != null) { JObject jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText); APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest); ClientOrderCollection.Build(apiResult, clientOrderCollection); MethodResult methodResult = new MethodResult(); methodResult.AddResult(apiResult.JSONResult, clientOrderCollection); return(methodResult); } else { MethodResult methodResult = new MethodResult(); methodResult.Success = false; methodResult.Messages.Add("Invalid patient name."); return(methodResult); } }
public static void Build(APIResult apiResult, ClientOrderCollection clientOrderCollection) { for (int i = 0; i < apiResult.JSONResult["result"]["results"].Count(); i++) { ClientOrder clientOrder = new ClientOrder(); clientOrder.FromSql((JObject)apiResult.JSONResult["result"]["results"][i]); clientOrderCollection.Add(clientOrder); } }
public static ClientOrderCollection GetNotAccessionedOrders(string clientIdList) { string commandText = $"Select * from tblClientOrder where ClientId in ({clientIdList}) and PanelSetId = 400 and IsMasterOrder = 0 and Accessioned = 0 order by OrderTime desc limit 1000;"; JObject request = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText); APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(request); ClientOrderCollection clientOrderCollection = new ClientOrderCollection(); Build(apiResult, clientOrderCollection); return(clientOrderCollection); }
private void ToolBarButtonEdit_Click(object sender, RoutedEventArgs e) { if (this.ListViewOrderLog.SelectedItem != null) { ClientOrder stagnantClientOrder = (ClientOrder)this.ListViewOrderLog.SelectedItem; ClientOrder freshClientOrder = ClientOrderCollection.GetByClientOrderId(stagnantClientOrder.ClientOrderId); freshClientOrder.RowOperationType = RowOperationTypeEnum.Update; ClientOrderEditDialog clientOrderEditDialog = new ClientOrderEditDialog(freshClientOrder); clientOrderEditDialog.Closed += ClientOrderEditDialog_Closed; clientOrderEditDialog.ShowDialog(); } }
private void DoCategorySearchType() { if (this.m_CategorySearchType == "Recent Orders") { this.m_ClientOrderCollection = ClientOrderCollection.GetRecentOrdersByClientId(AuthenticatedUser.Instance.GetSQLClientIdInList()); this.NotifyPropertyChanged("ClientOrderCollection"); } else if (this.m_CategorySearchType == "Master Orders") { this.m_ClientOrderCollection = ClientOrderCollection.GetMasterOrders(AuthenticatedUser.Instance.GetSQLClientIdInList()); this.NotifyPropertyChanged("ClientOrderCollection"); } else if (this.m_CategorySearchType == "Not received at YPI") { this.m_ClientOrderCollection = ClientOrderCollection.GetNotAccessionedOrders(AuthenticatedUser.Instance.GetSQLClientIdInList()); this.NotifyPropertyChanged("ClientOrderCollection"); } }
private void MenuItemCreateOrderFromMaster_Click(object sender, RoutedEventArgs e) { if (this.ListViewOrderLog.SelectedItems.Count > 0) { foreach (ClientOrder clientOrder in this.ListViewOrderLog.SelectedItems) { if (clientOrder.IsMasterOrder == true) { ClientOrder stagnantClientOrder = clientOrder; ClientOrder freshClientOrder = ClientOrderCollection.GetByClientOrderId(stagnantClientOrder.ClientOrderId); ClientOrder cloned = freshClientOrder.CreateNewFromMaster(); cloned.Save(); } } MessageBox.Show("Orders have been created."); } else { MessageBox.Show("Please select one or more orders to copy."); } }
private void DoPatientNameSearch() { PatientName patientName = null; bool result = PatientName.TryParse(this.m_PatientNameSearch, out patientName); if (result) { MethodResult methodResult = ClientOrderCollection.GetByPatientName(patientName); if (methodResult.Success == true) { this.m_ClientOrderCollection = (ClientOrderCollection)methodResult.Result; this.NotifyPropertyChanged(string.Empty); } else { methodResult.ShowMethodResult(); } } else { MessageBox.Show("Must have at least 2 characters for a patient name search."); } }