Ejemplo n.º 1
0
        public void Update(SaveDataModel inputObject)
        {
            // Get sysdate
            var currentDate = DateTime.Now;

            // Set data
            var entity = GetSingle(inputObject.UserCd);
            entity.Email = inputObject.Email;
            entity.FullName = inputObject.FullName;
            entity.Address = inputObject.Address;
            entity.Phone1 = inputObject.Phone1;
            entity.Phone2 = inputObject.Phone2;
            entity.CityCd = inputObject.CityCd;
            entity.UpdateUser = PageHelper.UserName;
            entity.UpdateDate = currentDate;
            entity.DeleteFlag = inputObject.DeleteFlag;

            var entityGroupUser = GetSingleUserGroup(inputObject.UserCd, inputObject.GroupCd);
            entityGroupUser.UpdateUser = PageHelper.UserName;
            entityGroupUser.UpdateDate = currentDate;
            entityGroupUser.DeleteFlag = inputObject.DeleteFlag;

            // Submit
            EntityManager.SubmitChanges();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            var adminUserEntryDao = new AdminUserEntryDao();

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

            // Check valid
            if (IsEdit && !adminUserEntryDao.IsExist(inputObject.UserCd))
                throw new DataNotExistException("Tài khoản");
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        public void Insert(SaveDataModel inputObject)
        {
            // Get sysdate
            var currentDate = DateTime.Now;
            // Get unique code
            var userCd = Guid.NewGuid();

            // Set data
            var entity = new User();
            entity.UserCd = userCd;
            entity.Email = inputObject.Email;
            entity.FullName = inputObject.FullName;
            entity.Password = DataHelper.GetMd5Hash(Logics.PASSWORD_DEFAULT);
            entity.Address = inputObject.Address;
            entity.Phone1 = inputObject.Phone1;
            entity.Phone2 = inputObject.Phone2;
            entity.CityCd = inputObject.CityCd;
            entity.HasNewsletter = false;
            entity.CreateUser = PageHelper.UserName;
            entity.CreateDate = currentDate;
            entity.UpdateUser = PageHelper.UserName;
            entity.UpdateDate = currentDate;
            entity.DeleteFlag = inputObject.DeleteFlag;

            var entityGroupUser = new UserGroup();
            entityGroupUser.UserCd = userCd;
            entityGroupUser.GroupCd = inputObject.GroupCd;
            entityGroupUser.CreateUser = PageHelper.UserName;
            entityGroupUser.CreateDate = currentDate;
            entityGroupUser.UpdateUser = PageHelper.UserName;
            entityGroupUser.UpdateDate = currentDate;
            entityGroupUser.DeleteFlag = inputObject.DeleteFlag;

            // Insert
            EntityManager.Users.InsertOnSubmit(entity);
            EntityManager.UserGroups.InsertOnSubmit(entityGroupUser);

            // Submit
            EntityManager.SubmitChanges();
        }
Ejemplo 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;
        }
Ejemplo 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;
            AdminUserEntryDao adminUserEntryDao = null;

            // Variable initialize
            saveResult = new SaveDataModel();
            adminUserEntryDao = new AdminUserEntryDao();

            if (IsAdd) adminUserEntryDao.Insert(inputObject); // Insert
            else adminUserEntryDao.Update(inputObject); // Update

            // Return value
            return saveResult;
        }