|
Use DateTime.TryParse on your string to convert it into a date and time, then store it in your database in UTC format.
|
|
|
|
|
Don't forget that when storing a date string in Access it needs to be prefixed and suffixed with "#".
Just because we can; does not mean we should.
|
|
|
|
|
I am developing a ticketing system in C# where working hours are from 8:00am to 1:00:pm and from 3:00pm to 6:00pm
How can I check if the engineer was working on the ticket after working hours? And how can I check if part of his work was after working hours, let’s say he started working on the issue at 5:00pm but he closed on at 8pm so he has worked for 120 minutes after working hours.
Note: I have a field for ticket_openned and another field for ticket_closed
|
|
|
|
|
You just have to compare the time intervals to each other.
Make the process of comparisons into a simple process of comparing a single condition at a time. Start by checking if the ticket started and ended within the first part of the working day. If not, check if it ended before or started after. If not, check if it started before or ended after, and calculate the time outside that part of the working day. If any part of the ticket is after the first part of the working day, do the same comparisons against the second part of the working day for that part.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
well, i wish it was that easy
what if the engineer worked on this issue from 11am to 1pm and from 2pm from 8pm
so noon time he worked for 60minutes during non working hours (from 2pm to 3pm) and after 6pm he worked for 120minutes so he worked for total 180minutes.
how can i check that?
|
|
|
|
|
hello forum
i am spliting a string into parts on the occurance of characther a by using split method like
string a = "advanced";
string[] b = new string[10];
b=a.Split('a');
but by this method i m losing character a from the string array
it is returning
b[0]=
b[1]=dv
b[2]=nced
i want to get
b[0]=a
b[1]=dv
b[2]=a
b[3]=nced
can any body help me
regards
rahul adya
|
|
|
|
|
Unfortunaltely thats the way split works, you need to write some looping code to do what you require. Have a look at string.IndexOf
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
rahuladya wrote: string[] b = new string[10];
b=a.Split('a');
Why do you create an array and assign to the b variable, when you are assigning a new variable to it on the next line?
rahuladya wrote: i want to get
b[0]=a
b[1]=dv
b[2]=a
b[3]=nced
You can use a regular expression to split the string:
string a = "advanced";
string[] b = Regex.Split(a, "(a)");
Or for any string you like:
string a = "advanced";
string splitter = "a";
string[] b = Regex.Split(a, "(" + Regex.Escape(splitter) + ")");
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Nice one. Never thought of regex.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanx Guffa
it works very well...
regards
Rahul adya
|
|
|
|
|
hi
I am copying file from USB to my hard drive using C#.net Window application
now after copying i want to verify if copied file is same or not.Is there any way to verify it. or is there any way to generate HASH key of a file in order to verify it. As hash key is unique for every file.
Thanks In Advance
|
|
|
|
|
There are many hashing algorithms. Which one do you want to use? System.Security.Cryptography namespace contains hashing related classes.
|
|
|
|
|
Can u give me a sample code to fine hash key of one file
so that i can compare it with other to check if they r same or not.
thanks
|
|
|
|
|
You need to read file in byte array and call ComputeHash method of the hasher class you choose. MSDN has several examples, why don't you read the documentation?
|
|
|
|
|
It doesn't matter what .NET language you use, the method is the same.
The same thread, but in the VB forum[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How do you know you won't get errors when you read the file while hashing it that hides any errors caused by copying? :P
|
|
|
|
|
I will match the hash key of source file and target file
|
|
|
|
|
What Mark means (if I'm not mistaken) is that if you get a read error when you copy the file, you are likely to get the same read error when you verify the file. So you will only be verifying the write part of the copy operation, not the read part.
To truly verify the operation, you would have to create the hash code from the original data when the original file was created.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yep. Basically if you can't trust the USB disk to keep the data uncorrupted hashing when you read it won't help you. You'll just be checking that the Windows copy function works, which is kinda pointless.
|
|
|
|
|
|
1 vote countered with a 5.
|
|
|
|
|
|
public bool CompareFiles(string sourceFile, string destinationFile)
{
try
{
//Open our files for reading
Stream _sourceFile = File.OpenRead(sourceFile);
Stream _destinationFile = File.OpenRead(destinationFile);
//Create a new instance of one of the MD5 classes
MD5CryptoServiceProvider MD5Alg = new MD5CryptoServiceProvider();
//We will use the ComputeHash method to get our hash values of each file
byte[] SourceFileHash = MD5Alg.ComputeHash(_sourceFile);
byte[] DestinationFileHash = MD5Alg.ComputeHash(_destinationFile);
//Done reading so close the files
_sourceFile.Close();
_destinationFile.Close();
//Where going to use the BitConverter and convert the hash values into a string for a quick,
//down and dirty compare.
string SourceFileHashKey = BitConverter.ToString(SourceFileHash);
string DestinationFileHashKey = BitConverter.ToString(DestinationFileHash);
//Return the match
return (SourceFileHashKey == DestinationFileHashKey);
}
|
|
|
|
|
hey, i need to get folder alias from exchange 2003 using c#
i tried to use webdav and select query but i didnt succeed .
i'd like if some one can spill some light on this one
|
|
|
|
|
Hello everyone,
I am using VS 2008 and writing a console project. I add a new web reference to a web services and it is successful. I have found Web Reference folder is generated and there is a file called Reference.cs containing proxy class.
My question is, how to use the proxy class in Reference.cs? Add this cs file manually to my project? If yes, add to which folder of the project?
thanks in advance,
George
|
|
|
|