Пример #1
0
        /// <summary>
        /// Gets the captital allocate vouchers by reference identifier.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>CaptitalAllocateVoucherReponse.</returns>
        public CaptitalAllocateVoucherReponse GetCaptitalAllocateVouchersByRefId(CaptitalAllocateVoucherRequest request)
        {
            var response = new CaptitalAllocateVoucherReponse();

            if (request.LoadOptions.Contains("CaptitalAllocateVouchers"))
            {
                response.GetCaptitalAllocateVouchers = CaptitalAllocateVoucherDao.GetCaptitalAllocateVouchersByRefId(request.RefId);
            }
            return(response);
        }
Пример #2
0
        /// <summary>
        /// Gets the captital allocate voucher.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>CaptitalAllocateVoucherReponse.</returns>
        public CaptitalAllocateVoucherReponse GetCaptitalAllocateVoucher(CaptitalAllocateVoucherRequest request)
        {
            var response = new CaptitalAllocateVoucherReponse();

            if (request.LoadOptions.Contains("CaptitalAllocateVouchers"))
            {
                response.GetCaptitalAllocateVouchers = CaptitalAllocateVoucherDao.GetCaptitalAllocateVoucherForUpdateOrInsert();
            }
            return(response);
        }
Пример #3
0
        /// <summary>
        /// Sets the captital allocate vouchers.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>CaptitalAllocateVoucherReponse.</returns>
        public CaptitalAllocateVoucherReponse SetCaptitalAllocateVouchers(CaptitalAllocateVoucherRequest request)
        {
            var response = new CaptitalAllocateVoucherReponse();
            var captitalAllocateVoucherEntity = request.CaptitalAllocateVoucherEntity;

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

            try
            {
                if (request.Action == PersistType.Insert)
                {
                    captitalAllocateVoucherEntity.RefDetailId = CaptitalAllocateVoucherDao.InsertCaptitalAllocateVoucher(captitalAllocateVoucherEntity);
                    response.Message = null;
                }
                else if (request.Action == PersistType.Update)
                {
                    response.Message = CaptitalAllocateVoucherDao.DeleteCaptitalAllocateVoucher(captitalAllocateVoucherEntity.RefId);
                    captitalAllocateVoucherEntity.RefDetailId = CaptitalAllocateVoucherDao.InsertCaptitalAllocateVoucher(captitalAllocateVoucherEntity);
                    response.Message = null;
                }

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

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

            response.Acknowledge = response.Message != null ? AcknowledgeType.Failure : AcknowledgeType.Success;
            return(response);
        }
Пример #4
0
        /// <summary>
        /// Gets the captital allocate vouchers from date to to date for update.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>CaptitalAllocateVoucherReponse.</returns>
        public CaptitalAllocateVoucherReponse GetCaptitalAllocateVouchersFromDateToToDateForUpdate(CaptitalAllocateVoucherRequest request)
        {
            var response = new CaptitalAllocateVoucherReponse();

            if (request.LoadOptions.Contains("CaptitalAllocateVouchers"))
            {
                response.GetCaptitalAllocateVouchers = CaptitalAllocateVoucherDao.GetCaptitalAllocateVouchersFromDateToToDateForUpdate(request.FromDate, request.ToDate, request.CurrencyCode, request.ActivityId, request.RefTypeId, request.RefId);
            }
            return(response);
        }