Exemplo n.º 1
0
        /// <summary>
        /// Xử lý nghiệp vụ Sửa thông tin tài sản
        /// </summary>
        /// <param name="customer">đối tượng Sửa</param>
        /// <returns>ServiceResult</returns>
        public virtual ServiceResult Update(T entity, Guid id)
        {
            // Khởi tạo đối tượng trả về
            var serviceResult = new ServiceResult();
            // Khởi tạo thông báo lỗi
            var errorMsg = new ErrorMsg();

            // Thuực hiện validate dữ liệu
            var isValid = ValidateUpdate(entity, errorMsg);

            //Validate dữ liệu oke thì thực hiện hàm thêm
            // Kiểm tra id có tồn tại hay chưa
            var assetDelete = _baseData.GetById(id);

            if (assetDelete != null)
            {
                if (isValid)
                {
                    var res = _baseData.Update(entity);
                    if (res > 0)
                    {
                        serviceResult.Success  = true;
                        serviceResult.Data     = res;
                        serviceResult.MisaCode = MISACode.Success;
                        return(serviceResult);
                    }
                    else
                    {
                        serviceResult.Success  = true;
                        serviceResult.Data     = res;
                        serviceResult.MisaCode = MISACode.IsValid;
                        return(serviceResult);
                    }
                }
                else
                {
                    serviceResult.Success  = false;
                    serviceResult.Data     = errorMsg;
                    serviceResult.MisaCode = MISACode.NotValid;
                }
            }
            else
            {
                errorMsg.DevMsg   = MISA.QLTS.Common.Properties.Resources.Msg_Dev;
                errorMsg.MoreInfo = MISA.QLTS.Common.Properties.Resources.MoreInfo;
                errorMsg.UserMsg.Add(MISA.QLTS.Common.Properties.Resources.Error_UserMsg);
                serviceResult.Data     = errorMsg;
                serviceResult.MisaCode = MISACode.NotValid;
                serviceResult.Success  = false;
            }
            return(serviceResult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Cập nhật thông tin đối tượng
        /// </summary>
        /// <param name="entity">Kiểu đố tượng</param>
        /// <returns>ServiceResult</returns>
        /// create: 7/2/2021
        public virtual async Task <ServiceResult> Update(T entity)
        {
            var effectRow = await _baseData.Update(entity);

            ServiceResult serviceResult = new ServiceResult();

            if (effectRow == 1)
            {
                serviceResult.MISAeShopCode = MISAeShopServiceCode.Success;
            }
            else
            {
                serviceResult.MISAeShopCode = MISAeShopServiceCode.Exception;
                serviceResult.Error.Add(new ErrorResult()
                {
                    DevMsg  = Properties.Resources.ErrorServive_Shop_Update,
                    UserMsg = Properties.Resources.ErrorServive_Shop_Update
                });
            }
            return(serviceResult);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Xử lý nghiệp vụ Sửa thông tin tài sản
        /// </summary>
        /// <param name="">đối tượng Sửa</param>
        /// <returns>ServiceResult</returns>
        public virtual ServiceResult Update(T entity)
        {
            // Khởi tạo đối tượng trả về
            var serviceResult = new ServiceResult();
            // Khởi tạo thông báo lỗi
            var errorMsg = new ErrorMsg();
            // Thuực hiện validate dữ liệu
            var isValid = ValidateUpdate(entity, errorMsg);

            // Validate dữ liệu oke thì thực hiện hàm thêm
            if (isValid)
            {
                var res = _baseData.Update(entity);
                if (res > 0)
                {
                    serviceResult.Success  = true;
                    serviceResult.Data     = res;
                    serviceResult.MisaCode = MISACode.Success;
                    return(serviceResult);
                }
                else
                {
                    serviceResult.Success  = true;
                    serviceResult.Data     = res;
                    serviceResult.MisaCode = MISACode.IsValid;
                    return(serviceResult);
                }
            }
            else
            {
                serviceResult.Success  = false;
                serviceResult.Data     = errorMsg;
                serviceResult.MisaCode = MISACode.NotValid;
            }
            return(serviceResult);
        }
Exemplo n.º 4
0
 public void UpdateUserIdentifier(IUserIdentifier userIdentifier, Guid id)
 {
     _userIdentifierData.Update(userIdentifier, id);
 }
Exemplo n.º 5
0
 public void UpdateUserType(IUserType userType, Guid id)
 {
     _userTypeData.Update(userType, id);
 }
Exemplo n.º 6
0
 public void UpdateSource(ISource source, Guid id)
 {
     _sourceData.Update(source, id);
 }
Exemplo n.º 7
0
 public void UpdateSegment(ISegment segment, Guid id)
 {
     _segmentData.Update(segment, id);
 }
Exemplo n.º 8
0
 public void UpdateEmailSetting(IEmailSetting emailSetting, Guid id)
 {
     _emailSettingData.Update(emailSetting, id);
 }
Exemplo n.º 9
0
 public void UpdateEmail(IEmail email, Guid id)
 {
     _emailData.Update(email, id);
 }
Exemplo n.º 10
0
 public void UpdateCronTask(ICronTask cronTask, Guid id)
 {
     _cronTaskData.Update(cronTask, id);
 }