//PARS request xml
string xmlrequest = @"<?xml version=‘1.0‘ encoding=‘UTF-8‘?>
<Envelope xmlns:xsi=‘http://www.w3.org/2001/XMLSchema-instance‘ xsi:noNamespaceSchemaLocation=‘PARSRequest.xsd‘>
<Header>
<MessageSentDateTime>2008-05-09T19:28:54+08:00</MessageSentDateTime>
<MessageSequenceNumber>0</MessageSequenceNumber>
<MessageType>PARSRequest</MessageType>
<SourceSystemID>FIDS</SourceSystemID>
<DestinationSystemID>PA</DestinationSystemID>
<MessageOriginatorID>DCS</MessageOriginatorID>
<OriginatorDateTime>2008-05-09T19:28:54+08:00</OriginatorDateTime>
<MachineName></MachineName>
<LocalGate></LocalGate>
<UserName></UserName>
</Header>
<Body>
<PARSRequest>
<AnnouncementRepeatCount>2</AnnouncementRepeatCount>
<AnnouncementType>Boarding</AnnouncementType>
<AnnouncementZone>B</AnnouncementZone>
<FlightIdentity>CZ379</FlightIdentity>
<FlightRepeatCount>0</FlightRepeatCount>
<GateNumber>D62</GateNumber>
<ScheduledDate>2008-05-09+08:00</ScheduledDate>
<TerminalCode>2</TerminalCode>
</PARSRequest>
</Body>
</Envelope>";
private void btnPlay_Click(object sender, EventArgs e)
{
XmlDocument fltrequestDoc = new XmlDocument();
fltrequestDoc.LoadXml(xmlrequest);
//header
XmlNode nodeHeader = fltrequestDoc.SelectSingleNode("Envelope/Header");
nodeHeader.SelectSingleNode("MessageSentDateTime").InnerText = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
nodeHeader.SelectSingleNode("OriginatorDateTime").InnerText = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
nodeHeader.SelectSingleNode("MachineName").InnerText = frmParent.getMachinename();
nodeHeader.SelectSingleNode("LocalGate").InnerText = frmParent.getGate();
nodeHeader.SelectSingleNode("UserName").InnerText = frmParent.userloginedname;
//request
XmlNode nodeRequest = fltrequestDoc.SelectSingleNode("Envelope/Body/PARSRequest");
//request - play times
if (radioOnce.Checked == true)
{
nodeRequest.SelectSingleNode("AnnouncementRepeatCount").InnerText = "1";
}
if (radioTwice.Checked == true)
{
nodeRequest.SelectSingleNode("AnnouncementRepeatCount").InnerText = "2";
}
if (radioThreetimes.Checked == true)
{
nodeRequest.SelectSingleNode("AnnouncementRepeatCount").InnerText = "3";
}
nodeRequest.SelectSingleNode("AnnouncementType").InnerText = anncType;
nodeRequest.SelectSingleNode("FlightIdentity").InnerText = frmParent.fltinfo.Trim(‘ ‘);
nodeRequest.SelectSingleNode("FlightRepeatCount").InnerText = "";
//request - zones
if (radioLocalgate.Checked == true)
{
nodeRequest.SelectSingleNode("AnnouncementZone").InnerText = "A";
}
if (radioNearby.Checked == true)
{
nodeRequest.SelectSingleNode("AnnouncementZone").InnerText = "B";
}
if (radioPublic.Checked == true)
{
nodeRequest.SelectSingleNode("AnnouncementZone").InnerText = "C";
}
//request - language
if (checkboxCN.Checked == true)
{
XmlElement eleLang1 = fltrequestDoc.CreateElement("AnnouncementLanguage");
eleLang1.InnerText = "Chinese";
nodeRequest.AppendChild(eleLang1);
}
if (checkboxEN.Checked == true)
{
XmlElement eleLang2 = fltrequestDoc.CreateElement("AnnouncementLanguage");
eleLang2.InnerText = "English";
nodeRequest.AppendChild(eleLang2);
}
if (checkboxFR.Checked == true)
{
XmlElement eleLang3 = fltrequestDoc.CreateElement("AnnouncementLanguage");
eleLang3.InnerText = "French";
nodeRequest.AppendChild(eleLang3);
}
if (checkboxJP.Checked == true)
{
XmlElement eleLang4 = fltrequestDoc.CreateElement("AnnouncementLanguage");
eleLang4.InnerText = "Japanese";
nodeRequest.AppendChild(eleLang4);
}
if (checkboxKO.Checked == true)
{
XmlElement eleLang5 = fltrequestDoc.CreateElement("AnnouncementLanguage");
eleLang5.InnerText = "Korean";
nodeRequest.AppendChild(eleLang5);
}
if (anncType != null)
{
frmParent.sendMsg(fltrequestDoc.OuterXml);
}
else
{
MessageBox.Show("请选择广播类型!");
}
}