コード例 #1
0
        public void FromFilename(string filename)
        {
            //if (filename.ToUpper().Contains(".PNG")) FromGrid(GraphicsApi.PngToGrid(filename));
            if (filename.ToUpper().Contains(".STL"))
            {
                FromTriangles(RasterLib.RasterApi.StlToTriangles(filename));
            }
            if (filename.ToUpper().Contains(".OBJ"))
            {
                FromTriangles(RasterLib.RasterApi.ObjToTriangles(filename));
            }

            if (filename.ToUpper().Contains(".GLYC"))
            {
                code = new Code(RasterLib.RasterApi.ReadGlyc(filename));
                //code = Codes.GetCode(0);
                FromCode(code);
            }
            else if (filename.ToUpper().Contains(".GLY"))
            {
                Codes = RasterLib.RasterApi.GlyToCodes(filename);
                code  = Codes.GetCode(0);
                FromCode(code);
            }
        }
コード例 #2
0
 private void SetParentId(Id parentId, CodeList codeList)
 {
     if (parentId != null)
     {
         code.Parent = codeList.Get(parentId);
     }
 }
コード例 #3
0
        private void Save()
        {
            loaderini.Mods.Clear();

            foreach (ListViewItem item in modListView.CheckedItems)
            {
                loaderini.Mods.Add((string)item.Tag);
            }

            loaderini.UpdateCheck     = checkUpdateStartup.Checked;
            loaderini.ModUpdateCheck  = checkUpdateModsStartup.Checked;
            loaderini.UpdateUnit      = (UpdateUnit)comboUpdateFrequency.SelectedIndex;
            loaderini.UpdateFrequency = (int)numericUpdateFrequency.Value;

            IniSerializer.Serialize(loaderini, loaderinipath);

            List <Code> selectedCodes   = new List <Code>();
            List <Code> selectedPatches = new List <Code>();

            foreach (Code item in codesCheckedListBox.CheckedIndices.OfType <int>().Select(a => codes[a]))
            {
                if (item.Patch)
                {
                    selectedPatches.Add(item);
                }
                else
                {
                    selectedCodes.Add(item);
                }
            }

            CodeList.WriteDatFile(patchdatpath, selectedPatches);
            CodeList.WriteDatFile(codedatpath, selectedCodes);
        }
コード例 #4
0
 public OverFlowCheckViewModel()
 {
     tempSever = new SimpleTCP.SimpleTcpServer().Start(10086);
     tempSever.DataReceived += (sender, msg) =>
     {
         IP = msg.TcpClient.Client.LocalEndPoint.ToString();
         string message = Encoding.ASCII.GetString(msg.Data);
         Common.TCPHelper.COMMANDER cmd = new Common.TCPHelper.COMMANDER(message);
         messageList.Add(cmd);
         DMCode temp = new DMCode();
         temp.CodeID   = cmd.BoxId;
         temp.CodeName = cmd.CommandType;
         temp.Email    = cmd.PackagePosition;
         temp.Info     = cmd.PackagePositionCount;
         temp.Phone    = cmd.DATETIME;
         severmeeage   = cmd.GenerateSendSuccessMessage();
         byte[] data1 = Encoding.ASCII.GetBytes(severmeeage);
         //  tempSever.Send(tempSever.clientList[0],severmeeage);
         // tempSever.clientList[0].BeginSend(data1,0,data1.Length,SocketFlags.None, new AsyncCallback(Message_Send), tempSever.clientList[0]);
         CodeList.Add(temp);
         msg.Reply(severmeeage);
     };
     FFmpegBinariesHelper.RegisterFFmpegBinaries();
     //  SetupLogging();
 }
