DateTime issue with c#

  • (2 Pages)
  • +
  • 1
  • 2

26 Replies - 956 Views - Last Post: 11 July 2013 - 10:19 PM Rate Topic: -----

#16 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3616
  • View blog
  • Posts: 11,268
  • Joined: 05-May 12

Re: DateTime issue with c#

Posted 09 July 2013 - 12:23 AM

Using your source control system, compare the code the you had yesterday versus the code that you have today.

I've been burned enough times in the past by failing to press Ctrl-Z (Undo) enough times, or pressing Ctrl-Z too many times. Each time I though that I was at my previous running state when I actually was not. After too many late nights of bashing my head against the desk, I started using a source control system. Each time I get my code into a running state, I check in the code before I proceed to do anything else.
Was This Post Helpful? 0
  • +
  • -

#17 johnedcel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 01-July 13

Re: DateTime issue with c#

Posted 09 July 2013 - 12:44 AM

when i run it with localhost it works fine. but when i am testing it through soap web client that's the where the problem is.

but the code i used yesterday is the code i am using today. i didn't edit anything.

also i do have a back up of my code yesterday so that when a problem occurs i can run again that code but now even my back up is not working like it did yesterday.
Was This Post Helpful? 0
  • +
  • -

#18 optix212  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 27
  • View blog
  • Posts: 509
  • Joined: 10-October 09

Re: DateTime issue with c#

Posted 09 July 2013 - 04:46 AM

Use craploads of messageboxes and breakpoints to figure out what the values of your fields are whenever they may change. I usually always put a messagebox at the beginning of a method, and at the end. Same for if statements, just to see if my code is actually going into the if statement.
Was This Post Helpful? 0
  • +
  • -

#19 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3616
  • View blog
  • Posts: 11,268
  • Joined: 05-May 12

Re: DateTime issue with c#

Posted 09 July 2013 - 05:28 AM

Messageboxes aren't quite as useful when you are running on as a web service, but the sentiment is correct. Log4net is great for logging.

Based on johnedcel's description though, it sounds like he's narrowed things down to his query is not returning any results. It won't hurt either step through the code using a remote debugger, or add more logging.

Double check that the identity being used to run the application pool for your web service has permissions to perform the query. Try simplifying the query so that there are no constraints -- e.g. return everything.

This post has been edited by Skydiver: 09 July 2013 - 05:28 AM

Was This Post Helpful? 0
  • +
  • -

#20 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4526
  • View blog
  • Posts: 7,894
  • Joined: 08-June 10

Re: DateTime issue with c#

Posted 09 July 2013 - 08:54 AM

The other good thing is that in Dynamics you can use the Tracing Service from your plugin to write trace messages to the log files. Also, any trace messages that you write will show up in an error report as well.
Was This Post Helpful? 0
  • +
  • -

#21 johnedcel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 01-July 13

Re: DateTime issue with c#

Posted 09 July 2013 - 07:02 PM

i don't know if this is interesting or what. yesterday when i try to test the program it's not working(it's morning). then i try and try and try to debug what is the problem and then at 4 pm the program again runs smoothly. and then now again it's morning and then program again is not working. so i try to change the system time to 4 pm and boom it's working. what the hell is wrong with my code? it only runs at 4 pm!
Was This Post Helpful? 0
  • +
  • -

#22 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3616
  • View blog
  • Posts: 11,268
  • Joined: 05-May 12

Re: DateTime issue with c#

Posted 09 July 2013 - 07:28 PM

LOL! And if you look at your post #8, 16:00 hours is 4PM. Coincidence? :)

I think there maybe something wrong with the way ConditionalOperater.On is being used. Or there could simply be a bug in Dynamics where On is the same as Equal. I hope not.
Was This Post Helpful? 0
  • +
  • -

#23 johnedcel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 01-July 13

Re: DateTime issue with c#

Posted 09 July 2013 - 08:06 PM

exactly. and also the first time the program runs smooth is past 4 pm. though my team mate don't believe it. but is this really a coincidence? the first time the programs runs smooth is past 4, the next day the program doesn't return anything and at 4 pm again the program runs, and now again i try to run the program is doesn't work again so i change the time settings into 4 pm and the program runs again. is this really a coincidence or what? HAHA.
Was This Post Helpful? 0
  • +
  • -

#24 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3616
  • View blog
  • Posts: 11,268
  • Joined: 05-May 12

Re: DateTime issue with c#

Posted 09 July 2013 - 10:57 PM

Well, if you can make the data in the database to be at midnight instead of 4PM, I think that it should work for the entire day. :-)

Or perhaps converting your filter date to be in UTC instead of local time may make a differerence?
Was This Post Helpful? 0
  • +
  • -

#25 johnedcel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 01-July 13

Re: DateTime issue with c#

Posted 11 July 2013 - 07:37 PM

Hi again! the datetime is now working. now i what i want is that when the fields are null i want to return something like "No match found. Try again." how can i do that?
Was This Post Helpful? 0
  • +
  • -

#26 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3616
  • View blog
  • Posts: 11,268
  • Joined: 05-May 12

Re: DateTime issue with c#

Posted 11 July 2013 - 09:24 PM

What did you do to fix it? Does the 16:00 time have something to do with the Philippines being at +8 hours from UTC?

As for that kind of display string, that should be a something that is coded into your UI, not your business logic.

Sige!
Was This Post Helpful? 0
  • +
  • -

#27 johnedcel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 01-July 13

Re: DateTime issue with c#

Posted 11 July 2013 - 10:19 PM

well it seems that it is a bug or something. after i change the system date by 4:00pm to check if my theory is correct which is the program only runs at 4:00 onward. then i change back again the system time to the original time and then it's working until then the programs works fine. what do you mean by coded into your UI? because i tried to create an object then call it as a return but it is not working.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2