예제 #1
0
 /// <summary>
 /// Check processing
 /// </summary>
 /// <param name="inputObject">DataModel</param>
 /// <returns>ResultModel</returns>
 private void Check(UploadDataModel inputObject)
 {
     // Check valid
     if (DataCheckHelper.IsNull(inputObject.InputStream))
         throw new ExecuteException("E_MSG_00004", "Tập tin");
     if (!StorageFileCom.MapImageSize.ContainsKey(inputObject.FileGroup))
         throw new ExecuteException("E_MSG_00001", "Nhóm tập tin");
 }
예제 #2
0
        /// <summary>
        /// Execute convert output.
        /// </summary>
        /// <param name="resultObject">DataModel</param>
        /// <returns>ResponseModel</returns>
        private UploadResponseModel Convert(UploadDataModel resultObject)
        {
            // Local variable declaration
            UploadResponseModel responseModel = null;

            // Variable initialize
            responseModel = new UploadResponseModel();

            // Set value
            responseModel.AddMessage(MessageHelper.GetMessageInfo("I_MSG_00005"));

            // Return value
            return responseModel;
        }
예제 #3
0
        /// <summary>
        /// Execute convert input.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>DataModel</returns>
        private UploadDataModel Convert(UploadRequestModel request)
        {
            // Local variable declaration
            UploadDataModel inputObject = null;

            // Variable initialize
            inputObject = new UploadDataModel();

            // Convert data input
            DataHelper.ConvertInput(request, inputObject);

            // Return value
            return inputObject;
        }
예제 #4
0
        /// <summary>
        /// Upload infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private UploadDataModel UploadInfo(UploadDataModel inputObject)
        {
            // Local variable declaration
            UploadDataModel getResult = null;
            StorageFileCom storageFileCom = null;

            // Variable initialize
            getResult = new UploadDataModel();
            storageFileCom = new StorageFileCom();

            // Get data
            var fileId = inputObject.FileId;
            var maxFileNo = storageFileCom.GetMaxFileNo(fileId);

            // Set data
            var param = new StorageFile();
            param.FileId = fileId;
            param.FileNo = maxFileNo + 1;
            param.FileName = DataHelper.GetUniqueKey() + ".jpg";
            param.FileGroup = inputObject.FileGroup;
            param.SortKey = inputObject.SortKey;

            // Upload data
            // Upload Full size
            var path = string.Format("/pages/media/images/{0}/{1}/{2}",
                    inputObject.FileGroup, "zoom", param.FileName);
            UploadHelper.UploadImage(inputObject.InputStream, path);

            // Upload Fix size
            var uploadList = StorageFileCom.MapImageSize[param.FileGroup];
            foreach (var obj in uploadList)
            {
                path = string.Format("/pages/media/images/{0}/{1}/{2}",
                    inputObject.FileGroup, obj.SizeName, param.FileName);
                UploadHelper.UploadImage(inputObject.InputStream, obj.Width, obj.Height, path);
            }

            // Insert data
            storageFileCom.Insert(param);

            // Submit data
            storageFileCom.SubmitChanges();

            // Return value
            return getResult;
        }