[1146] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Text;
|
---|
| 4 | using IndianHealthService.BMXNet.WinForm.Configuration;
|
---|
| 5 | using System.Windows.Forms;
|
---|
| 6 | using IndianHealthService.BMXNet.Services;
|
---|
| 7 |
|
---|
| 8 | namespace IndianHealthService.BMXNet.WinForm.Forms
|
---|
| 9 | {
|
---|
| 10 | internal class ConnectionTest
|
---|
| 11 | {
|
---|
| 12 |
|
---|
| 13 | private IWin32Window _uiOwner = null;
|
---|
| 14 |
|
---|
| 15 | public IWin32Window UiOwner
|
---|
| 16 | {
|
---|
| 17 | get { return _uiOwner; }
|
---|
| 18 | set { _uiOwner = value; }
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | public void Test(RpmsConnectionSpec aSpec)
|
---|
| 23 | {
|
---|
| 24 | WinFramework framework = WinFramework.CreateWithNetworkBroker(false,new NullLog());
|
---|
| 25 | RpmsConnectionSettings settings = new RpmsConnectionSettings();
|
---|
| 26 | settings.AddConnectionSpec(aSpec);
|
---|
| 27 | framework.ConnectionSettings = settings;
|
---|
| 28 |
|
---|
| 29 | LoginProcess login = framework.CreateLoginProcess();
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | if (login.HasDefaultConnectionWithUseWindowsAuth && login.AttemptWindowsAuthLogin())
|
---|
| 33 | {
|
---|
| 34 | if (login.AttemptWindowsAuthLogin())
|
---|
| 35 | {
|
---|
| 36 | MessageBox.Show("Windows Authication was succesful", "Connection Test");
|
---|
| 37 | framework.Close();
|
---|
| 38 | return;
|
---|
| 39 | }
|
---|
| 40 | else
|
---|
| 41 | {
|
---|
| 42 | MessageBox.Show("Windows Authication was failed", "Connection Test");
|
---|
| 43 | return;
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | if (!login.WasLoginAttempted || !login.WasSuccessful)
|
---|
| 48 | {
|
---|
| 49 | if (login.AttemptUserInputLogin("Test Login", 3, false,this.UiOwner))
|
---|
| 50 | {
|
---|
| 51 | MessageBox.Show("RPMS login was successful", "Connection Test");
|
---|
| 52 | framework.Close();
|
---|
| 53 | return;
|
---|
| 54 | }
|
---|
| 55 | else
|
---|
| 56 | {
|
---|
| 57 | MessageBox.Show("RPMS login faied", "Connection Test");
|
---|
| 58 | return;
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | }
|
---|