ProcessRequestMessage(ANWI.Messaging.IMessagePayload p) { ANWI.Messaging.Request req = p as ANWI.Messaging.Request; switch (req.type) { case ANWI.Messaging.Request.Type.GetCommonData: { ANWI.Messaging.AllCommonData acd = new ANWI.Messaging.AllCommonData(); acd.ranks = Rank.FetchAll(); acd.rates = Rate.FetchAllRates(); acd.assignmentRoles = AssignmentRole.FetchAll(); acd.largeHulls = Hull.FetchLarge(); acd.smallHulls = Hull.FetchSmall(); acd.shipRoles = OperationRole.FetchAllShips(); acd.boatRoles = OperationRole.FetchAllBoats(); return(acd); } case ANWI.Messaging.Request.Type.GetProfile: { Profile profile = Profile.FetchById(req.id); return(new ANWI.Messaging.FullProfile(profile)); } case ANWI.Messaging.Request.Type.GetFleet: { List <LiteVessel> registry = LiteVessel.FetchRegistry(); return(new ANWI.Messaging.FullVesselReg(registry)); } case ANWI.Messaging.Request.Type.GetAvailableFleet: { List <LiteVessel> avail = LiteVessel.FetchAvailable(); return(new ANWI.Messaging.FullVesselReg(avail)); } case ANWI.Messaging.Request.Type.GetRoster: { List <LiteProfile> profiles = LiteProfile.FetchAll(); return(new ANWI.Messaging.FullRoster(profiles)); } case ANWI.Messaging.Request.Type.GetVesselDetail: { Vessel details = Vessel.FetchById(req.id); return(new ANWI.Messaging.FullVessel(details)); } case ANWI.Messaging.Request.Type.GetUnassignedRoster: { List <LiteProfile> unassigned = LiteProfile.FetchAllUnassigned(); return(new ANWI.Messaging.FullRoster(unassigned)); } case ANWI.Messaging.Request.Type.ChangeRank: { ANWI.Messaging.ReqExp.TwoIDs tid = req.detail as ANWI.Messaging.ReqExp.TwoIDs; return(ChangeRank(tid.id1, tid.id2)); } case ANWI.Messaging.Request.Type.DeleteRate: { ANWI.Messaging.ReqExp.TwoIDs tid = req.detail as ANWI.Messaging.ReqExp.TwoIDs; return(DeleteRate(tid.id1, tid.id2)); } case ANWI.Messaging.Request.Type.SetPrimaryRate: { ANWI.Messaging.ReqExp.TwoIDs tid = req.detail as ANWI.Messaging.ReqExp.TwoIDs; return(SetPrimaryRate(tid.id1, tid.id2)); } case ANWI.Messaging.Request.Type.ChangeName: { ANWI.Messaging.ReqExp.IdString ids = req.detail as ANWI.Messaging.ReqExp.IdString; return(ChangeNickname(ids.id, ids.str)); } case ANWI.Messaging.Request.Type.AddEquipment: { ANWI.Messaging.ReqExp.TwoIDs tid = req.detail as ANWI.Messaging.ReqExp.TwoIDs; return(AddEquipment(tid.id1, tid.id2)); } case ANWI.Messaging.Request.Type.RemoveEquipment: { ANWI.Messaging.ReqExp.TwoIDs tid = req.detail as ANWI.Messaging.ReqExp.TwoIDs; return(RemoveEquipment(tid.id1, tid.id2)); } } return(null); }