public string GetXML() { StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").Append(HssStr.WinNextLine); sb.Append("<ElectionDocument xmlns:myObj=\"urn:myObj\">").Append(HssStr.WinNextLine); sb.Append("<AnnouncementName>").Append(this.AnnouncementName).Append("</AnnouncementName>").Append(HssStr.WinNextLine); sb.Append("<AnnouncementSender>").Append(this.AnnouncementSender).Append("</AnnouncementSender>").Append(HssStr.WinNextLine); sb.Append("<AnnouncementIdentifier>").Append(this.AnnouncementIdentifier).Append("</AnnouncementIdentifier>").Append(HssStr.WinNextLine); sb.Append("<AnnouncementDate>").Append(this.AnnouncementDate.ToString("yyyy-MM-ddThh:mm:ss")).Append("</AnnouncementDate>").Append(HssStr.WinNextLine); sb.Append(this.eventInfo.GetXML()); sb.Append("<DTC_PARTICIPANT_Election_INFORMATION>").Append(HssStr.WinNextLine); List <decimal> DTC_WHrate_list = new List <decimal>(this.DTC_participant_dic.Keys); DTC_WHrate_list.Sort(); foreach (decimal key_rate in DTC_WHrate_list) { Election_item ei = this.DTC_participant_dic[key_rate]; sb.Append(ei.GetXML()); } sb.Append("</DTC_PARTICIPANT_Election_INFORMATION>").Append(HssStr.WinNextLine); sb.Append("<RSH_Election_INFORMATION>").Append(HssStr.WinNextLine); List <decimal> RSH_WHrate_list = new List <decimal>(this.RSH_dic.Keys); RSH_WHrate_list.Sort(); foreach (decimal key_rate in RSH_WHrate_list) { Election_item ei = this.RSH_dic[key_rate]; sb.Append(ei.GetXML()); } sb.Append("</RSH_Election_INFORMATION>").Append(HssStr.WinNextLine); sb.Append("<CUSTODIAN_DETAILS>").Append(HssStr.WinNextLine); foreach (Custodian_ele ce in this.custodianEle_dic.Values) { sb.Append(ce.GetXML()); } sb.Append("</CUSTODIAN_DETAILS>").Append(HssStr.WinNextLine); sb.Append(summary.GetXML()); sb.Append("</ElectionDocument>").Append(HssStr.WinNextLine); return(sb.ToString()); }
/// <summary> /// Initialize all collection attributes using DTC Model Number /// </summary> private void Cal_initAttr_collections(HashSet <decimal> whr_hs, Dividend dvd) { int optNum = 0; foreach (decimal wh_rate in whr_hs) { Election_item item1 = new Election_item(optNum, wh_rate, "DTC_PARTICIPANT_ELECTION"); this.DTC_participant_dic[wh_rate] = item1; Election_item item2 = new Election_item(optNum, wh_rate, "RSH_ELECTION"); this.RSH_dic[wh_rate] = item2; Election_item item3 = new Election_item(optNum, wh_rate, "TOTAL_ELECTION"); this.summary.totalEle_dic[wh_rate] = item3; ++optNum; } int cEle_ID = 0; foreach (KeyValuePair <int, DividendCustodian> pair in this.dvdCus_dic_custodianType)//<CUSTODIAN_DETAILS> { int custodianID = pair.Key; DividendCustodian dvdCust = pair.Value; if (!dvdCust.Depositary.Value.Equals(this.dvdCust.Depositary.Value, StringComparison.OrdinalIgnoreCase)) { continue; } Custodian_ele ce = new Custodian_ele(); this.custodianEle_dic[custodianID] = ce; ce.ID = ++cEle_ID; ce.CUSTODIAN_NAME = dvdCust.Get_custodian_fullName(); ce.CUSTODIAN_REFERENCE = dvdCust.Custodian_Number.Value.ToString(); optNum = 0; foreach (decimal wh_rate in whr_hs) { Election_item item1 = new Election_item(optNum, wh_rate, "CUSTODIAN_ELECTION_OPTION"); ce.cust_dic[wh_rate] = item1; ++optNum; } } }
public Dictionary <decimal, Election_item> cust_dic = new Dictionary <decimal, Election_item>();//[WHRate] as key public string GetXML() { StringBuilder sb = new StringBuilder("<CUSTODIAN_ELECTION ID=\"" + this.ID + "\">").Append(HssStr.WinNextLine); sb.Append("<CUSTODIAN_REFERENCE>").Append(this.CUSTODIAN_REFERENCE).Append("</CUSTODIAN_REFERENCE>").Append(HssStr.WinNextLine); sb.Append("<CUSTODIAN_NAME>").Append(this.CUSTODIAN_NAME).Append("</CUSTODIAN_NAME>").Append(HssStr.WinNextLine); List <decimal> WHrate_list = new List <decimal>(this.cust_dic.Keys); WHrate_list.Sort(); foreach (decimal key_rate in WHrate_list) { Election_item ei = this.cust_dic[key_rate]; sb.Append(ei.GetXML()); } sb.Append("</CUSTODIAN_ELECTION>"); return(sb.ToString()); }
//public decimal DTC_participant_total = 0, RSH_total = 0; public string GetXML() { StringBuilder sb = new StringBuilder("<SUMMARY>").Append(HssStr.WinNextLine); sb.Append("<TOTAL_ELECTION_INFORMATION>").Append(HssStr.WinNextLine); List <decimal> WHrate_list = new List <decimal>(this.totalEle_dic.Keys); WHrate_list.Sort(); foreach (decimal key_rate in WHrate_list) { Election_item ei = this.totalEle_dic[key_rate]; sb.Append(ei.GetXML()); } sb.Append("</TOTAL_ELECTION_INFORMATION>").Append(HssStr.WinNextLine); sb.Append("<PRE_RELEASE_TOTAL>").Append((int)this.PRE_RELEASE_TOTAL).Append("</PRE_RELEASE_TOTAL>").Append(HssStr.WinNextLine); sb.Append("<WORKING_SUPPLY_TOTAL>").Append((int)this.WORKING_SUPPLY_TOTAL).Append("</WORKING_SUPPLY_TOTAL>").Append(HssStr.WinNextLine); sb.Append("</SUMMARY>").Append(HssStr.WinNextLine); return(sb.ToString()); }