예제 #1
0
        public Response <IEnumerable <Attachment> > AddAttachment(AddAttachmentRequest request)
        {
            Response <IEnumerable <Attachment> > response = new Response <IEnumerable <Attachment> >();

            if (request == null || request.attachments == null || !request.attachments.Any())
            {
                ArgumentNullException ex = new ArgumentNullException("AddAttachment request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                AttachmentAccessor accessor = new AttachmentAccessor();
                response.Result    = accessor.AddAttachments(request.attachments, request.IsCoverOld);
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }
예제 #2
0
        public string getTips(long DeliverID)
        {
            string response = "";

            try
            {
                AttachmentAccessor accessor = new AttachmentAccessor();
                response = accessor.getTips(DeliverID);
            }
            catch (Exception ex)
            {
                LogError(ex);
            }

            return(response);
        }
예제 #3
0
        public Response <IEnumerable <Attachment> > GetAttachmentsByGroupID(GetAttachmentsByGroupIDRequest request)
        {
            Response <IEnumerable <Attachment> > response = new Response <IEnumerable <Attachment> >();

            if (request == null || string.IsNullOrEmpty(request.GroupID))
            {
                ArgumentNullException ex = new ArgumentNullException("GetAttachmentsByGroupID request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                AttachmentAccessor accessor = new AttachmentAccessor();
                response.Result = accessor.GetAttachmentsByGroupID(request.GroupID);
                if (!response.Result.Any())
                {
                    response.IsSuccess = false;
                    response.ErrorCode = ErrorCode.Argument;
                }
                else
                {
                    response.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }
예제 #4
0
        public Response <Attachment> GetAttachmentByID(GetAttachmentByIDRequest request)
        {
            Response <Attachment> response = new Response <Attachment>();

            if (request == null)
            {
                ArgumentNullException ex = new ArgumentNullException("GetAttachmentByID request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                AttachmentAccessor accessor = new AttachmentAccessor();
                response.Result = accessor.GetAttachmentByID(request.ID);
                if (response.Result.ID == 0)
                {
                    response.IsSuccess = false;
                    response.ErrorCode = ErrorCode.Argument;
                }
                else
                {
                    response.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }