Dear All,
I have a very complex scenario to solve. I have got the idea how to solve but I worried on the implementation part of in C#.
Let me explain my scenario. I have 2 table tblTranfer and tblTransferDetails
Sample data of tblTranfer from outletID=1 to outletID=2 and 3
tranferID outletFrom outletTo tranferDate tranferTime
1 1 2 16/4/09 1:00:00
2 1 3 16/4/09 2:00:00
3 1 2 17/4/09 1:00:00
4 1 3 18/4/09 2:00:00
Sample data of tblTransferDetails
tranferDetails transferID itemID itemQty itemPrice
1 1 1 2 200
2 2 1 2 200
3 3 1 2 800
4 4 1 2 900
Now upon receive the item in outletID=2
transferID=1 receive the average price is 200
then transferID=3 receive the average price now jump to 500 which wrong due to wrong price of item as 800.
Now the scenario is that from outletID=2 we transfer the goods out to now outletID=5 below is the tblTransfer and tblTransferDetails.
Sample data of tblTranfer from outletID=2 to outletID=5
tranferID outletFrom outletTo tranferDate tranferTime
1 2 5 20/4/09 1:00:00
Sample data of tblTransferDetails
tranferDetails transferID itemID itemQty itemPrice
1 1 1 2 500
So based on my scenario in this case there was a mistake in the pricing at transferID=3 from the first outletID=1 to outletID=2 and this mistake cause the average to go up. Thereafter this wrong price will be transfered to outletID=5 and this scenario can repeat many level but I just keep to 2 level.
So my solution is that once I change the price at the first place of the mistake I want the changes to be updated across all the other databases too. In this scenario each outletID is a separate database by itself.
My idea is that based on the date and time of the transferID first I go and search where I transfer then I come to outletID=2 then from here I will do a recursive search go further to outletID=5 and this can repeat recursively.
My problem here offcourse I have the idea to do it recursively but I also want to do all of this in a transaction so if one fail all will fail.
Can any one show me some light in terms of C# code how to implement my solution ? Thank you in advance.
I have a very complex scenario to solve. I have got the idea how to solve but I worried on the implementation part of in C#.
Let me explain my scenario. I have 2 table tblTranfer and tblTransferDetails
Sample data of tblTranfer from outletID=1 to outletID=2 and 3
tranferID outletFrom outletTo tranferDate tranferTime
1 1 2 16/4/09 1:00:00
2 1 3 16/4/09 2:00:00
3 1 2 17/4/09 1:00:00
4 1 3 18/4/09 2:00:00
Sample data of tblTransferDetails
tranferDetails transferID itemID itemQty itemPrice
1 1 1 2 200
2 2 1 2 200
3 3 1 2 800
4 4 1 2 900
Now upon receive the item in outletID=2
transferID=1 receive the average price is 200
then transferID=3 receive the average price now jump to 500 which wrong due to wrong price of item as 800.
Now the scenario is that from outletID=2 we transfer the goods out to now outletID=5 below is the tblTransfer and tblTransferDetails.
Sample data of tblTranfer from outletID=2 to outletID=5
tranferID outletFrom outletTo tranferDate tranferTime
1 2 5 20/4/09 1:00:00
Sample data of tblTransferDetails
tranferDetails transferID itemID itemQty itemPrice
1 1 1 2 500
So based on my scenario in this case there was a mistake in the pricing at transferID=3 from the first outletID=1 to outletID=2 and this mistake cause the average to go up. Thereafter this wrong price will be transfered to outletID=5 and this scenario can repeat many level but I just keep to 2 level.
So my solution is that once I change the price at the first place of the mistake I want the changes to be updated across all the other databases too. In this scenario each outletID is a separate database by itself.
My idea is that based on the date and time of the transferID first I go and search where I transfer then I come to outletID=2 then from here I will do a recursive search go further to outletID=5 and this can repeat recursively.
My problem here offcourse I have the idea to do it recursively but I also want to do all of this in a transaction so if one fail all will fail.
Can any one show me some light in terms of C# code how to implement my solution ? Thank you in advance.