Exemple #1
0
        // Token: 0x06001999 RID: 6553 RVA: 0x0005A2D8 File Offset: 0x000584D8
        internal static CreateAttachmentResponse CreateAttachment(CallContext callContext, CreateAttachmentRequest translatedRequest)
        {
            CreateAttachmentHelper.UpdateContentType(callContext);
            CreateAttachmentResponse result;

            using (CreateAttachment createAttachment = new CreateAttachment(callContext, translatedRequest))
            {
                if (!createAttachment.PreExecute())
                {
                    result = null;
                }
                else
                {
                    ServiceResult <AttachmentType> currentStepResult;
                    try
                    {
                        currentStepResult = createAttachment.Execute();
                    }
                    catch (LocalizedException exception)
                    {
                        currentStepResult = ExceptionHandler <AttachmentType> .GetServiceResult <AttachmentType>(exception, null);
                    }
                    createAttachment.SetCurrentStepResult(currentStepResult);
                    result = (CreateAttachmentResponse)createAttachment.PostExecute();
                }
            }
            return(result);
        }
Exemple #2
0
        public CreateAttachment convertCustomerObjectToAttachment(CustomObject obj)
        {
            CreateAttachment attachmentToReturn = new CreateAttachment();

            attachmentToReturn.ModifiedBy   = obj.CreatedBy;
            attachmentToReturn.CreatedBy    = obj.CreatedBy;
            attachmentToReturn.Remarks      = obj.Remarks;
            attachmentToReturn.Type         = obj.Type;
            attachmentToReturn.AttachedPath = obj.AttachedPath;
            attachmentToReturn.Path         = configuration.GetSection("AttachmentPath:Path").Value;
            if (!string.IsNullOrEmpty(obj.ID))
            {
                attachmentToReturn.ID = Convert.ToInt64(obj.ID);
            }
            if (!string.IsNullOrEmpty(obj.ProductAttachmentID))
            {
                attachmentToReturn.ProductAttachmentID = Convert.ToInt64(obj.ProductAttachmentID);
            }
            if (!string.IsNullOrEmpty(obj.DocumentID))
            {
                attachmentToReturn.DocumentID = Convert.ToInt64(obj.DocumentID);
            }

            if (!string.IsNullOrEmpty(obj.Serial))
            {
                attachmentToReturn.Serial = Convert.ToInt64(obj.Serial);
            }
            if (obj.IsReceived == "true")
            {
                attachmentToReturn.IsReceived = 1;
            }
            if (obj.File != null)
            {
                attachmentToReturn.IsReceived = 1;
                attachmentToReturn.File       = obj.File;
            }
            if (!string.IsNullOrEmpty(obj.ClaimID))
            {
                attachmentToReturn.ClaimID = Convert.ToInt64(obj.ClaimID);
            }
            if (!string.IsNullOrEmpty(obj.RiskID))
            {
                attachmentToReturn.RiskID = Convert.ToInt64(obj.RiskID);
            }
            if (!string.IsNullOrEmpty(obj.Level))
            {
                attachmentToReturn.Level = Convert.ToInt64(obj.Level);
            }
            attachmentToReturn.ReceivedDate     = DateTime.Now;
            attachmentToReturn.ModificationDate = DateTime.Now;


            return(attachmentToReturn);
        }
        public IApiResult Create(CreateAttachment operation)
        {
            var result = operation.ExecuteAsync().Result;

            if (result is ValidationsOutput)
            {
                return(new ApiResult <List <ValidationItem> >()
                {
                    Data = ((ValidationsOutput)result).Errors
                });
            }
            else
            {
                return(new ApiResult <object>()
                {
                    Status = ApiResult <object> .ApiStatus.Success
                });
            }
        }
Exemple #4
0
        public IApiResult Create([FromForm] CustomObject obj)
        {
            CreateAttachment operation = convertCustomerObjectToAttachment(obj);
            var result = operation.ExecuteAsync().Result;

            if (result is ValidationsOutput)
            {
                return(new ApiResult <List <ValidationItem> >()
                {
                    Data = ((ValidationsOutput)result).Errors
                });
            }
            else
            {
                return(new ApiResult <object>()
                {
                    Status = ApiResult <object> .ApiStatus.Success, ID = ((ComplateOperation <int>)result).ID.Value
                });
            }
        }