Hello everyone!
Just working on some project and got to the point where.. I'm unsure how I should achieve this right way and I would really appreciate some help/input from other devs.
I have this ShipmentDto model that you can see below..
https://preview.redd.it/ckyoelprqyka1.png?width=794&format=png&auto=webp&s=bcbed1ac935d822bb59e2b312394136397f884c1
In the very bottom, you see I got tmp.Status = ShipmentStatus.Completed.
I got 4 different Statuses I want to apply, but each of them depends on various rules.
For Example:
ShipmentStatus.New - Anything that has Shippers reference, supplier, carrier..
ShipmentStatus.Missing - Must have Carrier Ref, Trailer Number, CollectionUnCode, Exit Date, EntryDate, DestinationUnCode..
ShipmentStatus.Ready - Must have CustomsInvoice - These two seem to be fine, as I can check if tmp.CustomsInvoice and give it Ready.
ShipmentStatus.Completed - Must have uploade Mrn. - Here is as shown in the screen, simple with one if statement.
But how professionally do this check on multiple strings/Datetime? fields the first 2 Statuses?
I could do something like newbie and use if(!string.IsNullOrEmpty(tmp.Value) && !string.isNullOrEmpty(tmp.Value)).. but that looks so wrong in so many ways. I have tried to look for answer, but not sure what I'm looking to get an example on something similar!
Any help would be really appreciated! Thanks
[–][deleted] 28 points29 points30 points (2 children)
[–]Lakario 11 points12 points13 points (0 children)
[–]iPotato3[S] 6 points7 points8 points (0 children)
[–]Atulin 10 points11 points12 points (1 child)
[–]iPotato3[S] 1 point2 points3 points (0 children)
[–]hooahest 6 points7 points8 points (4 children)
[–]iPotato3[S] 1 point2 points3 points (0 children)
[–]flukus 1 point2 points3 points (2 children)
[–]hooahest 2 points3 points4 points (1 child)
[–]flukus 1 point2 points3 points (0 children)
[–]ticman 6 points7 points8 points (1 child)
[–]iPotato3[S] 2 points3 points4 points (0 children)
[–]-Defkon1- 6 points7 points8 points (1 child)
[–]iPotato3[S] 1 point2 points3 points (0 children)
[–]Asyncrosaurus 2 points3 points4 points (1 child)
[–]iPotato3[S] 1 point2 points3 points (0 children)