public void WhenIUpdateExistingItemDataOfAPatientUsingConsumeODMStrTransactionalWebserviceWithBelowDataAndOdmfile_(string patientIdentity, Table table)
        {
            List <string> RepFields = new List <string>(table.Header);

            foreach (TableRow row in table.Rows)
            {
                List <string> RepData = new List <string>();
                foreach (string col in RepFields)
                {
                    if (col == "ODMDATA")
                    {
                        string ODMText = RequestResponseHandler.GetODMText(row[col]);
                        if (patientIdentity != null && patientIdentity != "")
                        {
                            SQLInfo Info           = StoreSQLInfo();
                            string  QueryToExecute = "Select subjectkey from Patient where PatientIdentity = '" + patientIdentity + "'";
                            Info.QueryResultTable = DatabaseUtilities.GetRecordsFromDB(QueryToExecute, Info);
                            DataTable data       = Info.QueryResultTable;
                            string    SubjectKey = string.Empty;
                            SubjectKey = data.Rows[0].ItemArray[0].ToString();
                            bool exist = ODMText.Contains("SubjectKeyDataValue");
                            ODMText = ODMText.Replace("SubjectKeyDataValue", SubjectKey);
                        }
                        RepData.Add("<![CDATA[" + ODMText + "]]>");
                    }
                    else
                    {
                        RepData.Add(row[col]);
                    }
                }
                ScenarioContext.Current["StatusCode"] = RequestResponseHandler.HandleSyncRequest(ConfigurationHelper.WebServiceEndPoint + "/" + ConfigurationHelper.DLInstanceName, "POST", "ConsumeODM1_StrTransactional", RepFields, RepData);
            }
        }
        public void WhenIAddAItemLevelDCFUsingDCFCreateFormLevelDCFWebserviceWithBelowData_(Table table)
        {
            List <string> RepFields = new List <string>(table.Header);

            foreach (TableRow row in table.Rows)
            {
                List <string> RepData = new List <string>();
                foreach (string col in RepFields)
                {
                    if (col == "SubjectKeyData")
                    {
                        SQLInfo Info           = StoreSQLInfo();
                        string  QueryToExecute = "Select subjectkey from Patient where PatientIdentity = '" + row[col] + "'";
                        Info.QueryResultTable = DatabaseUtilities.GetRecordsFromDB(QueryToExecute, Info);
                        DataTable data       = Info.QueryResultTable;
                        string    SubjectKey = string.Empty;
                        SubjectKey = data.Rows[0].ItemArray[0].ToString();
                        RepData.Add(SubjectKey);
                    }
                    else
                    {
                        RepData.Add(row[col]);
                    }
                }
                ScenarioContext.Current["StatusCode"] = RequestResponseHandler.HandleSyncRequest(ConfigurationHelper.WebServiceEndPoint + "/" + ConfigurationHelper.DLInstanceName, "POST", "CreateItemLevelDCF", RepFields, RepData);
            }
        }
        public void WhenIAddANewPatientUsingAddNewPatientWebserviceWithBelowData_(Table table)
        {
            List <string> RepFields = new List <string>(table.Header);

            foreach (TableRow row in table.Rows)
            {
                List <string> RepData = new List <string>();
                foreach (string col in RepFields)
                {
                    RepData.Add(row[col]);
                }
                ScenarioContext.Current["StatusCode"] = RequestResponseHandler.HandleSyncRequest(ConfigurationHelper.WebServiceEndPoint + "/" + ConfigurationHelper.DLInstanceName, "POST", "AddNewPatient", RepFields, RepData);
            }
        }
