Created
July 6, 2012 08:15
-
-
Save lazarmarkov/3058884 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Gardio.GateKeeper.Attributes; | |
namespace Gardio.GateKeeper.DTO { | |
[ArmCommandMapping] | |
public class ArmCommandDTO : CommandDTO { | |
public String Login { get; set; } | |
public String Pincode { get; set; } | |
public ArmCommandDTO() { | |
} | |
public ArmCommandDTO(CustomUUID commandId, CustomUUID alarmUnitId, String login, String pincode) | |
: base(commandId, alarmUnitId) { | |
Login = login; | |
Pincode = pincode; | |
} | |
public override void Deserialize(Dictionary<String, String> form) { | |
base.Deserialize(form); | |
Login = form[Field.AuthLogin]; | |
Pincode = form[Field.AuthPincode]; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Gardio.GateKeeper.Attributes { | |
class MappingAttribute : Attribute{ | |
} | |
class CommandMappingAttribute : MappingAttribute{ | |
public String CommandId { get { return "command.id"; } } | |
public String AlarmUnitId { get { return "unit.id"; } } | |
} | |
class ArmCommandMappingAttribute : CommandMappingAttribute{ | |
public String AuthLogin { get { return "auth.login"; } } | |
public String AuthPincode { get { return "auth.pincode"; } } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Gardio.GateKeeper.Attributes; | |
namespace Gardio.GateKeeper.DTO{ | |
[CommandMapping] | |
public abstract class CommandDTO{ | |
public CustomUUID CommandId { get; set; } | |
public CustomUUID AlarmUnitId { get; set; } | |
protected CommandDTO(){ | |
} | |
protected CommandDTO(CustomUUID commandId, CustomUUID alarmUnitId) { | |
AlarmUnitId = alarmUnitId; | |
CommandId = commandId; | |
} | |
public virtual void Deserialize(Dictionary<String, String> form) { | |
CommandId = new CustomUUID(form[Field.CommandId]); | |
AlarmUnitId = new CustomUUID(form[Field.AlarmUnitId]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment