//bookViewModel 및 childBook , instrument 를 초기화 하는 부분 from xmlfile public void setFromXml(System.Xml.XmlNode InstNode) { this.Node_ = InstNode; //InstNode["book"]["bookInfo"]; System.Xml.XmlNode bookInfoNode = InstNode["bookInfo"]; this.abstractFlag_ = bookInfoNode["abstract"].InnerText; string isExpandStr = bookInfoNode["isTreeExpand"].InnerText; if (isExpandStr.ToUpper() == "TRUE" || isExpandStr.ToUpper() == "T") { this.isTreeExpand_ = true; } else { this.isTreeExpand_ = false; } this.bookName_ = bookInfoNode["bookName"].InnerText; this.bookCode_ = bookInfoNode["bookCode"].InnerText; if (this.abstractFlag_.ToUpper() != "TRUE" && this.abstractFlag_.ToUpper() != "T") { System.Xml.XmlNodeList instrumentListNodeList = InstNode["instrumentList"].SelectNodes("instrument"); foreach (System.Xml.XmlNode item in instrumentListNodeList) { string instCode = item.InnerText; //Excel_instrumentViewModel instrument = new Excel_instrumentViewModel(); //instrument.Item_code_ = instCode; //this.instrumentList_.Add(instrument); if (MasterInformationViewModel.masterPositionMap_.ContainsKey(instCode)) { this.instrumentList_.Add(MasterInformationViewModel.masterPositionMap_[instCode]); } else { this.instrumentList_.Add(new Excel_instrumentViewModel()); } } } foreach (System.Xml.XmlNode item in InstNode.SelectNodes("book")) { BookViewModel childBook = new BookViewModel(this); childBook.setFromXml(item); this.childBookList_.Add(childBook); } }
// book 에 있는 position들을 load함. public void loadPosition() { this.bookXml_ = new XmlDocument(); this.childBookList_ = new ObservableCollection <BookViewModel>(); this.childBookList_.Add(this.ancestorBookViewModel_); //string bookPath = @"D:\Project File\OTCDerivativesCalculatorModule\Excel_Interface2\OutLook\"; bookXml_.Load(bookPath_ + "\\" + "XMLFile1.xml"); System.Xml.XmlNode positionFolderNode = bookXml_["positionFolder"]; this.ancestorBookViewModel_.Node_ = positionFolderNode; System.Xml.XmlNode bookInfoNode = positionFolderNode["bookInfo"]; this.ancestorBookViewModel_.IsTreeExpand_ = Convert.ToBoolean(bookInfoNode["isTreeExpand"].InnerText); this.ancestorBookViewModel_.BookName_ = bookInfoNode["bookName"].InnerText; this.ancestorBookViewModel_.BookCode_ = bookInfoNode["bookCode"].InnerText; foreach (System.Xml.XmlNode item in positionFolderNode.SelectNodes("book")) { BookViewModel childBook = new BookViewModel(this.ancestorBookViewModel_); childBook.setFromXml(item); this.ancestorBookViewModel_.ChildBookList_.Add(childBook); } }
// book 에 있는 position들을 load함. public void loadPosition() { this.bookXml_ = new XmlDocument(); this.childBookList_ = new ObservableCollection<BookViewModel>(); this.childBookList_.Add(this.ancestorBookViewModel_); //string bookPath = @"D:\Project File\OTCDerivativesCalculatorModule\Excel_Interface2\OutLook\"; bookXml_.Load(bookPath_ + "\\" +"XMLFile1.xml"); System.Xml.XmlNode positionFolderNode = bookXml_["positionFolder"]; this.ancestorBookViewModel_.Node_ = positionFolderNode; System.Xml.XmlNode bookInfoNode = positionFolderNode["bookInfo"]; this.ancestorBookViewModel_.IsTreeExpand_ = Convert.ToBoolean(bookInfoNode["isTreeExpand"].InnerText); this.ancestorBookViewModel_.BookName_ = bookInfoNode["bookName"].InnerText; this.ancestorBookViewModel_.BookCode_ = bookInfoNode["bookCode"].InnerText; foreach (System.Xml.XmlNode item in positionFolderNode.SelectNodes("book")) { BookViewModel childBook = new BookViewModel(this.ancestorBookViewModel_); childBook.setFromXml(item); this.ancestorBookViewModel_.ChildBookList_.Add(childBook); } }
//bookViewModel 및 childBook , instrument 를 초기화 하는 부분 from xmlfile public void setFromXml(System.Xml.XmlNode InstNode) { this.Node_ = InstNode; //InstNode["book"]["bookInfo"]; System.Xml.XmlNode bookInfoNode = InstNode["bookInfo"]; this.abstractFlag_ = bookInfoNode["abstract"].InnerText; string isExpandStr = bookInfoNode["isTreeExpand"].InnerText; if (isExpandStr.ToUpper() == "TRUE" || isExpandStr.ToUpper() == "T") { this.isTreeExpand_ = true; } else { this.isTreeExpand_ = false; } this.bookName_ = bookInfoNode["bookName"].InnerText; this.bookCode_ = bookInfoNode["bookCode"].InnerText; if (this.abstractFlag_.ToUpper() != "TRUE" && this.abstractFlag_.ToUpper() != "T") { System.Xml.XmlNodeList instrumentListNodeList = InstNode["instrumentList"].SelectNodes("instrument"); foreach (System.Xml.XmlNode item in instrumentListNodeList) { string instCode = item.InnerText; //Excel_instrumentViewModel instrument = new Excel_instrumentViewModel(); //instrument.Item_code_ = instCode; //this.instrumentList_.Add(instrument); if (MasterInformationViewModel.masterPositionMap_.ContainsKey(instCode)) { this.instrumentList_.Add(MasterInformationViewModel.masterPositionMap_[instCode]); } else { this.instrumentList_.Add(new Excel_instrumentViewModel()); } } } foreach (System.Xml.XmlNode item in InstNode.SelectNodes("book")) { BookViewModel childBook = new BookViewModel(this); childBook.setFromXml(item); this.childBookList_.Add(childBook); } }