Files
MyMcKesson/TomcatServer/PlutoServer.PracticeChoice/Practice_Impl.cs
2016-07-27 00:32:34 -04:00

88 lines
3.4 KiB
C#

namespace Pluto.Api {
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PlutoServer.PracticeChoice;
[RemObjects.SDK.Server.ClassFactories.StandardClassFactory()]
[RemObjects.SDK.Server.Service(Name = "Practice", InvokerClass = typeof(Practice_Invoker), ActivatorClass = typeof(Practice_Activator))]
public class Practice : RemObjects.SDK.Server.Service, IPractice {
private System.ComponentModel.Container components = null;
public Practice() :
base() {
this.InitializeComponent();
}
private void InitializeComponent() {
this.RequireSession = true;
//this.
}
protected override void Dispose(bool aDisposing) {
if(aDisposing) {
if((this.components != null)) {
this.components.Dispose();
}
}
base.Dispose(aDisposing);
}
public virtual PracticeInfo1[] GetPracticeList1(string apiKey) {
// Validate the apiKey
//System.Threading.Thread.Sleep(1000 * 10);
if(Utility.IsAPIKeyValid(apiKey)) {
var practiceInfos = new List<PracticeInfo1>();
practiceInfos.Add(new PracticeInfo1() { Id = 1, Name = "North Side" });
practiceInfos.Add(new PracticeInfo1() { Id = 2, Name = "East Side" });
practiceInfos.Add(new PracticeInfo1() { Id = 3, Name = "West Side" });
practiceInfos.Add(new PracticeInfo1() { Id = 4, Name = "South Side" });
return practiceInfos.ToArray();
} else {
return null;
}
}
public virtual ProviderInfo1[] GetProviderList1(string apiKey, PracticeInfo1 practiceInfo) {
if(Utility.IsAPIKeyValid(apiKey)) {
System.Diagnostics.Debug.WriteLine(this.SessionID.ToString());
var authToken = (string)this.Session[SessionKeys.AuthToken];
var practice = new PlutoServer.PracticeChoice.Core.Practice();
var providerList = practice.GetProviderList(authToken);
return providerList.ToArray();
} else {
return null;
}
}
#region IPractice Members
public virtual PatientInfo1[] GetPatientList1(string apiKey, string lastName, string firstName, string dateOfBirth) {
if(Utility.IsAPIKeyValid(apiKey)){
var authToken = (string)this.Session[SessionKeys.AuthToken];
var practice = new PlutoServer.PracticeChoice.Core.Practice();
var patientList = practice.GetPatientList(authToken, lastName, firstName, dateOfBirth);
return patientList.ToArray();
}else{
return null;
}
}
public MessageRecipientInfo1[] GetMessageRecipientList(string apiKey) {
if(Utility.IsAPIKeyValid(apiKey)) {
var authToken = (string)this.Session[SessionKeys.AuthToken];
var practice = new PlutoServer.PracticeChoice.Core.Practice();
var recipientList = practice.GetMessageRecipients(authToken);
return recipientList.ToArray();
} else {
return null;
}
}
#endregion
}
}