Views: 3.7K
Replies: 0
Archived
|
VS 2008 - Product location management with strategy patternHi all experts!
I'm currently developing a WinMobile application for picking system. The user must have the possibility to change the positions of the products on the shelf (using the built in barcode reader); I would like to manage three different situations:
This is the code I've written so far: //Strategy public interface IChangeLocationStrategy { void Assign(PickLocation source, Location target); } //Context class public class PickLocation { public IChangeLocationStrategy ChangeLocationStrategy { get; set; } public Product Item { get; set; } public Location Bin { get; set; } public PickLocation() { } public void MoveToNewLocation(Location target) { ChangeLocationStrategy.Assign(this, target); } public void RemoveFromCurrentLocation() { ChangeLocationStrategy.Assign(this, null); } //the first concrete strategy class public class SyncAssignment : IChangeLocationStrategy { #region Change location strategy public void Assign(PickLocation source, Location target) { PickLocation newAllocation = new PickLocation(); newAllocation.Bin = target; newAllocation.Item = source.Item; } #endregion } Can anyone help me? Thanks! BARBON DARIO, Dec 14, 2012
|