コード例 #1
0
ファイル: AdvisorManager.cs プロジェクト: lhn16425/Projects
        public void SaveProfiles()
        {
            string xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                             + "<ListOfAllocationProfiles>";

            for (int i = 0; i < profilesGrid.Rows.Count - 1; i++)
            {
                AllocationProfile allocProfile = new AllocationProfile((string)profilesGrid[0, i].Value, (int)profilesGrid[1, i].Value);
                allocProfile.AllocationsFromString((string)profilesGrid[2, i].Value);
                xmlData += allocProfile.ToXmlString();
            }
            xmlData += "</ListOfAllocationProfiles>";
            ibClient.ClientSocket.replaceFA((int)FinancialAdvisorDataType.Profiles.Value, xmlData);
        }
コード例 #2
0
ファイル: XmlHelper.cs プロジェクト: abdulbasit15/Test
        private static List <AllocationProfile> GetProfilesList(XmlDocument xmlDocument)
        {
            List <AllocationProfile> advisorProfiles = new List <AllocationProfile>();
            XmlNode     profilesListNode             = xmlDocument.GetElementsByTagName(LIST_OF_PROFILES).Item(0);
            XmlNodeList profilesList = profilesListNode.ChildNodes;

            for (int i = 0; i < profilesList.Count; i++)
            {
                AllocationProfile allocationProfile = new AllocationProfile(profilesList.Item(i).ChildNodes[0].InnerText, Int32.Parse(profilesList.Item(i).ChildNodes[1].InnerText));
                XmlNodeList       allocationNodes   = profilesList[i].ChildNodes[2].ChildNodes;
                for (int j = 0; j < allocationNodes.Count; j++)
                {
                    allocationProfile.Allocations.Add(new Allocation(allocationNodes[j].ChildNodes[0].InnerText, Double.Parse(allocationNodes[j].ChildNodes[1].InnerText)));
                }
                advisorProfiles.Add(allocationProfile);
            }
            return(advisorProfiles);
        }