Пример #1
0
        /// <summary>
        /// Gets the captital allocate voucher.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public AccountTranferVourcherReponse GetCaptitalAllocateVoucher(AccountTranferVourcherRequest request)
        {
            var response = new AccountTranferVourcherReponse();

            if (request.LoadOptions.Contains("AccountTranferVourchers"))
            {
                response.GetAccountTranferVourchers = AccountTranferVourcherDao.GetAccountTranferVourchersByRefId(request.RefId);
            }
            return(response);
        }
Пример #2
0
        public AccountTranferVourcherReponse GetAccountTranferVourchersByEdit(AccountTranferVourcherRequest request)
        {
            var response = new AccountTranferVourcherReponse();

            if (request.LoadOptions.Contains("AccountTranferVourchers"))
            {
                response.GetAccountTranferVourchers = AccountTranferVourcherDao.GetAccountTranferVourchersByEdit(request.PostedDate, request.CurrencyCode, request.RefTypeId);
            }
            return(response);
        }
Пример #3
0
        /// <summary>
        /// Sets the account tranfer vouchers.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public AccountTranferVourcherReponse SetAccountTranferVouchers(AccountTranferVourcherRequest request)
        {
            var response = new AccountTranferVourcherReponse();
            var accountTranferVourcherEntity = request.AccountTranferVourcherEntity;

            if (request.Action != PersistType.Delete)
            {
                if (!accountTranferVourcherEntity.Validate())
                {
                    foreach (string error in accountTranferVourcherEntity.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
            }

            try
            {
                if (request.Action == PersistType.Insert)
                {
                    accountTranferVourcherEntity.RefDetailId = AccountTranferVourcherDao.InserAccountTranferVourcher(accountTranferVourcherEntity);
                    response.Message = null;
                }
                else if (request.Action == PersistType.Update)
                {
                    response.Message = AccountTranferVourcherDao.DeleteAccountTranferDetailVourchers(request.RefId);
                    accountTranferVourcherEntity.RefDetailId = AccountTranferVourcherDao.InserAccountTranferVourcher(accountTranferVourcherEntity);
                    response.Message = null;
                }

                else
                {
                    response.Message =
                        AccountTranferVourcherDao.DeleteAccountTranferDetailVourchers(request.RefId);
                }
            }
            catch (Exception ex)
            {
                response.Acknowledge = AcknowledgeType.Failure;
                response.Message     = ex.Message;
                return(response);
            }

            response.RefDetailId = accountTranferVourcherEntity != null?Convert.ToInt32(accountTranferVourcherEntity.RefDetailId) : 0;

            response.Acknowledge = response.Message != null ? AcknowledgeType.Failure : AcknowledgeType.Success;
            return(response);
        }