示例#1
0
        //[RecordCall]
        //[LogExceptions]
        //[Diagnose]
        //[MeasurePerformance]
        public ActionResult Index()
        {
            UiTestModel model = new UiTestModel();

            model = DynamicListToDataTable();

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

            return View(model);
        }
示例#2
0
        public ActionResult XSDtest()
        {
            string pathXsd = "G:/schema.xsd"; 
            string pathXml = "G:/test.xml";
            XmlSchema Schema;

            try
            {
                XmlDocument doc = new XmlDocument();

                if (FileHelper.FileExist("pathXml"))
                    FileHelper.Delete(pathXml);

                XmlNode root = doc.CreateElement("xyz");
                XmlAttribute rootAttr = doc.CreateAttribute("xmlns");
                rootAttr.Value = "abc";
                if (root.Attributes != null) root.Attributes.Append(rootAttr);

                XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(declaration);

                doc.AppendChild(root);
                doc.Save(pathXml);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        


            UiTestModel model = new UiTestModel();


            return View("Index",model);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
0
        //[RecordCall]
        //[LogExceptions]
        //[Diagnose]
        //[MeasurePerformance]
        private UiTestModel DynamicListToDataTable()
        {

            DataStructureManager dm = new DataStructureManager();

            UiTestModel model = new UiTestModel();

            model.DataTable = BexisDataHelper.ToDataTable<DataStructure>(dm.AllTypesDataStructureRepo.Get(), new List<string> { "Id", "Name", "Description", "CreationInfo" });
            model.DataTable2 = model.DataTable;

            return model;
        }
示例#6
0
        public ActionResult sendForm(UiTestModel model)
        {

            return View("Index", model);
        }