Exemplo n.º 1
0
        internal FixedList <SignEvent> Execute(SignTask task)
        {
            Assertion.AssertObject(task, "task");

            this.EnsureValidCredentials(task.SignCredentials);

            var eventsList = new List <SignEvent>(task.SignRequests.Count);

            using (var context = StorageContext.Open()) {
                foreach (var request in task.SignRequests)
                {
                    SignEvent signEvent = CreateSignEvent(task, request);

                    context.Watch(request);

                    signEvent.Save();
                    request.Save();

                    eventsList.Add(signEvent);
                }

                context.Update();
            } // using

            return(eventsList.ToFixedList());
        }
Exemplo n.º 2
0
 private void UpdateStatus(SignEvent signEvent)
 {
     if (signEvent.EventType == SignEventType.Signed)
     {
         this.SignStatus  = SignStatus.Signed;
         this.DigitalSign = signEvent.DigitalSign;
         this.SignTime    = signEvent.Timestamp;
     }
     else if (signEvent.EventType == SignEventType.Revoked)
     {
         this.SignStatus  = SignStatus.Revoked;
         this.DigitalSign = String.Empty;
         this.SignTime    = ExecutionServer.DateMaxValue;
     }
     else if (signEvent.EventType == SignEventType.Refused)
     {
         this.SignStatus  = SignStatus.Refused;
         this.DigitalSign = String.Empty;
         this.SignTime    = signEvent.Timestamp;
     }
     else if (signEvent.EventType == SignEventType.Unrefused)
     {
         this.SignStatus  = SignStatus.Pending;
         this.DigitalSign = String.Empty;
         this.SignTime    = signEvent.Timestamp;
     }
 }
Exemplo n.º 3
0
        static internal void AppendSignEvent(SignEvent o)
        {
            var op = DataOperation.Parse("apdEOPSignEvent", o.Id, o.UID,
                                         o.SignRequest.Id, (char)o.EventType,
                                         o.DigitalSign, o.Timestamp,
                                         o.Integrity.GetUpdatedHashCode());

            DataWriter.Execute(op);
        }
Exemplo n.º 4
0
 static internal SignEventDTO Map(SignEvent signEvent)
 {
     return(new SignEventDTO {
         uid = signEvent.UID,
         eventType = signEvent.EventType.ToString(),
         timeStamp = signEvent.Timestamp,
         signRequest = Map(signEvent.SignRequest)
     });
 }
Exemplo n.º 5
0
        internal SignEvent Unrefuse()
        {
            Assertion.Assert(this.SignStatus == SignStatus.Refused,
                             "Unrefuse is allowed only to requests with refused status.");

            var signEvent = new SignEvent(SignEventType.Unrefused, this);

            this.UpdateStatus(signEvent);

            return(signEvent);
        }
Exemplo n.º 6
0
        internal SignEvent Revoke()
        {
            Assertion.Assert(this.SignStatus == SignStatus.Signed,
                             "Revoke is allowed only to requests with signed status.");

            var signEvent = new SignEvent(SignEventType.Revoked, this);

            this.UpdateStatus(signEvent);

            return(signEvent);
        }
Exemplo n.º 7
0
        internal SignEvent Sign(string digitalSign)
        {
            Assertion.Assert(this.SignStatus == SignStatus.Pending || this.SignStatus == SignStatus.Revoked,
                             "Sign is allowed only to requests in pending or revoked status.");

            // ToDo: Ensure digitalSign is valid for RequestedTo user and Document.SignInputData

            var signEvent = new SignEvent(SignEventType.Signed, this, digitalSign);

            this.UpdateStatus(signEvent);

            return(signEvent);
        }