Exemplo n.º 1
0
        /// <summary>
        /// Execute convert input.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>DataModel</returns>
        private SaveDataModel Convert(SaveRequestModel request)
        {
            // Local variable declaration
            SaveDataModel inputObject = null;

            // Variable initialize
            inputObject = new SaveDataModel();

            // Convert data input
            DataHelper.ConvertInput(request, inputObject);
            _status = DataHelper.ConvertInputString(request.Status);

            // Return value
            return inputObject;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            AdminBrandEntryDao adminBrandEntryDao = null;

            // Variable initialize
            adminBrandEntryDao = new AdminBrandEntryDao();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_BRANDS))
                throw new ExecuteException("E_MSG_00013");

            // Check valid
            if (IsAdd && adminBrandEntryDao.IsExistBrand(inputObject.BrandCd))
                throw new DataExistException("Thương hiệu");
            if (IsEdit && !adminBrandEntryDao.IsExistBrand(inputObject.BrandCd))
                throw new DataNotExistException("Thương hiệu");
        }
Exemplo n.º 3
0
        public void UpdateBrand(SaveDataModel inputObject)
        {
            // Get sysdate
            var currentDate = DateTime.Now;

            // Set item
            var entity = GetSingle<Brand>(inputObject.BrandCd, true);
            entity.BrandName = inputObject.BrandName;
            entity.BrandSearchName = inputObject.BrandSearchName;
            entity.Notes = inputObject.Notes;
            entity.SortKey = inputObject.SortKey;
            entity.UpdateUser = PageHelper.UserName;
            entity.UpdateDate = currentDate;
            entity.DeleteFlag = inputObject.DeleteFlag;

            // Submit
            EntityManager.SubmitChanges();
        }
Exemplo n.º 4
0
        public void InsertBrand(SaveDataModel inputObject)
        {
            // Get sysdate
            var currentDate = DateTime.Now;

            // Set item
            var entity = new Brand();
            entity.BrandCd = inputObject.BrandCd;
            entity.BrandName = inputObject.BrandName;
            entity.BrandSearchName = inputObject.BrandSearchName;
            entity.FileId = inputObject.FileId;
            entity.Notes = inputObject.Notes;
            entity.SortKey = inputObject.SortKey;
            entity.CreateUser = PageHelper.UserName;
            entity.CreateDate = currentDate;
            entity.UpdateUser = PageHelper.UserName;
            entity.UpdateDate = currentDate;
            entity.DeleteFlag = inputObject.DeleteFlag;
            EntityManager.Brands.InsertOnSubmit(entity);

            // Submit
            EntityManager.SubmitChanges();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Execute convert ouput.
        /// </summary>
        /// <param name="resultObject">DataModel</param>
        /// <returns>ResponseModel</returns>
        private SaveResponseModel Convert(SaveDataModel resultObject)
        {
            // Local variable declaration
            SaveResponseModel response = null;

            // Variable initialize
            response = new SaveResponseModel();

            // Set value
            response.AddMessage(MessageHelper.GetMessageInfo("I_MSG_00001"));

            // Return value
            return response;
        }
Exemplo n.º 6
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;
        }