Exemple #4
0
        public static void Register(HttpConfiguration config)
        {
            var cors = new EnableCorsAttribute("*", "*", "*");

            config.EnableCors(cors);
            config.MessageHandlers.Add(new PreflightRequestsHandler());

            config.AddApiVersioning(o =>
            {
                o.ReportApiVersions = true;
                o.AssumeDefaultVersionWhenUnspecified = true;
                o.DefaultApiVersion  = new ApiVersion(1, 0);
                o.ApiVersionReader   = new HeaderApiVersionReader("version");
                o.ApiVersionSelector = new CurrentImplementationApiVersionSelector(o);
            }
                                    );

            // Web API routes
            config.MapHttpAttributeRoutes(new CustomDirectRouteProvider());

            // Web API configuration and services
            // Configure Web API to use only bearer token authentication.
            //config.SuppressDefaultHostAuthentication();
            //config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

            var scope = GlobalConfiguration.Configuration.DependencyResolver.BeginScope();
            IGlobalExceptionHandler   globalExceptionHandler   = scope.GetService(typeof(IGlobalExceptionHandler)) as IGlobalExceptionHandler;
            IUnhandledExceptionLogger unhandledExceptionLogger = scope.GetService(typeof(IUnhandledExceptionLogger)) as IUnhandledExceptionLogger;
            RequestResponseHandler    messageHandler           = scope.GetService(typeof(RequestResponseHandler)) as RequestResponseHandler;

            config.Services.Replace(typeof(IExceptionHandler), globalExceptionHandler);
            config.Services.Replace(typeof(IExceptionLogger), unhandledExceptionLogger);

            config.MessageHandlers.Add(messageHandler);

            var json = config.Formatters.JsonFormatter;

            json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None;
            json.SerializerSettings.ReferenceLoopHandling      = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            //config.Formatters.Remove(config.Formatters.XmlFormatter); //Remove XML Formatting from Web API

            /*config.Routes.MapHttpRoute(
             *  "DefaultApi",
             *  "api/v1/{controller}/{id}",
             *  new { id = RouteParameter.Optional }
             * );*/
        }
        public void WhenIAddItemDataUsingConsumeODM_StrTransactionalWebserviceWithBelowDataAndOdmfile_(Table table)
        {
            List <string> RepFields = new List <string>(table.Header);

            foreach (TableRow row in table.Rows)
            {
                List <string> RepData = new List <string>();
                foreach (string col in RepFields)
                {
                    if (col == "ODMDATA")
                    {
                        string ODMText = RequestResponseHandler.GetODMText(row[col]);
                        RepData.Add("<![CDATA[" + ODMText + "]]>");
                    }
                    else
                    {
                        RepData.Add(row[col]);
                    }
                }
                ScenarioContext.Current["StatusCode"] = RequestResponseHandler.HandleSyncRequest(ConfigurationHelper.WebServiceEndPoint + "/" + ConfigurationHelper.DLInstanceName, "POST", "ConsumeODM1_StrTransactional", RepFields, RepData);
            }
        }
        public void WhenISaveTheStudyMetaDataExportedFromGetStudyMetaDataODMMethodUnderPatientAndOperationalDataEventingWebservice(Table table)
        {
            List <string> RepFields = new List <string>(table.Header);

            foreach (TableRow row in table.Rows)
            {
                List <string> RepData        = new List <string>();
                string        FilePathtoSave = string.Empty;
                foreach (string col in RepFields)
                {
                    if (col == "ResponseFile")
                    {
                        FilePathtoSave = FeatureContext.Current["ReportsFolderPath"].ToString();
                        FilePathtoSave = FilePathtoSave + row[col];
                    }
                    else
                    {
                        RepData.Add(row[col]);
                    }
                }

                ScenarioContext.Current["StatusCode"] = RequestResponseHandler.HandleGETRequest(ConfigurationHelper.WebServiceEndPoint + "/" + ConfigurationHelper.DLInstanceName, "POST", "GetStudyMetaDataODM132", RepFields, RepData, FilePathtoSave);
            }
        }
 public void WhenIGetTheLabDetailsFromAPI_()
 {
     ScenarioContext.Current["StatusCode"] = RequestResponseHandler.HandleGetRESTRequest(ConfigurationHelper.WebServiceEndPoint, "/", "GETLABS");
 }