Click here to Skip to main content
15,884,099 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming19-Sep-17 5:57
mveRichard Deeming19-Sep-17 5:57 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 6:05
Bootzilla3319-Sep-17 6:05 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 9:58
Bootzilla3319-Sep-17 9:58 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
eddieangel19-Sep-17 12:18
eddieangel19-Sep-17 12:18 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3320-Sep-17 2:56
Bootzilla3320-Sep-17 2:56 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming20-Sep-17 10:01
mveRichard Deeming20-Sep-17 10:01 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 3:58
Bootzilla3321-Sep-17 3:58 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 4:32
mveRichard Deeming21-Sep-17 4:32 
1) It's not clear what you're trying to do here. You're not adding an element for each history item, so you don't need the Select; you just need to pass in the correct values to the elements.
C#
rspxml.Root.Add(new XElement("PickupDueDateDetails"),
    new XElement("Date", prc.PickupDueDate),
    new XElement("UTCOffset", prc.PickupDueDateOffset)
);



2) You can't just change the type and expect the existing code to work. You need to fix the existing code to use the correct methods for the type.

For example, this:
C#
XmlDocument doc = new XmlDocument();
doc.XmlResolver = null;
doc.LoadXml(xmlRequest);
would become:
C#
XDocument doc = XDocument.Parse(xmlResult);

This:
C#
string method = doc.FirstChild.Name;
XmlNode mainNode = doc.FirstChild;

if (method.ToLower() == "xml")
{
    method = doc.FirstChild.NextSibling.Name;
    mainNode = doc.FirstChild.NextSibling;
}
would become:
C#
XElement mainNode = doc.Root;
string method = mainNode.Name.LocalName;
// No need to check for the processing instruction here...

This:
C#
string pronum = mainNode.SelectSingleNode("TrackingNumber").InnerText;
would become:
C#
string pronum = (string)mainNode.Element("TrackingNumber");


3) I don't know. Does it compile? Does it do what you expect it to do?

I very much doubt that prc.History is the correct property to use for all of those elements.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 4:52
Bootzilla3321-Sep-17 4:52 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 5:18
mveRichard Deeming21-Sep-17 5:18 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 5:41
Bootzilla3321-Sep-17 5:41 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 6:07
mveRichard Deeming21-Sep-17 6:07 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 6:15
Bootzilla3321-Sep-17 6:15 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 6:19
mveRichard Deeming21-Sep-17 6:19 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 6:40
Bootzilla3321-Sep-17 6:40 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 18:19
Bootzilla3321-Sep-17 18:19 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3322-Sep-17 2:54
Bootzilla3322-Sep-17 2:54 
AnswerRe: How to handle multiple exceptions(Try..Catch) Pin
eddieangel19-Sep-17 6:07
eddieangel19-Sep-17 6:07 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 6:14
Bootzilla3319-Sep-17 6:14 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
eddieangel19-Sep-17 6:30
eddieangel19-Sep-17 6:30 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 6:58
Bootzilla3319-Sep-17 6:58 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
eddieangel19-Sep-17 7:17
eddieangel19-Sep-17 7:17 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 7:28
Bootzilla3319-Sep-17 7:28 
QuestionXSL to get only elements which have no childs Pin
MrKBA18-Sep-17 23:27
MrKBA18-Sep-17 23:27 
AnswerRe: XSL to get only elements which have no childs Pin
Pete O'Hanlon18-Sep-17 23:49
mvePete O'Hanlon18-Sep-17 23:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.