/// <summary>
        /// Set the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>CurrencyResponse.</returns>
        public CurrencyResponse SetCurrencies(CurrencyRequest request)
        {
            var response = new CurrencyResponse();
            var mapper   = request.Currency;

            if (request.Action != PersistType.Delete)
            {
                if (!mapper.Validate())
                {
                    foreach (string error in mapper.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
            }
            try
            {
                if (request.Action == PersistType.Insert)
                {
                    var currency = CurrencyDao.GetCurrenciesByCurrencyCode(mapper.CurrencyCode);
                    if (currency != null)
                    {
                        response.Acknowledge = AcknowledgeType.Failure;
                        response.Message     = @"Mã tiền tệ " + mapper.CurrencyCode + @" đã tồn tại !";
                        return(response);
                    }
                    mapper.CurrencyId = CurrencyDao.InsertCurrency(mapper);
                    response.Message  = null;
                }
                else if (request.Action == PersistType.Update)
                {
                    response.Message = CurrencyDao.UpdateCurrency(mapper);
                }
                else
                {
                    var obj = CurrencyDao.GetCurrency(request.CurrencyId);
                    response.Message = CurrencyDao.DeleteCurrency(obj);
                }
            }
            catch (Exception ex)
            {
                response.Acknowledge = AcknowledgeType.Failure;
                response.Message     = ex.Message;
                return(response);
            }
            response.CurrencyId  = mapper != null ? mapper.CurrencyId : 0;
            response.Acknowledge = response.Message != null ? AcknowledgeType.Failure : AcknowledgeType.Success;
            return(response);
        }
        /// <summary>
        /// Inserts the account category.
        /// </summary>
        /// <param name="currencyEntity">The account currency entity.</param>
        /// <returns>AccountCategoryResponse.</returns>
        public CurrencyResponse InsertCurrency(CurrencyEntity currencyEntity)
        {
            var response = new CurrencyResponse {
                Acknowledge = AcknowledgeType.Success
            };

            try
            {
                if (!currencyEntity.Validate())
                {
                    foreach (string error in currencyEntity.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                currencyEntity.CurrencyId = Guid.NewGuid().ToString();
                var currencyExited = ICurrencyDao.GetCurrenciesByCurrencyCode(currencyEntity.CurrencyCode);
                if (currencyExited != null)
                {
                    response.Acknowledge = AcknowledgeType.Failure;
                    response.Message     = @"Mã tiền tệ " + currencyExited.CurrencyCode.Trim() + @" đã tồn tại!";
                    return(response);
                }
                currencyEntity.CurrencyId = ICurrencyDao.InsertCurrency(currencyEntity);
                if (!string.IsNullOrEmpty(response.Message))
                {
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                response.CurrencyId = currencyEntity.CurrencyId;
                return(response);
            }
            catch (Exception ex)
            {
                response.Acknowledge = AcknowledgeType.Failure;
                response.Message     = ex.Message;
                return(response);
            }
        }