Skip to content

Commit cb95823

Browse files
Merge pull request #75 from TransactionProcessing/task/#66_addlogging
Change to date time handling
2 parents bd7552f + fb8dd82 commit cb95823

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

TransactionProcessor.DataGenerator/TransactionProcessing.DataGeneration/TransactionDataGenerator.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using EstateManagement.DataTransferObjects;
1010
using EstateManagement.DataTransferObjects.Requests;
1111
using EstateManagement.DataTransferObjects.Responses;
12+
using Microsoft.VisualBasic;
1213
using Newtonsoft.Json;
1314
using SecurityService.Client;
1415
using SecurityService.DataTransferObjects.Responses;
@@ -694,12 +695,20 @@ private ProductType GetProductType(String operatorName){
694695
}
695696

696697
private DateTime GetTransactionDateTime(DateTime dateTime){
697-
// Generate the time
698-
Int32 hours = this.r.Next(0, 23);
699-
Int32 minutes = this.r.Next(0, 59);
700-
Int32 seconds = this.r.Next(0, 59);
701698

702-
return dateTime.AddHours(hours).AddMinutes(minutes).AddSeconds(seconds);
699+
if (dateTime.Hour != 0 && dateTime.Minute != 0 && dateTime.Second != 0){
700+
// Already have a time only change the seconds
701+
Int32 seconds = this.r.Next(0, 59);
702+
return dateTime.AddSeconds(seconds);
703+
}
704+
else{
705+
// Generate the time
706+
Int32 hours = this.r.Next(0, 23);
707+
Int32 minutes = this.r.Next(0, 59);
708+
Int32 seconds = this.r.Next(0, 59);
709+
710+
return dateTime.AddHours(hours).AddMinutes(minutes).AddSeconds(seconds);
711+
}
703712
}
704713
private Int32 GetTransactionNumber(){
705714
this.TransactionNumber++;

0 commit comments

Comments
 (0)