コード例 #5
0
        // GET: Files/Edit/5
        public ActionResult Edit(Guid?systemid)
        {
            if (systemid == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Models.Symbol symbol = _symbolService.GetSymbol(systemid.Value);

            if (symbol == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Themes         = new SelectList(CodeList.Themes(), "Key", "Value", symbol.Theme);
            ViewBag.SymbolPackages = new MultiSelectList(_symbolService.GetPackagesWithAccessControl(), "SystemId", "Name", symbol.SymbolPackages.Select(c => c.SystemId).ToArray());

            ViewBag.IsAdmin = false;
            if (Request.IsAuthenticated)
            {
                ViewBag.IsAdmin = _authorizationService.IsAdmin();
            }

            return(View(symbol));
        }
コード例 #6
0
 /// <summary>
 ///     Удалить набор операторов
 /// </summary>
 /// <param name="nodes">Список</param>
 public void RemoveNodes(IEnumerable <Node> nodes)
 {
     foreach (var node in nodes)
     {
         CodeList.Remove(node);
     }
 }
コード例 #7
0
        public ActionResult Edit(SymbolPackage symbolPackage)
        {
            ViewBag.IsAdmin = false;
            if (Request.IsAuthenticated)
            {
                ViewBag.IsAdmin = _authorizationService.IsAdmin();
            }

            if (!ViewBag.IsAdmin)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }

            SymbolPackage symbolPackageOriginal = _symbolService.GetPackage(symbolPackage.SystemId);

            ViewBag.Themes = new SelectList(CodeList.Themes(), "Key", "Value", symbolPackage.Theme);

            if (ModelState.IsValid)
            {
                try
                {
                    _symbolService.UpdatePackage(symbolPackageOriginal, symbolPackage);
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    ModelState.AddModelError("error", ex.Message);
                }
            }
            return(View(symbolPackage));
        }
コード例 #8
0
        public ActionResult Create(Models.Symbol symbol, HttpPostedFileBase uploadFile, string[] packages)
        {
            ViewBag.Themes         = new SelectList(CodeList.Themes(), "Key", "Value", symbol.Theme);
            ViewBag.SymbolPackages = new SelectList(_symbolService.GetPackagesWithAccessControl(), "SystemId", "Name");
            symbol.SymbolPackages  = new List <SymbolPackage>();
            if (packages != null)
            {
                foreach (var package in packages)
                {
                    symbol.SymbolPackages.Add(_symbolService.GetPackage(Guid.Parse(package)));
                }
            }

            ViewBag.IsAdmin = false;
            if (Request.IsAuthenticated)
            {
                ViewBag.IsAdmin = _authorizationService.IsAdmin();
            }

            if (ModelState.IsValid)
            {
                ImageService img = new ImageService();
                if (uploadFile != null)
                {
                    symbol.Thumbnail = img.SaveThumbnail(uploadFile, symbol);
                }

                var addedSymbol = _symbolService.AddSymbol(symbol);
                return(RedirectToAction("Details", "Files", new { systemid = addedSymbol.SystemId }));
            }

            return(View(symbol));
        }
コード例 #9
0
        StataCodeList CreateStataCodeList(CodeList codeList)
        {
            if (codeList == null)
            {
                codeList = new CodeList();
            }

            var stataCodeList = new StataCodeList();

            stataCodeList.Name = codeList.ItemName.Best;

            foreach (var code in codeList.GetFlattenedCodes())
            {
                int value = 0;
                if (int.TryParse(code.Value, out value))
                {
                    string label = code.Category?.Label.Best;
                    if (label == null)
                    {
                        label = string.Empty;
                    }

                    stataCodeList.Codes.Add(value, label);
                }
            }

            return(stataCodeList);
        }
コード例 #10
0
        public ActionResult Edit(Guid?systemid)
        {
            ViewBag.IsAdmin = false;
            if (Request.IsAuthenticated)
            {
                ViewBag.IsAdmin = _authorizationService.IsAdmin();
            }

            if (systemid == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (!ViewBag.IsAdmin)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }

            SymbolPackage symbolPackage = _symbolService.GetPackage(systemid.Value);

            if (symbolPackage == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Themes = new SelectList(CodeList.Themes(), "Key", "Value", symbolPackage.Theme);

            return(View(symbolPackage));
        }
コード例 #11
0
        //Load a glyphics file, precompute rectangles and append them to codeString as speedy cache
        public static void PreSerializeGlyphicsFile(string filename)
        {
            CodeList codes = GlyToCodes(filename);

            foreach (Code t in codes)
            {
                string code = t.codeString;

                if (code.Contains("*"))
                {
                    code = code.Split('*')[0];
                }

                Grid grid = CodeConverter.TokensToGrid(CodeConverter.CodeToTokens(new Code(code)));

                if (grid != null)
                {
                    RectList rectSet         = GridConverter.GridToRects(grid);
                    string   serializedRects = RectConverter.RectsToSerializedRects(rectSet).SerializedData;
                    code         = code + serializedRects;
                    t.codeString = code;
                }
            }
            CodesToGly(filename, codes);
        }
コード例 #12
0
        public void GetCodeLists()
        {
            NoarkClient client = this.documasterClients.GetNoarkClient();

            Console.WriteLine("Get all available code lists");
            List <CodeList> allLists = client.CodeLists();

            foreach (CodeList codeList in allLists)
            {
                Console.WriteLine($"Field: {codeList.Field}. Type: {codeList.Type}. Values:");
                foreach (CodeValue codeValue in codeList.Values)
                {
                    Console.WriteLine($"===== Code: {codeValue.Code}. Value: {codeValue.Name}");
                }
            }

            Console.WriteLine();
            Console.WriteLine("Get a code list by field and/or type");
            CodeList documentTypeList = client.CodeLists("Dokument", "dokumenttype").First();

            foreach (CodeValue codeValue in documentTypeList.Values)
            {
                Console.WriteLine($"===== Code: {codeValue.Code}. Value: {codeValue.Name}");
            }
        }
コード例 #13
0
ファイル: HomeController.cs プロジェクト: jijiliyugou/xiangmu
        public async Task <ObjectResultModule> RefundManageType([FromBody] RefundManageType RefundManageInfo)
        {
            if (!Commons.CheckSecret(RefundManageInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var param2 = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };

            param2.AndAlso(t => !t.IsDelete && t.SystemCode == "PatientRefundManageType");
            var paramlist = await _systemParameterService.ParameterList(param2);

            var reundType = new List <CodeList>();

            foreach (var item in paramlist)
            {
                var newcode = new CodeList()
                {
                    Code = item.Code, Value = item.Name, Type = item.SystemType, TypeCode = item.SystemCode
                };
                reundType.Add(newcode);
            }

            this.ObjectResultModule.Object     = reundType;
            this.ObjectResultModule.StatusCode = 200;
            this.ObjectResultModule.Message    = "success";

            return(this.ObjectResultModule);
        }
コード例 #14
0
ファイル: CodeMap.cs プロジェクト: tomplusit/sdmxdotnet
 private void SetParentID(ID parentID, CodeList codeList)
 {
     if (parentID != null)
     {
         code.Parent = codeList.Get(parentID);
     }
 }
コード例 #15
0
        internal bool exist(CodeList codeList)
        {
            string txtQuery = string.Format("SELECT * FROM {0} WHERE code = @code and description = @description", this.tableName);

            try
            {
                CodeList data = new CodeList();
                using (SQLiteConnection c = new SQLiteConnection(sqlite.ConnectionString))
                {
                    c.Open();
                    using (SQLiteCommand cmd = new SQLiteCommand(txtQuery, c))
                    {
                        cmd.Parameters.AddWithValue("@code", codeList.code);
                        cmd.Parameters.AddWithValue("@description", codeList.description);
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
                        {
                            if (dr.Read())
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #16
0
        public void RunGlyLoadSaveTest()
        {
            const string filename = "test.gly";

            CodeList codes = RasterLib.RasterApi.CreateCodes();

            //Create some codeString
            const string cubeCode1 = "Testx4,Size3D4 4 4 4;PenColorD4 255 255 255 255;FillRect 0 0 0 4 4 4";
            const string cubeCode2 = "Testx8,Size3D4 8 8 8;PenColorD4 255 255 255 255;FillRect 0 0 0 8 8 8";

            //Add them to codes
            codes.AddCode(RasterLib.RasterApi.CreateCode(cubeCode1));
            codes.AddCode(RasterLib.RasterApi.CreateCode(cubeCode2));

            //Write them to file
            RasterLib.RasterApi.CodesToGly(filename, codes);

            //Then read them back
            CodeList codes2 = RasterLib.RasterApi.GlyToCodes(filename);

            Assert.IsTrue(codes.Count == codes2.Count);

            for (int i = 0; i < codes.Count; i++)
            {
                string code1 = codes.GetCode(i).codeString;
                string code2 = codes2.GetCode(i).codeString;
                Assert.IsTrue(String.CompareOrdinal(code1, code2) == 0);
            }
        }
コード例 #17
0
 //Checks to see if the block was previously in a code list and removes it
 private void OldCodeListCheck(CodeList oldCodeList, GameObject draggedObject)
 {
     if (oldCodeList != null)
     {
         oldCodeList.RemoveBlock(draggedObject);
     }
 }
コード例 #18
0
    //Called when block is dropped into a code list
    private void CodeListDropZone(GameObject draggedObject)
    {
        // Gets a reference to the codeList script
        CodeList codeListScript = gameObject.transform.parent.GetComponent <CodeList>();

        if (codeListScript != null)         //Ensures that a script is found
        {
            //Calls the AddBlock method on the Code List script
            if (draggedObject.tag == "CodeBlock" || gameObject.tag == "StartBlock")
            {
                codeListScript.AddBlock(draggedObject);
            }
            else if (draggedObject.tag == "CodeList")
            {
                CodeList draggedListScript = draggedObject.GetComponent <CodeList>();
                if (draggedListScript != null)
                {
                    codeListScript.AddBlock(draggedListScript);
                }
            }
        }
        else
        {
            Debug.Log("No Code List Script found on Parent");
        }
    }
コード例 #19
0
        private async void Task5_Delete_Code_OkResult()
        {
            //Arrange
            _context    = new SDCContext(dbContextOptions);
            _controller = new CodeListsController(_context);
            var code = new CodeList()
            {
                CategoryId = 1,
                CodeId     = 10,
                CodeName   = "New and Del Pickle",
            };

            //Act
            var resultCreate = await _controller.PostCodeList(code);

            var okResult      = resultCreate.Should().BeOfType <CreatedAtActionResult>().Subject;
            var resClient     = okResult.Value.Should().BeAssignableTo <CodeList>().Subject;
            int delcategoryId = resClient.CategoryId;
            int delcodeId     = resClient.CodeId;

            var result = await _controller.DeleteCodeList(delcategoryId, delcodeId);

            //Assert
            Assert.IsType <OkObjectResult>(result);
        }
コード例 #20
0
        public Price MakePrice(CodeList codeList)
        {
            string[] limitArray = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[7]/dl/dd/strong").InnerText.Split('~');

            Price price = new Price()
            {
                codeList       = codeList,
                code           = this.code,
                lastClosePrice = doublePrice(htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[1]/dl/dd/strong").InnerText),

                closePrice     = doublePrice(htmlDoc.DocumentNode.SelectSingleNode("//td[@class='stoksPrice']").InnerText), //"/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[5]/div[1]/div[2]/table[1]/tr[1]/td[2]" ※, ,が入ってる
                closePriceDate = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[6]/dl/dd/span").InnerText,

                date          = this.date,
                openPrice     = doublePrice(htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[2]/dl/dd/strong").InnerText), // "/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[6]/div[2]/div[2]/dl[1]/dd[1]/strong[1]" ※, ,が入ってる
                openPriceDate = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[2]/dl/dd/span").InnerText,

                highPrice     = doublePrice(htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[3]/dl/dd/strong").InnerText), // "/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[6]/div[2]/div[3]/dl[1]/dd[1]/strong[1]" ※, ,が入ってる
                highPriceDate = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[3]/dl/dd/span").InnerText,

                lowPrice     = doublePrice(htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[4]/dl/dd/strong").InnerText),      // "/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[6]/div[2]/div[4]/dl[1]/dd[1]/strong[1]" ※, ,が入ってる
                lowPriceDate = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[4]/dl/dd/span").InnerText,

                tradingVolume  = longPrice(htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[6]/dl/dd/strong").InnerText) * 1000, // "/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[6]/div[2]/div[6]/dl[1]/dd[1]/strong[1]" ※, ,が入ってる
                volume         = longPrice(htmlDoc.DocumentNode.SelectSingleNode("//div[@class='innerDate']/div[5]/dl/dd/strong").InnerText),        // "/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[6]/div[2]/div[5]/dl[1]/dd[1]/strong[1]" ※, ,が入ってる
                limitHighPrice = (double)doublePrice(limitArray[1]),                                                                                 // "/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[6]/div[2]/div[7]/dl[1]/dd[1]/strong[1]" ※ 〇~〇
                limitLowPrice  = (double)doublePrice(limitArray[0])                                                                                  // "/html[1]/body[1]/div[1]/div[2]/div[2]/div[1]/div[6]/div[2]/div[7]/dl[1]/dd[1]/strong[1]" ※ 〇~〇
            };

            return(price);
        }
コード例 #21
0
        public async void Task3_Post_NewCode_FindName()
        {
            //Arrange
            _context    = new SDCContext(dbContextOptions);
            _controller = new CodeListsController(_context);
            var category = new CodeList()
            {
                CategoryId = 1,
                CodeId     = 6,
                CodeName   = "NewPickle"
            };

            //Act
            var result = await _controller.PostCodeList(category);

            //Assert
            var okResult  = result.Should().BeOfType <CreatedAtActionResult>().Subject;
            var resClient = okResult.Value.Should().BeAssignableTo <CodeList>().Subject;

            resClient.CodeName.Should().Be("NewPickle");

            //delete JayNew
            int categoryId   = _context.CodeList.FirstOrDefault(p => p.CodeName == "NewPickle").CategoryId;
            int codeId       = _context.CodeList.FirstOrDefault(p => p.CodeName == "NewPickle").CodeId;
            var resultDelete = await _controller.DeleteCodeList(categoryId, codeId);
        }
コード例 #22
0
        public async Task <IActionResult> Edit(int categoryId, [Bind("CategoryId,CodeId,CodeName")] CodeList codeList)
        {
            if (categoryId != codeList.CategoryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(codeList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CodeListExists(codeList.CategoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.CodeCategory, "CategoryId", "CategoryName", codeList.CategoryId);
            return(View(codeList));
        }
コード例 #23
0
ファイル: CodeListsController.cs プロジェクト: jjang3530/SDC
        public async Task <IActionResult> PostCodeList([FromBody] CodeList codeList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.CodeList.Add(codeList);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (CategoryListExists(codeList.CategoryId) && CodeListExists(codeList.CodeId))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetCodeList", new { id = codeList.CategoryId }, codeList));
        }
コード例 #24
0
        internal CodeList select(string code)
        {
            string txtQuery = string.Format("SELECT * FROM {0} WHERE code = '{1}'", this.tableName, code);

            try
            {
                CodeList data = new CodeList();
                using (SQLiteConnection c = new SQLiteConnection(sqlite.ConnectionString))
                {
                    c.Open();
                    using (SQLiteCommand cmd = new SQLiteCommand(txtQuery, c))
                    {
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
                        {
                            if (dr.Read())
                            {
                                data.id          = Convert.ToInt32(dr["id"]);
                                data.code        = dr["code"].ToString();;
                                data.description = dr["description"].ToString();
                            }
                        }
                    }
                }
                return(data);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #25
0
        private CodeValue GetAdministrativeUnitByName(string name)
        {
            NoarkClient noarkClient = documasterClients.GetNoarkClient();

            CodeList administrativeUnitCodeList = noarkClient.CodeLists("Saksmappe", "administrativEnhet").First();

            return(administrativeUnitCodeList.Values.Find(codeValue => codeValue.Name.Equals(name)));
        }
コード例 #26
0
        private CodeValue GetScreeningCodeByName(string name)
        {
            NoarkClient noarkClient = this.documasterClients.GetNoarkClient();

            CodeList screeningCodeList = noarkClient.CodeLists(null, "skjerming").First();

            return(screeningCodeList.Values.Find(codeValue => codeValue.Name.Equals(name)));
        }
コード例 #27
0
        public ActionResult DeleteConfirmed(int id)
        {
            CodeList codeList = db.Codes.Find(id);

            db.Codes.Remove(codeList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #28
0
        private CodeValue GetDocumentTypeByName(string name)
        {
            NoarkClient noarkClient = this.documasterClients.GetNoarkClient();

            CodeList documentTypeCodeList = noarkClient.CodeLists("Dokument", "dokumenttype").First();

            return(documentTypeCodeList.Values.Find(codeValue => codeValue.Name.Equals(name)));
        }
コード例 #29
0
        /// <summary>
        /// Return a given code list.
        /// </summary>
        /// <param name="org">The Organization code for the service owner.</param>
        /// <param name="service">The service code for the current service.</param>
        /// <param name="name">The name of the code list.</param>
        /// <returns>The code list.</returns>
        public CodeList GetCodeListByName(string org, string service, string name)
        {
            CodeList codeList = null;
            string   textData = File.ReadAllText(_settings.BaseResourceFolderContainer + _settings.GetCodeListFolder() + name + ".json");

            codeList = JsonConvert.DeserializeObject <CodeList>(textData);

            return(codeList);
        }
コード例 #30
0
        /// <summary>
        /// Return a given code list.
        /// </summary>
        /// <param name="org">The Organization code for the service owner.</param>
        /// <param name="service">The service code for the current service.</param>
        /// <param name="name">The name of the code list.</param>
        /// <returns>The code list.</returns>
        public CodeList GetCodeListByName(string org, string service, string name)
        {
            CodeList codeList = null;
            string   textData = File.ReadAllText(_settings.GetCodelistPath(org, service, AuthenticationHelper.GetDeveloperUserName(_httpContextAccessor.HttpContext)) + name + ".json");

            codeList = JsonConvert.DeserializeObject <CodeList>(textData);

            return(codeList);
        }
コード例 #31
0
ファイル: CodeListTests.cs プロジェクト: dur41d/sdmxdotnet
        public void CreateCodeList()
        {
            var codelist = new CodeList(new InternationalString("en", "Countries"), "CL_COUNTRY", "UIS");

            var code = new Code("CAN");
            code.Description["en"] = "Canada";
            codelist.Add(code);

            code = new Code("USA");
            code.Description["en"] = "United States of America";
            codelist.Add(code);

            var message = new StructureMessage();
            message.Header = new Header("MSD_HDR", new Party("UIS")) { Prepared = DateTime.Now };            
            message.CodeLists.Add(codelist);
            message.Save("CL_COUNTRY.xml");
        }
コード例 #32
0
ファイル: Attribute.cs プロジェクト: dur41d/sdmxdotnet
 public Attribute(Concept concept, CodeList codeList)
     : base(concept, codeList)
 {
 }
コード例 #33
0
ファイル: FunctionCode.cs プロジェクト: shaias/ironlangs
 public CodeList(WeakReference code, CodeList next) {
     Code = code;
     Next = next;
 }
コード例 #34
0
ファイル: Compiler.cs プロジェクト: wallymathieu/Prolog.NET
        private CodeTerm ConvertCodeList(CodeList codeList)
        {
            CodeTerm result = codeList.Tail;

            for (int index = codeList.Head.Count - 1; index >= 0; --index)
            {
                result = new CodeCompoundTerm(
                    CodeFunctor.ListFunctor,
                    new CodeTerm[] { codeList.Head[index], result });
            }

            return result;
        }
コード例 #35
0
ファイル: Dimension.cs プロジェクト: dur41d/sdmxdotnet
 public Dimension(Concept concept, CodeList codeList)
     : base(concept, codeList)
 {
 }
コード例 #36
0
 public CrossSectionalMeasure(Concept concept, CodeList codeList)
     : base(concept, codeList)
 {
 }
コード例 #37
0
        /// <summary>
        /// This method builds up a DdiInstance and writes it to a 
        /// valid DDI 3.1. XML file.
        /// </summary>
        public void BuildSomeDdiAndWriteToXml()
        {
            // It is helpful to set some default properties before
            // working with the SDK's model. These two properties
            // determine the default language and agency identifier
            // for every item.
            MultilingualString.CurrentCulture = "en-US";
            VersionableBase.DefaultAgencyId = "example.org";

            // Start out by creating a new DDIInstance.
            // The DdiInstance can hold StudyUnits, Groups, and ResourcePackages.
            DdiInstance instance = new DdiInstance();
            Instance = instance;
            instance.DublinCoreMetadata.Title.Current = "My First Instance";

            // Since we set the CurrentCulture to "en-US", that last line is
            // equivalent to this next one.
            instance.DublinCoreMetadata.Title["en-US"] = "My First Instance";

            // We can set multiple languages, if we want to.
            instance.DublinCoreMetadata.Title["fr"] = "TODO";

            // Add a ResourcePackage to the DdiInstance. There are three things to do.
            // 1. First, create it.
            // 2. Then, set whatever properties you like. Here, we just set the Title.
            // 3. Add the item to it's parent. In this case, that's the DdiInstance.
            ResourcePackage resourcePackage = new ResourcePackage();
            resourcePackage.DublinCoreMetadata.Title.Current = "RP1";
            instance.AddChild(resourcePackage);

            // Now let's add a ConceptScheme to the ResourcePackage. We'll do this
            // using the same three steps we used to create the ResourcePackage.
            ConceptScheme conceptScheme = new ConceptScheme();
            conceptScheme.ItemName.Current = "My Concepts";
            conceptScheme.Description.Current = "Just some concepts for testing.";
            resourcePackage.AddChild(conceptScheme);

            // Let's add some Concepts to the ConceptScheme.
            string[] conceptLabels = { "Pet", "Dog", "Cat", "Bird", "Fish", "Monkey" };
            foreach (string label in conceptLabels)
            {
                // Again, for each Concept we create, we want to perform the
                // same three steps as above:
                // 1. instantiate, 2. assign properties, 3. add to parent.
                Concept concept = new Concept();
                concept.Label.Current = label;
                conceptScheme.AddChild(concept);
            }

            // Let's create a collection of questions.
            QuestionScheme questionScheme = new QuestionScheme();
            questionScheme.ItemName.Current = "Sample Questions";
            resourcePackage.QuestionSchemes.Add(questionScheme);

            // First, we can ask for a name. This will just collect textual data.
            Question q1 = new Question();
            q1.QuestionText.Current = "What is your name?";
            q1.ResponseDomains.Add(new TextDomain());
            questionScheme.Questions.Add(q1);

            // Next, we can ask what method of transportation somebody used to get to Minneapolis.
            Question transportationQuestion = new Question();
            transportationQuestion.QuestionText.Current = "How did you get to Minneapolis?";

            // For this question, the respondent will choose from a list of answers.
            // Let's make that list.
            CategoryScheme catScheme = new CategoryScheme();
            resourcePackage.CategorySchemes.Add(catScheme);

            var codeScheme = new CodeList();
            resourcePackage.CodeSchemes.Add(codeScheme);

            // Add the first category and code: Airplane
            Category airplaneCategory = new Category();
            airplaneCategory.Label.Current = "Airplane";
            Code airplaneCode = new Code
            {
                Value = "0",
                Category = airplaneCategory
            };
            catScheme.Categories.Add(airplaneCategory);
            codeScheme.Codes.Add(airplaneCode);

            // Car
            Category carCategory = new Category();
            carCategory.ItemName.Current = "Car";
            Code carCode = new Code
            {
                Value = "1",
                Category = carCategory
            };
            catScheme.Categories.Add(carCategory);
            codeScheme.Codes.Add(carCode);

            // Train
            Category trainCategory = new Category();
            trainCategory.ItemName.Current = "Train";
            Code trainCode = new Code
            {
                Value = "2",
                Category = trainCategory
            };
            catScheme.Categories.Add(trainCategory);
            codeScheme.Codes.Add(trainCode);

            // Now that we have a Category and CodeScheme, we can create
            // a CodeDomain and assign this as the type of data the transportation
            // question will collect.
            CodeDomain codeDomain = new CodeDomain();
            codeDomain.Codes = codeScheme;
            transportationQuestion.ResponseDomains.Add(codeDomain);
            questionScheme.Questions.Add(transportationQuestion);

            // We have created a DdiInstance, a ResourcePackage, some concepts,
            // and some questions.
            //
            // Now what?
            //
            // Let's save all this to a DDI 3.1 XML file.
            //
            // First, we can call EnsureCompliance to make sure
            // our objects have all fields that are required
            // by the DDI 3.1 schemas. If we missed anything,
            // this method will fill in some defaults for us.
            DDIWorkflowSerializer.EnsureCompliance(instance);

            // Now, create the serializer object that will save our items to XML.
            // Setting UseConciseBoundedDescription to false makes sure we
            // write every item, and not just references to items.
            DDIWorkflowSerializer serializer = new DDIWorkflowSerializer();
            serializer.UseConciseBoundedDescription = false;

            // Getting a valid XML representation of our model is just one method call.
            XmlDocument xmlDoc = serializer.Serialize(instance);

            // Finally, save the XML document to a file.
            xmlDoc.Save("sample.xml");
        }
コード例 #38
0
ファイル: StructureTests.cs プロジェクト: dur41d/sdmxdotnet
 private static CodeList GetCountryCodeList()
 {
     var codeList = new CodeList(new InternationalString("en", "Countries"), "CL_Country", "SDMX");
     codeList.Add(new Code("Japan"));
     codeList.Add(new Code("USA"));
     codeList.Add(new Code("UK"));
     codeList.Add(new Code("Germany"));
     codeList.Add(new Code("Brazil"));
     return codeList;
 }
コード例 #39
0
ファイル: StructureTests.cs プロジェクト: dur41d/sdmxdotnet
 private static CodeList GetRegionsCodeList()
 {
     var codeList = new CodeList(new InternationalString("en", "Regions"), "CL_Regions", "SDMX");
     codeList.Add(new Code("Europe"));
     codeList.Add(new Code("North_America"));
     codeList.Add(new Code("Asia"));
     codeList.Add(new Code("Africa"));
     return codeList;
 }
コード例 #40
0
ファイル: FunctionCode.cs プロジェクト: atczyc/ironruby
        private static CodeList GetRootCodeNoUpdating(CodeList cur) {
            while (cur == _CodeCreateAndUpdateDelegateLock) {
                lock (_CodeCreateAndUpdateDelegateLock) {
                    // wait until enumerating thread is done, but it's alright
                    // if we got cur and then an enumeration started (because we'll
                    // just clear entries out)
                }

                cur = _CodeCreateAndUpdateDelegateLock;
            }
            return cur;
        }
コード例 #41
0
ファイル: PrimaryMeasure.cs プロジェクト: dur41d/sdmxdotnet
 public PrimaryMeasure(Concept concept, CodeList codeList)
     : base(concept, codeList)
 {
 }
コード例 #42
0
ファイル: Component.cs プロジェクト: dur41d/sdmxdotnet
 public Component(Concept concept, CodeList codeList)
 {
     this.Concept = concept;
     this.CodeList = codeList;
     this.TextFormat = DefaultTextFormat;
 }