Exemplo n.º 1
0
        public static void GeneratePdfAndUploadToSharePointSite(ConsentFormSvcClient formHandlerServiceClient, ConsentType consentType, string patientId, HttpRequest request, string location)
        {
            if (!IsDevelopmentMode)

                //formHandlerServiceClient.GenerateAndUploadPdFtoSharePoint("http://" + request.Url.Host + ":" + request.Url.Port + "/" + consentType + @"/ConsentPrint.aspx?PatientId=" + patientId + "&Location=" + location, patientId, consentType, location);
                formHandlerServiceClient.GenerateAndUploadPdFtoSharePoint("http://localhost" + request.Url.Port + @"/" + consentType + @"/ConsentPrint.aspx?PatientId=" + patientId + "&Location=" + location, patientId, consentType, location);
        }
 public ActionResult PatientConsent(PatientConsentMain patientConsentMain)
 {
     LoadPatients(Request.Form["RdoLocation"]);
     if (!string.IsNullOrEmpty(patientConsentMain.EmployeeId))
     {
         var consentFormSvcClient = new ConsentFormSvcClient();
         if (consentFormSvcClient.IsValidEmployee(patientConsentMain.EmployeeId))
         {
             ViewBag.Loggedin = true;
             var patientDetails = consentFormSvcClient.GetPatientfromLocation(patientConsentMain.BHELocation ? "BHE" : "BHW");
             foreach (DataRow patientDetail in patientDetails.Rows)
             {
             }
             if (string.IsNullOrEmpty(patientConsentMain.SelectedPatientID))
             {
             }
         }
         else
         {
             patientConsentMain.ErrorInfo = "Invalid employee id entered!";
             ResetIndexView(patientConsentMain);
         }
     }
     patientConsentMain.PatientsList = new SelectList(new string[0]);
     patientConsentMain.ConsentFormList = new SelectList(new string[0]);
     return View("Index", patientConsentMain);
 }
 private void LoadPatients(string patientLocation)
 {
     if (!string.IsNullOrEmpty(patientLocation))
     {
         var consentFormSvcClient = new ConsentFormSvcClient();
         ViewBag.Patients = consentFormSvcClient.GetPatientfromLocation(patientLocation).Rows;
     }
 }
Exemplo n.º 4
0
 public static void GeneratePdfAndUploadToSharePointSite(ConsentFormSvcClient formHandlerServiceClient, ConsentType consentType, string patientId, HttpRequest request, string location)
 {
     if (!IsDevelopmentMode)
     {
         //formHandlerServiceClient.GenerateAndUploadPdFtoSharePoint("http://" + request.Url.Host + ":" + request.Url.Port + "/" + consentType + @"/ConsentPrint.aspx?PatientId=" + patientId + "&Location=" + location, patientId, consentType, location);
         formHandlerServiceClient.GenerateAndUploadPdFtoSharePoint("http://localhost" + request.Url.Port + @"/" + consentType + @"/ConsentPrint.aspx?PatientId=" + patientId + "&Location=" + location, patientId, consentType, location);
     }
 }
        private void Reset()
        {
            try
            {
                TxtBloodConsentOrRefusalExportPath.Text = string.Empty;
                TxtCardiovascularExportPath.Text        = string.Empty;
                TxtEndoscopyExportPath.Text             = string.Empty;
                TxtOutsideORExportPath.Text             = string.Empty;
                TxtPICCExportPath.Text             = string.Empty;
                TxtPlasmanApheresisExportPath.Text = string.Empty;
                TxtSurgicalExportPath.Text         = string.Empty;

                // loading WCF Service URL from web.config
                Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);

                // Getting export paths and display in boxes
                var endpoint            = new EndpointAddress(new Uri(config.AppSettings.Settings["ServiceURL"].Value));
                var formHandlerServices = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                try // initially it might throw error
                {
                    TxtBloodConsentOrRefusalExportPath.Text =
                        formHandlerServices.GetPdFFolderPath(ConsentType.BloodConsentOrRefusal);
                    TxtCardiovascularExportPath.Text   = formHandlerServices.GetPdFFolderPath(ConsentType.Cardiovascular);
                    TxtEndoscopyExportPath.Text        = formHandlerServices.GetPdFFolderPath(ConsentType.Endoscopy);
                    TxtOutsideORExportPath.Text        = formHandlerServices.GetPdFFolderPath(ConsentType.OutsideOR);
                    TxtPICCExportPath.Text             = formHandlerServices.GetPdFFolderPath(ConsentType.PICC);
                    TxtPlasmanApheresisExportPath.Text = formHandlerServices.GetPdFFolderPath(ConsentType.PlasmanApheresis);
                    TxtSurgicalExportPath.Text         = formHandlerServices.GetPdFFolderPath(ConsentType.Surgical);
                }
                catch (Exception)
                {
                }

                // try to loading credentials for export path
                try
                {
                    var credentials = formHandlerServices.GetPdFPathCredentials();
                    TxtDomain.Text          = credentials.Domain;
                    TxtUsernameExports.Text = credentials.Username;
                    TxtPasswordExports.Text = credentials.Password;
                }
                catch (Exception)
                {
                }
            }
            catch (Exception ex)
            {
                var client = Utilities.GetConsentFormSvcClient();
                client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                 ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
        private void Reset()
        {
            try
            {
                TxtDatabasename.Text = string.Empty;
                TxtServerName.Text   = string.Empty;
                TxtUsername.Text     = string.Empty;
                TxtPassword.Text     = string.Empty;

                TxtDatabasenameExternal.Text = string.Empty;
                TxtServerNameExternal.Text   = string.Empty;
                TxtUsernameExternal.Text     = string.Empty;
                TxtPasswordExternal.Text     = string.Empty;

                TxtServerName.Focus();

                // loading WCF Service URL from web.config
                Configuration config =
                    WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
                TxtServiceURL.Text = config.AppSettings.Settings["ServiceURL"].Value;

                // Getting export paths and display in boxes
                var endpoint            = new EndpointAddress(new Uri(TxtServiceURL.Text.Trim()));
                var formHandlerServices = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                // setting Database fields value from connection string
                try
                {
                    var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["ConnectionString"]);
                    TxtServerName.Text   = sqlConnectionStringBuilder.DataSource;
                    TxtDatabasename.Text = sqlConnectionStringBuilder.InitialCatalog;
                    if (!string.IsNullOrEmpty(sqlConnectionStringBuilder.UserID))
                    {
                        RdoSqlServerAuthentication.Checked = true;
                        TxtUsername.Text = sqlConnectionStringBuilder.UserID;
                        TxtPassword.Text = sqlConnectionStringBuilder.Password;
                    }
                    else
                    {
                        RdoWindowsAuthentication.Checked = true;
                    }
                }
                catch (Exception)
                {
                }

                // setting Database fields value from connection string
                try
                {
                    var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["BethesdaConnectionString"]);
                    TxtServerNameExternal.Text   = sqlConnectionStringBuilder.DataSource;
                    TxtDatabasenameExternal.Text = sqlConnectionStringBuilder.InitialCatalog;
                    if (!string.IsNullOrEmpty(sqlConnectionStringBuilder.UserID))
                    {
                        RdoSqlServerAuthenticationExternal.Checked = true;
                        TxtUsernameExternal.Text = sqlConnectionStringBuilder.UserID;
                        TxtPasswordExternal.Text = sqlConnectionStringBuilder.Password;
                    }
                    else
                    {
                        RdoWindowsAuthentication.Checked = true;
                    }
                }
                catch (Exception)
                {
                }

                SetCredentialPanel();
            }
            catch (Exception ex)
            {
                var client = Utilities.GetConsentFormSvcClient();
                client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                 ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
        protected void BtnCompleted_Click(object sender, EventArgs e)
        {
            try
            {
                LblError.Text = string.Empty;
                Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);

                if (PnlDBConfiguration.Visible) // right now it is always true
                {
                    if (!string.IsNullOrEmpty(TxtServiceURL.Text))
                    {
                        // testing the given WCF url with a sample method
                        var endpoint             = new EndpointAddress(new Uri(TxtServiceURL.Text.Trim()));
                        var consentFormSvcClient = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                        // it may throw error if configuration is wrong
                        config.AppSettings.Settings.Remove("ServiceURL");
                        config.AppSettings.Settings.Add("ServiceURL", TxtServiceURL.Text.Trim());
                        config.Save(ConfigurationSaveMode.Modified);
                        ConfigurationManager.RefreshSection("appSettings");

                        LblError.Text += "<br /> WCF Service URL configured successfully";

                        try
                        {
                            // calling an sample method to validate WCF service and database
                            //consentFormSvcClient.IsValidEmployee("test");
                        }
                        catch (Exception ex)
                        {
                            LblError.Text += "Please input valid wcf service URL and then try.";
                            return; // return the function if the wcf is not able to connect
                        }

                        try
                        {
                            if (!string.IsNullOrEmpty(TxtServerName.Text.Trim()) &&
                                !string.IsNullOrEmpty(TxtDatabasename.Text.Trim()) ||
                                (RdoSqlServerAuthentication.Checked && !string.IsNullOrEmpty(TxtUsername.Text.Trim()) &&
                                 !string.IsNullOrEmpty(TxtPassword.Text.Trim())))
                            {
                                //string checkIfExist = ConfigurationManager.AppSettings["DBSetupStatus"];
                                //if (checkIfExist == "0")
                                //{
                                string connectionString;
                                if (RdoSqlServerAuthentication.Checked)
                                {
                                    connectionString = @"server=" + TxtServerName.Text.Trim() + ";database=" + TxtDatabasename.Text + ";uid=" + TxtUsername.Text.Trim() + ";pwd=" + TxtPassword.Text.Trim();
                                }
                                else
                                {
                                    connectionString = "Server=" + TxtServerName.Text.Trim() + ";Database=" + TxtDatabasename.Text.Trim() + ";Trusted_Connection=True;";
                                }

                                config.AppSettings.Settings.Remove("ConnectionString");
                                config.AppSettings.Settings.Add("ConnectionString", connectionString);
                                config.Save(ConfigurationSaveMode.Modified);
                                ConfigurationManager.RefreshSection("appSettings");

                                LblError.Text += "<br /> Database Connection string saved successfully";

                                config.AppSettings.Settings.Remove("DBSetupStatus");
                                config.AppSettings.Settings.Add("DBSetupStatus", "1");

                                string masterConnectionString = connectionString.Replace(connectionString.Split('=')[2], "master;uid");

                                // Setting connection in WCF application for configured DB connection
                                consentFormSvcClient.SetDbConnection(connectionString);
                                LblError.Text += "<br /> Database connection string configured in WCF successfully";

                                // start configuring WCF Service URL
                                try
                                {
                                    // create database if not exists
                                    if (CreateDatabase(TxtDatabasename.Text.Trim(), masterConnectionString))
                                    {
                                        LblError.Text += "<br /> Database Created succefully";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LblError.Text += "<br /> Unable to create database due to [" + ex.Message + "]";
                                }
                            }
                            else
                            {
                                LblError.Text += "<br /> Please input required fields and submit.";
                            }
                        }
                        catch (Exception ex)
                        {
                            LblError.Text += "<br /> Unable to save settings due to [" + ex.Message + "]";
                        }

                        try
                        {
                            if (!string.IsNullOrEmpty(TxtServerNameExternal.Text.Trim()) &&
                                !string.IsNullOrEmpty(TxtDatabasenameExternal.Text.Trim()) ||

                                (RdoSqlServerAuthenticationExternal.Checked &&
                                 !string.IsNullOrEmpty(TxtUsernameExternal.Text.Trim()) &&
                                 !string.IsNullOrEmpty(TxtPasswordExternal.Text.Trim())))
                            {
                                string connectionString;
                                if (RdoSqlServerAuthenticationExternal.Checked)
                                {
                                    connectionString = @"server=" + TxtServerNameExternal.Text.Trim() +
                                                       ";database=" + TxtDatabasename.Text.Trim() + ";uid=" +
                                                       TxtUsernameExternal.Text.Trim() + ";pwd=" +
                                                       TxtPasswordExternal.Text.Trim();
                                }
                                else
                                {
                                    connectionString = "Server=" + TxtServerNameExternal.Text.Trim() + ";Database=" +
                                                       TxtDatabasenameExternal.Text.Trim() + ";Trusted_Connection=True;";
                                }
                                config.AppSettings.Settings.Remove("BethesdaConnectionString");
                                config.AppSettings.Settings.Add("BethesdaConnectionString", connectionString);
                                config.Save(ConfigurationSaveMode.Modified);
                                ConfigurationManager.RefreshSection("appSettings");

                                consentFormSvcClient.SetBethesdaDbConnection(connectionString);
                            }
                            else
                            {
                                LblError.Text += "Please input required fields and submit.";
                            }
                        }
                        catch (Exception ex)
                        {
                            LblError.Text += "Unable to save external database settings due to [" + ex.Message + "]";
                        }
                    }
                    else
                    {
                        LblError.Text += "<br /> Please input wcf service URL and try again.";
                    }

                    try
                    {
                        // Get the service on the local machine
                        using (var ts = new TaskService())
                        {
                            if (ts.RootFolder.GetTasks().Any(task => task.Name == "BethedaContentSync"))
                            {
                                ts.RootFolder.DeleteTask("BethedaContentSync");
                            }

                            // Create a new task definition and assign properties
                            TaskDefinition td = ts.NewTask();
                            td.RegistrationInfo.Description = "Bethesda Employee, Patient and Physician import task.";

                            // Create a trigger that will fire the task at this time every day
                            td.Triggers.Add(new DailyTrigger {
                                StartBoundary = DateTime.Now.AddHours(-DateTime.Now.Hour), DaysInterval = 1, Enabled = true
                            });

                            string path = @"C:\Program Files\Internet Explorer\iexplore.exe";

                            // Create an action that will launch Notepad whenever the trigger fires
                            td.Actions.Add(new ExecAction(Request.Url.OriginalString.Replace(Request.Url.Query, string.Empty) + "/Administration/", "", null));

                            // Register the task in the root folder
                            ts.RootFolder.RegisterTaskDefinition(@"BethedaContentSync", td);
                        }
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            var client = Utilities.GetConsentFormSvcClient();
                            client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                             ex.Message + Environment.NewLine + ex.StackTrace);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                try
                {
                    // Get the service on the local machine
                    using (var ts = new TaskService())
                    {
                        if (ts.RootFolder.GetTasks().Any(task => task.Name == "BethedaContentSync"))
                        {
                            ts.RootFolder.DeleteTask("BethedaContentSync");
                        }

                        // Create a new task definition and assign properties
                        TaskDefinition td = ts.NewTask();
                        td.RegistrationInfo.Description = "Bethesda Employee, Patient and Physician import task.";

                        // Create a trigger that will fire the task at this time every day
                        td.Triggers.Add(new DailyTrigger {
                            StartBoundary = DateTime.Now.AddHours(-DateTime.Now.Hour), DaysInterval = 1, Enabled = true
                        });

                        // Create an action that will launch Notepad whenever the trigger fires
                        td.Actions.Add(new ExecAction(Request.Url.Host, "", null));

                        // Register the task in the root folder
                        ts.RootFolder.RegisterTaskDefinition(@"BethedaContentSync", td);
                    }
                }
                catch (Exception ex)
                {
                    try
                    {
                        var client = Utilities.GetConsentFormSvcClient();
                        client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                         ex.Message + Environment.NewLine + ex.StackTrace);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                try
                {
                    var client = Utilities.GetConsentFormSvcClient();
                    client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                     ex.Message + Environment.NewLine + ex.StackTrace);
                }
                catch (Exception)
                {
                }
            }
        }
Exemplo n.º 8
0
        private void Reset()
        {
            try
            {
                TxtDatabasename.Text = string.Empty;
                TxtServerName.Text = string.Empty;
                TxtUsername.Text = string.Empty;
                TxtPassword.Text = string.Empty;

                TxtDatabasenameExternal.Text = string.Empty;
                TxtServerNameExternal.Text = string.Empty;
                TxtUsernameExternal.Text = string.Empty;
                TxtPasswordExternal.Text = string.Empty;

                TxtServerName.Focus();

                // loading WCF Service URL from web.config
                Configuration config =
                    WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
                TxtServiceURL.Text = config.AppSettings.Settings["ServiceURL"].Value;

                // Getting export paths and display in boxes
                var endpoint = new EndpointAddress(new Uri(TxtServiceURL.Text.Trim()));
                var formHandlerServices = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                // setting Database fields value from connection string
                try
                {
                    var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["ConnectionString"]);
                    TxtServerName.Text = sqlConnectionStringBuilder.DataSource;
                    TxtDatabasename.Text = sqlConnectionStringBuilder.InitialCatalog;
                    if (!string.IsNullOrEmpty(sqlConnectionStringBuilder.UserID))
                    {
                        RdoSqlServerAuthentication.Checked = true;
                        TxtUsername.Text = sqlConnectionStringBuilder.UserID;
                        TxtPassword.Text = sqlConnectionStringBuilder.Password;
                    }
                    else
                    {
                        RdoWindowsAuthentication.Checked = true;
                    }
                }
                catch (Exception)
                {
                }

                // setting Database fields value from connection string
                try
                {
                    var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["BethesdaConnectionString"]);
                    TxtServerNameExternal.Text = sqlConnectionStringBuilder.DataSource;
                    TxtDatabasenameExternal.Text = sqlConnectionStringBuilder.InitialCatalog;
                    if (!string.IsNullOrEmpty(sqlConnectionStringBuilder.UserID))
                    {
                        RdoSqlServerAuthenticationExternal.Checked = true;
                        TxtUsernameExternal.Text = sqlConnectionStringBuilder.UserID;
                        TxtPasswordExternal.Text = sqlConnectionStringBuilder.Password;
                    }
                    else
                    {
                        RdoWindowsAuthentication.Checked = true;
                    }
                }
                catch (Exception)
                {
                }

                SetCredentialPanel();
            }
            catch (Exception ex)
            {
                var client = Utilities.GetConsentFormSvcClient();
                client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                 ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Exemplo n.º 9
0
        protected void BtnCompleted_Click(object sender, EventArgs e)
        {
            try
            {
                LblError.Text = string.Empty;
                Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);

                if (PnlDBConfiguration.Visible) // right now it is always true
                {
                    if (!string.IsNullOrEmpty(TxtServiceURL.Text))
                    {
                        // testing the given WCF url with a sample method
                        var endpoint = new EndpointAddress(new Uri(TxtServiceURL.Text.Trim()));
                        var consentFormSvcClient = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                        // it may throw error if configuration is wrong
                        config.AppSettings.Settings.Remove("ServiceURL");
                        config.AppSettings.Settings.Add("ServiceURL", TxtServiceURL.Text.Trim());
                        config.Save(ConfigurationSaveMode.Modified);
                        ConfigurationManager.RefreshSection("appSettings");

                        LblError.Text += "<br /> WCF Service URL configured successfully";

                        try
                        {
                            // calling an sample method to validate WCF service and database
                            //consentFormSvcClient.IsValidEmployee("test");
                        }
                        catch (Exception ex)
                        {
                            LblError.Text += "Please input valid wcf service URL and then try.";
                            return; // return the function if the wcf is not able to connect
                        }

                        try
                        {
                            if (!string.IsNullOrEmpty(TxtServerName.Text.Trim()) &&
                                !string.IsNullOrEmpty(TxtDatabasename.Text.Trim()) ||
                                (RdoSqlServerAuthentication.Checked && !string.IsNullOrEmpty(TxtUsername.Text.Trim()) &&
                                 !string.IsNullOrEmpty(TxtPassword.Text.Trim())))
                            {
                                //string checkIfExist = ConfigurationManager.AppSettings["DBSetupStatus"];
                                //if (checkIfExist == "0")
                                //{
                                string connectionString;
                                if (RdoSqlServerAuthentication.Checked)
                                    connectionString = @"server=" + TxtServerName.Text.Trim() + ";database=" + TxtDatabasename.Text + ";uid=" + TxtUsername.Text.Trim() + ";pwd=" + TxtPassword.Text.Trim();
                                else
                                    connectionString = "Server=" + TxtServerName.Text.Trim() + ";Database=" + TxtDatabasename.Text.Trim() + ";Trusted_Connection=True;";

                                config.AppSettings.Settings.Remove("ConnectionString");
                                config.AppSettings.Settings.Add("ConnectionString", connectionString);
                                config.Save(ConfigurationSaveMode.Modified);
                                ConfigurationManager.RefreshSection("appSettings");

                                LblError.Text += "<br /> Database Connection string saved successfully";

                                config.AppSettings.Settings.Remove("DBSetupStatus");
                                config.AppSettings.Settings.Add("DBSetupStatus", "1");

                                string masterConnectionString = connectionString.Replace(connectionString.Split('=')[2], "master;uid");

                                // Setting connection in WCF application for configured DB connection
                                consentFormSvcClient.SetDbConnection(connectionString);
                                LblError.Text += "<br /> Database connection string configured in WCF successfully";

                                // start configuring WCF Service URL
                                try
                                {
                                    // create database if not exists
                                    if (CreateDatabase(TxtDatabasename.Text.Trim(), masterConnectionString))
                                    {
                                        LblError.Text += "<br /> Database Created succefully";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LblError.Text += "<br /> Unable to create database due to [" + ex.Message + "]";
                                }
                            }
                            else
                                LblError.Text += "<br /> Please input required fields and submit.";
                        }
                        catch (Exception ex)
                        {
                            LblError.Text += "<br /> Unable to save settings due to [" + ex.Message + "]";
                        }

                        try
                        {
                            if (!string.IsNullOrEmpty(TxtServerNameExternal.Text.Trim()) &&
                                !string.IsNullOrEmpty(TxtDatabasenameExternal.Text.Trim()) ||

                                (RdoSqlServerAuthenticationExternal.Checked &&
                                 !string.IsNullOrEmpty(TxtUsernameExternal.Text.Trim()) &&
                                 !string.IsNullOrEmpty(TxtPasswordExternal.Text.Trim())))
                            {
                                string connectionString;
                                if (RdoSqlServerAuthenticationExternal.Checked)
                                    connectionString = @"server=" + TxtServerNameExternal.Text.Trim() +
                                                       ";database=" + TxtDatabasename.Text.Trim() + ";uid=" +
                                                       TxtUsernameExternal.Text.Trim() + ";pwd=" +
                                                       TxtPasswordExternal.Text.Trim();
                                else
                                    connectionString = "Server=" + TxtServerNameExternal.Text.Trim() + ";Database=" +
                                                       TxtDatabasenameExternal.Text.Trim() + ";Trusted_Connection=True;";
                                config.AppSettings.Settings.Remove("BethesdaConnectionString");
                                config.AppSettings.Settings.Add("BethesdaConnectionString", connectionString);
                                config.Save(ConfigurationSaveMode.Modified);
                                ConfigurationManager.RefreshSection("appSettings");

                                consentFormSvcClient.SetBethesdaDbConnection(connectionString);
                            }
                            else
                                LblError.Text += "Please input required fields and submit.";
                        }
                        catch (Exception ex)
                        {
                            LblError.Text += "Unable to save external database settings due to [" + ex.Message + "]";
                        }
                    }
                    else
                        LblError.Text += "<br /> Please input wcf service URL and try again.";

                    try
                    {
                        // Get the service on the local machine
                        using (var ts = new TaskService())
                        {
                            if (ts.RootFolder.GetTasks().Any(task => task.Name == "BethedaContentSync"))
                            {
                                ts.RootFolder.DeleteTask("BethedaContentSync");
                            }

                            // Create a new task definition and assign properties
                            TaskDefinition td = ts.NewTask();
                            td.RegistrationInfo.Description = "Bethesda Employee, Patient and Physician import task.";

                            // Create a trigger that will fire the task at this time every day
                            td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Now.AddHours(-DateTime.Now.Hour), DaysInterval = 1, Enabled = true });

                            string path = @"C:\Program Files\Internet Explorer\iexplore.exe";

                            // Create an action that will launch Notepad whenever the trigger fires
                            td.Actions.Add(new ExecAction(Request.Url.OriginalString.Replace(Request.Url.Query, string.Empty) + "/Administration/", "", null));

                            // Register the task in the root folder
                            ts.RootFolder.RegisterTaskDefinition(@"BethedaContentSync", td);
                        }
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            var client = Utilities.GetConsentFormSvcClient();
                            client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                             ex.Message + Environment.NewLine + ex.StackTrace);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                try
                {
                    // Get the service on the local machine
                    using (var ts = new TaskService())
                    {
                        if (ts.RootFolder.GetTasks().Any(task => task.Name == "BethedaContentSync"))
                        {
                            ts.RootFolder.DeleteTask("BethedaContentSync");
                        }

                        // Create a new task definition and assign properties
                        TaskDefinition td = ts.NewTask();
                        td.RegistrationInfo.Description = "Bethesda Employee, Patient and Physician import task.";

                        // Create a trigger that will fire the task at this time every day
                        td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Now.AddHours(-DateTime.Now.Hour), DaysInterval = 1, Enabled = true });

                        // Create an action that will launch Notepad whenever the trigger fires
                        td.Actions.Add(new ExecAction(Request.Url.Host, "", null));

                        // Register the task in the root folder
                        ts.RootFolder.RegisterTaskDefinition(@"BethedaContentSync", td);
                    }
                }
                catch (Exception ex)
                {
                    try
                    {
                        var client = Utilities.GetConsentFormSvcClient();
                        client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                         ex.Message + Environment.NewLine + ex.StackTrace);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                try
                {
                    var client = Utilities.GetConsentFormSvcClient();
                    client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                     ex.Message + Environment.NewLine + ex.StackTrace);
                }
                catch (Exception)
                {
                }
            }
        }
