Load() public method

public Load ( ) : void
return void
Beispiel #1
0
        public async Task<ActionResult> Call()
        {
            SubmissionManager submissionManager = new SubmissionManager();
            submissionManager.Load();

            DataRepository dataRepository =
                submissionManager.DataRepositories.Where(d => d.Name.ToLower().Equals("gfbio")).FirstOrDefault();

            GFBIOWebserviceManager gfbioWebserviceManager = new GFBIOWebserviceManager(dataRepository);
            


            Debug.WriteLine("call a webservice from gfbio");
            Debug.WriteLine("GET");
            Debug.WriteLine("-----------------------------------------------------------");

            //research object id 201
            //wieso als json ein array?
            var p = await CallGFBIOWebservice(201, "get-research-object-by-id","researchobject", "[{\"researchobjectid\":201}]");
            Debug.WriteLine(p);

            p = await gfbioWebserviceManager.GetResearchObjectById(401);
            Debug.WriteLine(p);

            Debug.WriteLine("-----------------------------------------------------------");
            //project id 201
            p = await CallGFBIOWebservice(201, "get-project-by-id","project", "{\"projectid\":401}");
            Debug.WriteLine(p);

            //if (string.IsNullOrEmpty(p))
            //{
            //    Debug.WriteLine("Create");
            //    Debug.WriteLine("-----------------------------------------------------------");
            //    p =
            //        await
            //            CallGFBIOWebservice(201, "create-project", "project",
            //                "{\"userid\":1,\"name\":\"bexis 2 test\",\"description\":\"test\"}");

            //    Debug.WriteLine(p);
            //}

            //wieso als return json ein array?
            // create research object 
            // name, label, extendeddata (json), researchobjecttype (e.eg metadata schema)
            //p = await CallGFBIOWebservice(201, "create-research-object", "researchobject", "[{\"name\":\"bexis 2 ro create\",\"label\":\"bexis 2 ro create\",\"extendeddata\":{},\"researchobjecttype\":\"metadata schema\"}]");
            Debug.WriteLine(p);


            UiTestModel model = new UiTestModel();
            model = DynamicListToDataTable();

            return View("Index",model);
        }
Beispiel #2
0
        public ActionResult Test()
        {
            UiTestModel model = new UiTestModel();

            model = DynamicListToDataTable();

            SubmissionManager pm = new SubmissionManager();
            DatasetManager dm = new DatasetManager();

            pm.Load();

            DataRepository gfbio = pm.DataRepositories.Where(d => d.Name.ToLower().Equals("gfbio")).FirstOrDefault();

            // get metadata
            long testdatasetId = 1;
            string formatname = "";
            XmlDocument newXmlDoc;
            DatasetVersion dsv = dm.GetDatasetLatestVersion(testdatasetId);
            string title = XmlDatasetHelper.GetInformation(dsv, NameAttributeValues.title);


            if (gfbio != null)
            {
                formatname =
                    XmlDatasetHelper.GetAllTransmissionInformation(1, TransmissionType.mappingFileExport, AttributeNames.name)
                        .First();
                OutputMetadataManager.GetConvertedMetadata(testdatasetId, TransmissionType.mappingFileExport,
                    formatname);


                // get primary data
                // check the data sturcture type ...
                if (dsv.Dataset.DataStructure.Self is StructuredDataStructure)
                {
                    OutputDataManager odm = new OutputDataManager();
                    // apply selection and projection
                    
                    odm.GenerateAsciiFile(testdatasetId, title, gfbio.PrimaryDataFormat);
                }

                string zipName = pm.GetZipFileName(testdatasetId, dsv.Id);
                string zipPath = pm.GetDirectoryPath(testdatasetId, gfbio);
                string zipFilePath = Path.Combine(zipPath, zipName);

                FileHelper.CreateDicrectoriesIfNotExist(Path.GetDirectoryName(zipFilePath));

                

                if (FileHelper.FileExist(zipFilePath))
                {
                    if (FileHelper.WaitForFile(zipFilePath))
                    {
                        FileHelper.Delete(zipFilePath);
                    }
                }

                ZipFile zip = new ZipFile();

                foreach (ContentDescriptor cd in dsv.ContentDescriptors)
                {
                    string path = Path.Combine(AppConfiguration.DataPath, cd.URI);
                    string name = cd.URI.Split('\\').Last();

                    if (FileHelper.FileExist(path))
                    {
                        zip.AddFile(path, "");
                    }
                }
                zip.Save(zipFilePath);
            }
            else
            {
                newXmlDoc = dsv.Metadata;
            }


            

            return View("Index", model);
        }