public void HandleRequest(IRequest request) { using (var scope = Db.CreateTransaction()) { var character = request.Session.Character; var documentId = request.Data.GetOrDefault <int>(k.ID); var bodyStr = request.Data.GetOrDefault <string>(k.body); var version = request.Data.GetOrDefault <int>(k.version); CorporationDocument corporationDocument; CorporationDocumentHelper.CheckRegisteredAccess(documentId, character, out corporationDocument, true).ThrowIfError(); version.ThrowIfLess(corporationDocument.version, ErrorCodes.DocumentVersionOld); corporationDocument.SetBody(bodyStr); corporationDocument.WriteBody().ThrowIfError(); var result = CorporationDocumentHelper.GenerateResultFromDocuments(new[] { corporationDocument }); //itt terjesztunk var registered = new List <Character> { corporationDocument._ownerCharacter }; registered.AddRange(CorporationDocumentHelper.GetRegisteredCharactersFromDocument(documentId)); Message.Builder.SetCommand(Commands.CorporationDocumentUpdateBody).WithData(result).ToCharacters(registered).Send(); scope.Complete(); } }
public void HandleRequest(IRequest request) { var character = request.Session.Character; var documentId = request.Data.GetOrDefault <int>(k.ID); CorporationDocument corporationDocument; CorporationDocumentHelper.CheckRegisteredAccess(documentId, character, out corporationDocument).ThrowIfError(); CorporationDocumentHelper.RegisterCharacterToDocument(documentId, character); #if DEBUG Message.Builder.FromRequest(request).WithOk().Send(); #endif }
public void HandleRequest(IRequest request) { var character = request.Session.Character; var documentIds = request.Data.GetOrDefault <int[]>(k.ID); documentIds.Length.ThrowIfLessOrEqual(0, ErrorCodes.WTFErrorMedicalAttentionSuggested); var documents = new List <CorporationDocument>(); foreach (var documentId in documentIds) { if (CorporationDocumentHelper.CheckRegisteredAccess(documentId, character, out var corporationDocument) != ErrorCodes.NoError) { continue; } corporationDocument.ReadBody(); documents.Add(corporationDocument); } var result = CorporationDocumentHelper.GenerateResultFromDocuments(documents); Message.Builder.FromRequest(request).WithData(result).Send(); }