Exemplo n.º 10
0
        private static void Main()
        {
            int width = -1;
            int height = -1;

            var wb = new WebBrowser { AllowNavigation = true, ScrollBarsEnabled = false, ScriptErrorsSuppressed = true };
            wb.Navigate("http://tillidsoft.com");
            while (wb.ReadyState != WebBrowserReadyState.Complete)
            { }
            // Set the size of the WebBrowser control
            wb.Width = width;
            wb.Height = height;
            if (wb.Document != null && wb.Document.Body != null)
            {
                if (width == -1)
                {
                    // Take Screenshot of the web pages full width
                    wb.Width = wb.Document.Body.ScrollRectangle.Width;
                }
                if (height == -1)
                {
                    // Take Screenshot of the web pages full height
                    wb.Height = wb.Document.Body.ScrollRectangle.Height;
                }

                // Get a Bitmap representation of the webpage as it's rendered in the WebBrowser control
                var bitmap = new Bitmap(wb.Width, wb.Height);
                wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));
                wb.Dispose();

                bitmap.Save(@"C:\Users\santhosh\Desktop\TaskScheduler\1.png", System.Drawing.Imaging.ImageFormat.Png);
            }
            return;

            //// Get the service on the local machine
            //using (var ts = new TaskService())
            //{
            //    if (ts.RootFolder.GetTasks().Any(task => task.Name == "BethedaContentSync"))
            //    {
            //        ts.RootFolder.DeleteTask("BethedaContentSync");
            //    }

            //    // Create a new task definition and assign properties
            //    TaskDefinition td = ts.NewTask();
            //    td.RegistrationInfo.Description = "Bethesda Employee, Patient and Physician import task.";

            //    // Create a trigger that will fire the task at this time every day
            //    //td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Now.AddHours(-DateTime.Now.Hour), DaysInterval = 1, Enabled = true });
            //    td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Now.AddSeconds(5), DaysInterval = 1, Enabled = true });

            //    string path = @"C:\Program Files\Internet Explorer\iexplore.exe";

            //    // Create an action that will launch Notepad whenever the trigger fires
            //    td.Actions.Add(new ExecAction(path, "", null));

            //    // Register the task in the root folder
            //    ts.RootFolder.RegisterTaskDefinition(@"BethedaContentSync", td);
            //}

            return;
            var consentFormSvcClient = new ConsentFormSvcClient();
            consentFormSvcClient.CreateLog("Sanhtosh", LogType.E, "Test", "Some desc");

            return;
            const string localConStr = "server=192.168.1.158;database=bethesdaCollege;uid=sa;pwd=sa@123";
            const string bethesdaConStr = "server=192.168.1.93;database=Soarian_Clin_Tst_1;uid=sa;pwd=sa@123";

            using (var sqlConnectionLocal = new SqlConnection(localConStr))
            {
                sqlConnectionLocal.Open();

                using (var sqlConnectionBethesda = new SqlConnection(bethesdaConStr))
                {
                    sqlConnectionBethesda.Open();

                    # region Import Physician

                    // ---------------starts physician import process------------------

                    //                    // starts synchronizing
                    //                    var command = new SqlCommand(string.Empty, sqlConnectionBethesda)
                    //                    {
                    //                        //CommandText = "select user_oid,GroupName,UserDescription from [soariandbtest].[dbo].[Physician]"
                    //                        CommandText = "BMH_Consent_GetPhysicianList",
                    //                        CommandType = CommandType.StoredProcedure
                    //                    };

                    //                    var daPhysician = new SqlDataAdapter(command);

                    //                    var physiciansDs = new DataSet();
                    //                    daPhysician.Fill(physiciansDs);

                    //                    int syncId = Convert.ToInt32(DateTime.Now.Ticks % 65323);

                    //                    foreach (DataTable dataTable in physiciansDs.Tables)
                    //                    {
                    //                        foreach (DataRow dataRow in dataTable.Rows)
                    //                        {
                    //                            command = new SqlCommand("select * from Physician where Fname='" + dataRow["UserDescription"] + "'", sqlConnectionLocal);

                    //                            daPhysician = new SqlDataAdapter(command);

                    //                            var physiciansCheck = new DataSet();
                    //                            daPhysician.Fill(physiciansCheck);

                    //                            if (physiciansCheck.Tables.Count == 0 || physiciansCheck.Tables[0].Rows.Count == 0)
                    //                            {
                    //                                string physicianName = dataRow["UserDescription"].ToString();
                    //                                string userId = dataRow["user_oid"].ToString();
                    //                                string groupName = dataRow["GroupName"].ToString();

                    //                                command = new SqlCommand(@"insert into Physician
                    //                                                                                values('False','True',8,'" + physicianName + "','" + userId +
                    //                                                            "',0,'" + groupName + "'," + syncId + ")", sqlConnectionLocal);
                    //                                command.ExecuteNonQuery();
                    //                            }
                    //                        }
                    //                    }

                    //                    // removing un - available physicians
                    //                    command = new SqlCommand("delete from Physician where SyncID !=" + syncId, sqlConnectionLocal);
                    //                    command.ExecuteNonQuery();

                    #endregion

                    #region Import Patients for BHE location

                    //AddPatient(sqlConnectionLocal, sqlConnectionBethesda, "BHE");

                    //AddPatient(sqlConnectionLocal, sqlConnectionBethesda, "BMH");

                    #endregion

                    #region Import Employee

                    // ---------------starts physician import process------------------

                    // starts synchronizing
                    var commandEmployee = new SqlCommand(string.Empty, sqlConnectionBethesda)
                    {
                        //CommandText = "select user_oid,GroupName,UserDescription from [soariandbtest].[dbo].[Physician]"
                        CommandText = "BMH_Consent_User",
                        CommandType = CommandType.StoredProcedure
                    };

                    var daEmployee = new SqlDataAdapter(commandEmployee);

                    var employeeDs = new DataSet();
                    daEmployee.Fill(employeeDs);

                    int syncIdEmployee = Convert.ToInt32(DateTime.Now.Ticks % 65323);

                    foreach (DataTable dataTable in employeeDs.Tables)
                    {
                        foreach (DataRow dataRow in dataTable.Rows)
                        {
                            commandEmployee = new SqlCommand("select * from EmployeeInformation where EmpID='" + dataRow["LoginID"] + "'", sqlConnectionLocal);

                            daEmployee = new SqlDataAdapter(commandEmployee);

                            var physiciansCheck = new DataSet();
                            daEmployee.Fill(physiciansCheck);

                            if (physiciansCheck.Tables.Count == 0 || physiciansCheck.Tables[0].Rows.Count == 0)
                            {
                                string lastName = dataRow["LastName"].ToString();
                                string firstName = dataRow["FirstName"].ToString();
                                string loginID = dataRow["LoginID"].ToString();

                                commandEmployee = new SqlCommand(@"insert into EmployeeInformation
                                           values('" + loginID + "','" + lastName + "','" + firstName + "','" + syncIdEmployee + "')", sqlConnectionLocal);
                                commandEmployee.ExecuteNonQuery();
                            }
                        }
                    }

                    // removing un - available physicians
                    commandEmployee = new SqlCommand("delete from EmployeeInformation where SyncID !=" + syncIdEmployee, sqlConnectionLocal);
                    commandEmployee.ExecuteNonQuery();

                    #endregion
                }
            }
        }
        protected void BtnCompleted_Click(object sender, EventArgs e)
        {
            try
            {
                // loading WCF Service URL from web.config
                Configuration config =
                    WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);

                // Getting export paths and display in boxes
                var endpoint            = new EndpointAddress(new Uri(config.AppSettings.Settings["ServiceURL"].Value));
                var formHandlerServices = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                if (!string.IsNullOrEmpty(TxtBloodConsentOrRefusalExportPath.Text.Trim()))
                {
                    formHandlerServices.SavePdFFolderPath(ConsentType.BloodConsentOrRefusal,
                                                          TxtBloodConsentOrRefusalExportPath.Text.Trim());
                }

                if (!string.IsNullOrEmpty(TxtCardiovascularExportPath.Text.Trim()))
                {
                    formHandlerServices.SavePdFFolderPath(ConsentType.Cardiovascular,
                                                          TxtCardiovascularExportPath.Text.Trim());
                }

                if (!string.IsNullOrEmpty(TxtEndoscopyExportPath.Text.Trim()))
                {
                    formHandlerServices.SavePdFFolderPath(ConsentType.Endoscopy, TxtEndoscopyExportPath.Text.Trim());
                }

                if (!string.IsNullOrEmpty(TxtOutsideORExportPath.Text.Trim()))
                {
                    formHandlerServices.SavePdFFolderPath(ConsentType.OutsideOR, TxtOutsideORExportPath.Text.Trim());
                }

                if (!string.IsNullOrEmpty(TxtPICCExportPath.Text.Trim()))
                {
                    formHandlerServices.SavePdFFolderPath(ConsentType.PICC, TxtPICCExportPath.Text.Trim());
                }

                if (!string.IsNullOrEmpty(TxtPlasmanApheresisExportPath.Text.Trim()))
                {
                    formHandlerServices.SavePdFFolderPath(ConsentType.PlasmanApheresis,
                                                          TxtPlasmanApheresisExportPath.Text.Trim());
                }

                if (!string.IsNullOrEmpty(TxtSurgicalExportPath.Text.Trim()))
                {
                    formHandlerServices.SavePdFFolderPath(ConsentType.Surgical, TxtSurgicalExportPath.Text.Trim());
                }

                if (!string.IsNullOrEmpty(TxtDomain.Text.Trim()) &&
                    !string.IsNullOrEmpty(TxtUsernameExports.Text.Trim()) &&
                    !string.IsNullOrEmpty(TxtPasswordExports.Text.Trim()))
                {
                    formHandlerServices.SavePdFPathCredentials(new Credentials
                    {
                        Domain   = TxtDomain.Text.Trim(),
                        Username = TxtUsernameExports.Text.Trim(),
                        Password = TxtPasswordExports.Text.Trim()
                    });
                }

                LblError.Text = "Configuration saved successfully.";
            }
            catch (Exception ex)
            {
                try
                {
                    var client = Utilities.GetConsentFormSvcClient();
                    client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                     ex.Message + Environment.NewLine + ex.StackTrace);
                }
                catch (Exception)
                {
                }
            }
        }
        protected void BtnCompleted_Click(object sender, EventArgs e)
        {
            try
            {
                // loading WCF Service URL from web.config
                Configuration config =
                    WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);

                // Getting export paths and display in boxes
                var endpoint = new EndpointAddress(new Uri(config.AppSettings.Settings["ServiceURL"].Value));
                var formHandlerServices = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                if (!string.IsNullOrEmpty(TxtBloodConsentOrRefusalExportPath.Text.Trim()))
                    formHandlerServices.SavePdFFolderPath(ConsentType.BloodConsentOrRefusal,
                                                          TxtBloodConsentOrRefusalExportPath.Text.Trim());

                if (!string.IsNullOrEmpty(TxtCardiovascularExportPath.Text.Trim()))
                    formHandlerServices.SavePdFFolderPath(ConsentType.Cardiovascular,
                                                          TxtCardiovascularExportPath.Text.Trim());

                if (!string.IsNullOrEmpty(TxtEndoscopyExportPath.Text.Trim()))
                    formHandlerServices.SavePdFFolderPath(ConsentType.Endoscopy, TxtEndoscopyExportPath.Text.Trim());

                if (!string.IsNullOrEmpty(TxtOutsideORExportPath.Text.Trim()))
                    formHandlerServices.SavePdFFolderPath(ConsentType.OutsideOR, TxtOutsideORExportPath.Text.Trim());

                if (!string.IsNullOrEmpty(TxtPICCExportPath.Text.Trim()))
                    formHandlerServices.SavePdFFolderPath(ConsentType.PICC, TxtPICCExportPath.Text.Trim());

                if (!string.IsNullOrEmpty(TxtPlasmanApheresisExportPath.Text.Trim()))
                    formHandlerServices.SavePdFFolderPath(ConsentType.PlasmanApheresis,
                                                          TxtPlasmanApheresisExportPath.Text.Trim());

                if (!string.IsNullOrEmpty(TxtSurgicalExportPath.Text.Trim()))
                    formHandlerServices.SavePdFFolderPath(ConsentType.Surgical, TxtSurgicalExportPath.Text.Trim());

                if (!string.IsNullOrEmpty(TxtDomain.Text.Trim()) &&
                    !string.IsNullOrEmpty(TxtUsernameExports.Text.Trim()) &&
                    !string.IsNullOrEmpty(TxtPasswordExports.Text.Trim()))
                {
                    formHandlerServices.SavePdFPathCredentials(new Credentials
                                                                   {
                                                                       Domain = TxtDomain.Text.Trim(),
                                                                       Username = TxtUsernameExports.Text.Trim(),
                                                                       Password = TxtPasswordExports.Text.Trim()
                                                                   });
                }

                LblError.Text = "Configuration saved successfully.";
            }
            catch (Exception ex)
            {
                try
                {
                    var client = Utilities.GetConsentFormSvcClient();
                    client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                     ex.Message + Environment.NewLine + ex.StackTrace);
                }
                catch (Exception)
                {
                }
            }
        }
        private void Reset()
        {
            try
            {
                TxtBloodConsentOrRefusalExportPath.Text = string.Empty;
                TxtCardiovascularExportPath.Text = string.Empty;
                TxtEndoscopyExportPath.Text = string.Empty;
                TxtOutsideORExportPath.Text = string.Empty;
                TxtPICCExportPath.Text = string.Empty;
                TxtPlasmanApheresisExportPath.Text = string.Empty;
                TxtSurgicalExportPath.Text = string.Empty;

                // loading WCF Service URL from web.config
                Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);

                // Getting export paths and display in boxes
                var endpoint = new EndpointAddress(new Uri(config.AppSettings.Settings["ServiceURL"].Value));
                var formHandlerServices = new ConsentFormSvcClient(new BasicHttpBinding(), endpoint);

                try // initially it might throw error
                {
                    TxtBloodConsentOrRefusalExportPath.Text =
                        formHandlerServices.GetPdFFolderPath(ConsentType.BloodConsentOrRefusal);
                    TxtCardiovascularExportPath.Text = formHandlerServices.GetPdFFolderPath(ConsentType.Cardiovascular);
                    TxtEndoscopyExportPath.Text = formHandlerServices.GetPdFFolderPath(ConsentType.Endoscopy);
                    TxtOutsideORExportPath.Text = formHandlerServices.GetPdFFolderPath(ConsentType.OutsideOR);
                    TxtPICCExportPath.Text = formHandlerServices.GetPdFFolderPath(ConsentType.PICC);
                    TxtPlasmanApheresisExportPath.Text = formHandlerServices.GetPdFFolderPath(ConsentType.PlasmanApheresis);
                    TxtSurgicalExportPath.Text = formHandlerServices.GetPdFFolderPath(ConsentType.Surgical);
                }
                catch (Exception)
                {
                }

                // try to loading credentials for export path
                try
                {
                    var credentials = formHandlerServices.GetPdFPathCredentials();
                    TxtDomain.Text = credentials.Domain;
                    TxtUsernameExports.Text = credentials.Username;
                    TxtPasswordExports.Text = credentials.Password;
                }
                catch (Exception)
                {
                }
            }
            catch (Exception ex)
            {
                var client = Utilities.GetConsentFormSvcClient();
                client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                 ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Exemplo n.º 14
0
        private static void Main()
        {
            int width  = -1;
            int height = -1;

            var wb = new WebBrowser {
                AllowNavigation = true, ScrollBarsEnabled = false, ScriptErrorsSuppressed = true
            };

            wb.Navigate("http://tillidsoft.com");
            while (wb.ReadyState != WebBrowserReadyState.Complete)
            {
            }
            // Set the size of the WebBrowser control
            wb.Width  = width;
            wb.Height = height;
            if (wb.Document != null && wb.Document.Body != null)
            {
                if (width == -1)
                {
                    // Take Screenshot of the web pages full width
                    wb.Width = wb.Document.Body.ScrollRectangle.Width;
                }
                if (height == -1)
                {
                    // Take Screenshot of the web pages full height
                    wb.Height = wb.Document.Body.ScrollRectangle.Height;
                }

                // Get a Bitmap representation of the webpage as it's rendered in the WebBrowser control
                var bitmap = new Bitmap(wb.Width, wb.Height);
                wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));
                wb.Dispose();

                bitmap.Save(@"C:\Users\santhosh\Desktop\TaskScheduler\1.png", System.Drawing.Imaging.ImageFormat.Png);
            }
            return;

            //// Get the service on the local machine
            //using (var ts = new TaskService())
            //{
            //    if (ts.RootFolder.GetTasks().Any(task => task.Name == "BethedaContentSync"))
            //    {
            //        ts.RootFolder.DeleteTask("BethedaContentSync");
            //    }

            //    // Create a new task definition and assign properties
            //    TaskDefinition td = ts.NewTask();
            //    td.RegistrationInfo.Description = "Bethesda Employee, Patient and Physician import task.";

            //    // Create a trigger that will fire the task at this time every day
            //    //td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Now.AddHours(-DateTime.Now.Hour), DaysInterval = 1, Enabled = true });
            //    td.Triggers.Add(new DailyTrigger { StartBoundary = DateTime.Now.AddSeconds(5), DaysInterval = 1, Enabled = true });

            //    string path = @"C:\Program Files\Internet Explorer\iexplore.exe";

            //    // Create an action that will launch Notepad whenever the trigger fires
            //    td.Actions.Add(new ExecAction(path, "", null));

            //    // Register the task in the root folder
            //    ts.RootFolder.RegisterTaskDefinition(@"BethedaContentSync", td);
            //}

            return;

            var consentFormSvcClient = new ConsentFormSvcClient();

            consentFormSvcClient.CreateLog("Sanhtosh", LogType.E, "Test", "Some desc");

            return;

            const string localConStr    = "server=192.168.1.158;database=bethesdaCollege;uid=sa;pwd=sa@123";
            const string bethesdaConStr = "server=192.168.1.93;database=Soarian_Clin_Tst_1;uid=sa;pwd=sa@123";

            using (var sqlConnectionLocal = new SqlConnection(localConStr))
            {
                sqlConnectionLocal.Open();

                using (var sqlConnectionBethesda = new SqlConnection(bethesdaConStr))
                {
                    sqlConnectionBethesda.Open();

                    # region Import Physician

                    // ---------------starts physician import process------------------

                    //                    // starts synchronizing
                    //                    var command = new SqlCommand(string.Empty, sqlConnectionBethesda)
                    //                    {
                    //                        //CommandText = "select user_oid,GroupName,UserDescription from [soariandbtest].[dbo].[Physician]"
                    //                        CommandText = "BMH_Consent_GetPhysicianList",
                    //                        CommandType = CommandType.StoredProcedure
                    //                    };

                    //                    var daPhysician = new SqlDataAdapter(command);

                    //                    var physiciansDs = new DataSet();
                    //                    daPhysician.Fill(physiciansDs);

                    //                    int syncId = Convert.ToInt32(DateTime.Now.Ticks % 65323);

                    //                    foreach (DataTable dataTable in physiciansDs.Tables)
                    //                    {
                    //                        foreach (DataRow dataRow in dataTable.Rows)
                    //                        {
                    //                            command = new SqlCommand("select * from Physician where Fname='" + dataRow["UserDescription"] + "'", sqlConnectionLocal);

                    //                            daPhysician = new SqlDataAdapter(command);

                    //                            var physiciansCheck = new DataSet();
                    //                            daPhysician.Fill(physiciansCheck);

                    //                            if (physiciansCheck.Tables.Count == 0 || physiciansCheck.Tables[0].Rows.Count == 0)
                    //                            {
                    //                                string physicianName = dataRow["UserDescription"].ToString();
                    //                                string userId = dataRow["user_oid"].ToString();
                    //                                string groupName = dataRow["GroupName"].ToString();

                    //                                command = new SqlCommand(@"insert into Physician
                    //                                                                                values('False','True',8,'" + physicianName + "','" + userId +
                    //                                                            "',0,'" + groupName + "'," + syncId + ")", sqlConnectionLocal);
                    //                                command.ExecuteNonQuery();
                    //                            }
                    //                        }
                    //                    }

                    //                    // removing un - available physicians
                    //                    command = new SqlCommand("delete from Physician where SyncID !=" + syncId, sqlConnectionLocal);
                    //                    command.ExecuteNonQuery();

                    #endregion

                    #region Import Patients for BHE location

                    //AddPatient(sqlConnectionLocal, sqlConnectionBethesda, "BHE");

                    //AddPatient(sqlConnectionLocal, sqlConnectionBethesda, "BMH");

                    #endregion

                    #region Import Employee

                    // ---------------starts physician import process------------------

                    // starts synchronizing
                    var commandEmployee = new SqlCommand(string.Empty, sqlConnectionBethesda)
                    {
                        //CommandText = "select user_oid,GroupName,UserDescription from [soariandbtest].[dbo].[Physician]"
                        CommandText = "BMH_Consent_User",
                        CommandType = CommandType.StoredProcedure
                    };

                    var daEmployee = new SqlDataAdapter(commandEmployee);

                    var employeeDs = new DataSet();
                    daEmployee.Fill(employeeDs);

                    int syncIdEmployee = Convert.ToInt32(DateTime.Now.Ticks % 65323);

                    foreach (DataTable dataTable in employeeDs.Tables)
                    {
                        foreach (DataRow dataRow in dataTable.Rows)
                        {
                            commandEmployee = new SqlCommand("select * from EmployeeInformation where EmpID='" + dataRow["LoginID"] + "'", sqlConnectionLocal);

                            daEmployee = new SqlDataAdapter(commandEmployee);

                            var physiciansCheck = new DataSet();
                            daEmployee.Fill(physiciansCheck);

                            if (physiciansCheck.Tables.Count == 0 || physiciansCheck.Tables[0].Rows.Count == 0)
                            {
                                string lastName  = dataRow["LastName"].ToString();
                                string firstName = dataRow["FirstName"].ToString();
                                string loginID   = dataRow["LoginID"].ToString();

                                commandEmployee = new SqlCommand(@"insert into EmployeeInformation
                                           values('" + loginID + "','" + lastName + "','" + firstName + "','" + syncIdEmployee + "')", sqlConnectionLocal);
                                commandEmployee.ExecuteNonQuery();
                            }
                        }
                    }

                    // removing un - available physicians
                    commandEmployee = new SqlCommand("delete from EmployeeInformation where SyncID !=" + syncIdEmployee, sqlConnectionLocal);
                    commandEmployee.ExecuteNonQuery();

                    #endregion
                }
            }