public void HandleRequest(IRequest request) { using (var scope = Db.CreateTransaction()) { var character = request.Session.Character; var documentId = request.Data.GetOrDefault <int>(k.ID); CorporationDocumentHelper.CheckOwnerAccess(documentId, character, out var corporationDocument).ThrowIfError(); corporationDocument.Delete().ThrowIfError(); corporationDocument.DeleteAllRegistered(); var registered = CorporationDocumentHelper.GetRegisteredCharactersFromDocument(documentId).ToList(); //beleaddoljuk azt is aki letorolte, meg mindenkit aki epp nezi if (!registered.Contains(character)) { registered.Add(character); } CorporationDocumentHelper.DeleteViewerByDocumentId(documentId); var result = CorporationDocumentHelper.GetMyDocumentsToDictionary(character); Message.Builder.SetCommand(request.Command).WithData(result).ToCharacters(registered).Send(); scope.Complete(); } }
public void HandleRequest(IRequest request) { using (var scope = Db.CreateTransaction()) { var character = request.Session.Character; var documentId = request.Data.GetOrDefault<int>(k.ID); var targetCharacter = Character.Get(request.Data.GetOrDefault<int>(k.target)); character.GetPrivateCorporationOrThrow(); character.IsFriend(targetCharacter).ThrowIfFalse(ErrorCodes.CharacterIsNotAFriend); CorporationDocument corporationDocument; CorporationDocumentHelper.CheckOwnerAccess(documentId, character, out corporationDocument).ThrowIfError(); //check amount and stuff CorporationDocumentHelper.OnDocumentTransfer(corporationDocument, targetCharacter).ThrowIfError(); corporationDocument._ownerCharacter = targetCharacter; corporationDocument.UpdateOwnerToSql().ThrowIfError(); //unregister document and all viewer character CorporationDocumentHelper.DeleteViewerByDocumentId(documentId); var targetResult = CorporationDocumentHelper.GetMyDocumentsToDictionary(targetCharacter); var senderResult = CorporationDocumentHelper.GetMyDocumentsToDictionary( character); Message.Builder.FromRequest(request).WithData(senderResult).Send(); Message.Builder.SetCommand(request.Command).WithData(targetResult).ToCharacter(targetCharacter).Send(); scope.Complete(); } }
public void HandleRequest(IRequest request) { var character = request.Session.Character; var result = CorporationDocumentHelper.GetMyDocumentsToDictionary(character); Message.Builder.FromRequest(request).WithData(result).Send(); }