Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Save infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private SaveDataModel SaveInfo(SaveDataModel inputObject)
        {
            // Local variable declaration
            SaveDataModel saveResult = null;
            AdminBrandEntryDao adminBrandEntryDao = null;
            StorageFileCom storageFileCom = null;

            // Variable initialize
            saveResult = new SaveDataModel();
            adminBrandEntryDao = new AdminBrandEntryDao();
            storageFileCom = new StorageFileCom();

            if (IsAdd) adminBrandEntryDao.InsertBrand(inputObject); // Insert
            else adminBrandEntryDao.UpdateBrand(inputObject); // Update

            // Update StorageFile
            foreach (var storageFile in storageFileCom.GetListActive(inputObject.FileId, false))
            {
                storageFile.ActiveFlag = true;
                storageFileCom.UpdateActiveFlag(storageFile, false);
            }
            storageFileCom.SubmitChanges();

            return saveResult;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Update data
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private UpdateDataModel UpdateInfo(UpdateDataModel inputObject)
        {
            // Local variable declaration
            UpdateDataModel getResult = null;
            StorageFileCom storageFileCom = null;

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

            // Get data
            foreach (var obj in inputObject.ListFiles)
            {
                storageFileCom.UpdateSortKey(obj, true);
            }

            // Submit data
            storageFileCom.SubmitChanges();

            // Return value
            return getResult;
        }