|
I want to do a .Select for the rest of the fields: EventStatus, EventReason, and EventDateTime like I'm doing for the TrackingEvent and am not sure how to do that. Richard Deeming was helpful in get me started with this but need help with the rest.
TrackingEventHistory is the root for XML element I'm trying to output. The rest (EventStatus, EventReason, EventDateTime) are "children" within that root. There can be multiple TrackingEventHistory's so I'm trying to create a loop for the root and it's children. I'm not sure if .Select is the best way.
new XElement("TrackingEventHistory",
prc.History.Cast<Saia.Data.General.Shipment.HistoryItem>().Select(item => new XElement("TrackingEventDetail",
new XElement("EventStatus", EventCode.Delivered.ToXml()),
new XElement("EventReason", prc.History),
new XElement("EventDateTime", prc.History))
modified 26-Sep-17 17:31pm.
|
|
|
|
|
Rather than wasting your time getting stuck, posting a question and waiting for a reply, you should take some time to learn the basics of how XLINQ works. Fortunately for you, Sacha Barber wrote an excellent article on this topic. You can find it here[^].
This space for rent
|
|
|
|
|
Would something like this work
var query = (from c in doc.Root.Descendants("TrackingEvent") select c).ToList();
foreach (XElement element in query)
{
new XElement("EventStatus", EventCode.Delivered.ToXml()),
Response.Write(element.Value);
}
|
|
|
|
|
Why not try it and find out?
This space for rent
|
|
|
|
|
If you haven't downloaded it yet, you really should try out Linqpad[^]. Here's guidance[^] on how to query XLinq in it.
This space for rent
|
|
|
|
|
Why interfaces not extended and implemented?
|
|
|
|
|
|
|
Picture this.
You just walked into a room, containing a bunch of people who don't know you, and said "Why interfaces not extended and implemented?" and then you left.
Now, everyone in the room is looking at each other, very confused, having no idea what in the f*** you're blabbering about.
Care to elaborate on what you're asking about? You know, like so someone might be able to answer you.
|
|
|
|
|
Do you really think you are good advisor?
Just look at Griff Sir answer.
if you can't do that then don't touch the message, get back to your seat and do your work.
modified 26-Sep-17 23:48pm.
|
|
|
|
|
So you wanted me to guess at what you meant?
I could have and just as easily got it wrong and answered your "question" with incorrect information.
|
|
|
|
|
dont reply on message again like this.I will call authority. This message is not for people like you. ignore this message.
|
|
|
|
|
Go ahead. Call the police.
Would you like me to hand you the phone? Here you go.[^]
|
|
|
|
|
don't expect from me the person who needs to this will do it.
|
|
|
|
|
I could have sworn you said "I will call authority".
|
|
|
|
|
Interfaces can't be extended because they are a very specific contract, and they contain no base material to override - they cannot define any concrete code at all, they just provide a set of signatures (methods, properties, events) which the implementing class is obliged to create in a concrete form as it's part of the contract.
They can't contain any implementation themselves, because that would make them abstract classes and provide a route to multiple inheritance which C# is absolutely not happy with - because it seriously complicates the source code.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I don't know why some people here post some abusive words and make me feel bad. I don't want to look at that replies.
I am seeing only good people replies.
Thank You so much Griff Sir. It is the only reason i am following to you because you better than better expert on code project.
|
|
|
|
|
|
He won't reply to you as you did not spoon feed him an answer, like sir Griff did. You expect him to go and do some research.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Ah well, once a help vampire always a help vampire.
|
|
|
|
|
Wow he disappeared quickly, I wonder if he jumped or was pushed.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Ah thats funny, so he jumped AGAIN.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
StringBuilder strUserGroups = new StringBuilder();
foreach (IdentityReference userGroup in WindowsIdentity.GetCurrent().Groups) {
try { strUserGroups.AppendLine(userGroup.Translate(typeof(NTAccount)).Value); }
catch (Exception) { }
}
textBox1.Text = strUserGroups.ToString().Trim();
strUserGroups = null;
Output from program that's not been elevated
Quote: Everyone
BUILTIN\Performance Log Users
BUILTIN\Users
NT AUTHORITY\INTERACTIVE
CONSOLE LOGON
NT AUTHORITY\Authenticated Users
NT AUTHORITY\This Organization
MicrosoftAccount\hidden
NT AUTHORITY\Local account
LOCAL
NT AUTHORITY\Cloud Account Authentication
Output from program running as an elevated program
Quote: Everyone
NT AUTHORITY\Local account and member of Administrators group
BUILTIN\Administrators
BUILTIN\Performance Log Users
BUILTIN\Users
NT AUTHORITY\INTERACTIVE
CONSOLE LOGON
NT AUTHORITY\Authenticated Users
NT AUTHORITY\This Organization
MicrosoftAccount\hidden
NT AUTHORITY\Local account
LOCAL
NT AUTHORITY\Cloud Account Authentication
Note the two items I made bold in the above text block, they aren't there in the first one. Why? My user is part of the Administrator's user group. It seems that those two user groups only show up when the program is elevated. Why is that?
Tom Parkison
|
|
|
|
|
Security reasons.
Would you want some normal user being able to get all the group memberships for any ID in the system?
I would want that information kept private so I don't have hackers going after certain accounts.
|
|
|
|