Beispiel #1
0
        public virtual ActionResult IndexSignatures(string username, MessageNotificationCodes messageStatus = MessageNotificationCodes.VoidMessage, string page = "")
        {
            var modelSignatures = Signatures.GetSignatures(username, page);

            if (messageStatus != MessageNotificationCodes.VoidMessage)
            {
                MessageConfiguration message = MessageHandler.setMessage(messageStatus, true, 5);
                ViewData["message"] = message;
            }

            return(View(modelSignatures));
        }
Beispiel #2
0
        public virtual ActionResult IndexFileSignatures(SignatureModel signature, HttpPostedFileBase file, string page = "")
        {
            var  messageStatus = MessageNotificationCodes.SaveDataSucessfully;
            bool saved         = false;

            var    filename    = Path.GetFileName(file.FileName);
            var    criteria    = DoccumentObject.Criteria(DoccumentObject.SIGNATURE, filename, string.Empty, string.Empty, string.Empty);
            string trusteeList = DoccumentObject.TrusteeList(DoccumentObject.SIGNATURE);

            byte[] fileStream = new byte[file.ContentLength];
            file.InputStream.Read(fileStream, 0, fileStream.Length);

            try
            {
                var searchSignatures = Signatures.GetSignatures(signature.UserId, page);

                if (searchSignatures.Count <= 0)
                {
                    var request = new UploadDocumentRequest
                    {
                        AccessInformation = AccessInformationCategoryEnum.CONFIDENTIAL,
                        FileName          = file.FileName,
                        FileStream        = fileStream,
                        OperationNumber   = IDBContext.Current.Operation,
                        BusinessAreaCode  = BusinessAreaCodeEnum.BA_SIGNATURES,
                        TrusteeList       = trusteeList
                    };
                    var createDocument = _documentManagementService.Upload(request);

                    if (createDocument.IsValid)
                    {
                        signature.DocumentReference = createDocument.DocumentNumber;

                        saved = Signatures.SaveSignatureByUser(signature);

                        if (!saved)
                        {
                            messageStatus = MessageNotificationCodes.SaveDataFail;
                        }
                    }
                    else
                    {
                        messageStatus = MessageNotificationCodes.SaveDataFail;
                    }

                    return(RedirectToAction("IndexSignatures", new { messageStatus = messageStatus }));
                }
                else
                {
                    messageStatus = MessageNotificationCodes.SignatureCreatedPreviously;

                    return(RedirectToAction("IndexCreationSignatures", new { messageStatus = messageStatus }));
                }
            }
            catch (Exception)
            {
                messageStatus = MessageNotificationCodes.SaveDataFail;
            }

            return(RedirectToAction("IndexSignatures", new { messageStatus = messageStatus }));
        }