Question..how do I handle a null value

 

Parallel.ForEach( issues, x =>if(x.EtaDate.HasValue) x.EtaDate =
NodaTimeUtil.ConvertToMelbourneTimeZoneFromUtc(x.ETADate.Value));
...should this work?

 

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of anthonyatsmall...@mail.com
Sent: Monday, 19 May 2014 10:25 PM
To: 'ozDotNet'
Subject: RE: FW: linq and timezone conversion

 

mm..i never used a Parallel.ForEach......can you explain this function?

 

Parallel.ForEach( issues, x => x.EtaDate =
NodaTimeUtil.ConvertToMelbourneTimeZoneFromUtc(x.ETADate.Value));

 

The timezone will change depending on parameters so want to do this in code.

 

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of David Rhys Jones
Sent: Monday, 19 May 2014 10:11 PM
To: ozDotNet
Subject: Re: FW: linq and timezone conversion

 

Hi, 

you can't use local functions in a database query,   

your query would look like this, Select IssueId, IssueTitle, EtaDate =
?????? from vwIssues.

 

get all the data from the database with a .ToList();

 

then loop over the collection and call the method, you could even do this
with a parallel loop.

 

Parallel.ForEach( issues, x => x.EtaDate =
NodaTimeUtil.ConvertToMelbourneTimeZoneFromUtc(x.ETADate.Value));

 

Davy.




Davy,


"So you want to keep data which is local, only ever going to be local, only
needed locally, never accessed remotely, not WANTED to be made available
outside our building, which can only WEAKEN our security by being off site,
hosted offsite." BOFH: Simon Travaglia

 

 

On Mon, May 19, 2014 at 1:38 PM, <anthonyatsmall...@mail.com> wrote:



     var issues = from n in db.vwIssues

                         where n.IsDeleted == false & n.Archived == false

                         orderby n.ETADate descending,n.PriorityOrder
ascending, n.DateModified descending

                         select new IssueViewModel

                         {

                             IssueId = n.IssueId,

                             IssueTitle = n.IssueTitle,

                             ETADate =
NodaTimeUtil.ConvertToMelbourneTimeZoneFromUtc(n.ETADate.Value), //doesn't
like it

                             Status = n.StatusName,

                         };





How do i achieve the above requirement, ie change date to local time as date
in db is UTC





Anthony Salerno | Founder | SmallBiz Australia
Innovation | Web | Software | Developers | Support
+613 8400 4191 <tel:%2B613%208400%204191>  | 2Anthony (at) smallbiz.com.au
| Po Box 135, Lower Plenty
3093 ABN : 16 079 706 737 <tel:16%20079%20706%20737> 

www.smallbiz.com.au <http://www.smallbiz.com.au/>  |
www.linkedin.com/in/innovativetechnology
















 

<<attachment: winmail.dat>>

Reply via email to