Пример #1
0
        public async Task <HttpResponseMessage> GetLoadTransfer()
        {
            LoadTransfer loadTransfer = new LoadTransfer()
            {
                Amount                = 0,
                Date                  = null,
                Description           = "",
                DocumentId            = 0,
                DocumentNumber        = 0,
                From                  = null,
                FromDetailAccountId   = 0,
                FromDetailAccountName = null,
                FromReference         = "",
                To = null,
                ToDetailAccountId   = 0,
                ToDetailAccountName = null,
                ToReference         = "",
            };

            return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ZhivarEnums.ResultCode.Successful, data = loadTransfer }));
        }
Пример #2
0
        public virtual async Task <HttpResponseMessage> GetLoadTransfer([FromBody] int id)
        {
            LoadTransfer loadTransfer = new LoadTransfer();

            TransferMoneyRule transferMoneyRule = new TransferMoneyRule();

            if (id > 0)
            {
                var transfer = await transferMoneyRule.GetByDocIdAsync(id);

                // int fromId, toId = 0;

                // if (transfer.From == "cash")
                // {
                //     var cashFrom = await cashRule.GetByAccountId(Convert.ToInt32(transfer.FromDetailAccountId));
                //     fromId = cashFrom.ID;

                //     if (transfer.To == "cash")
                //     {
                //         var cashTo = await cashRule.GetByAccountId(transfer.ToDetailAccountId);
                //         toId = cashTo.ID;
                //     }
                //     else
                //     {
                //         var bankTo = await bankRule.GetByAccountId(transfer.ToDetailAccountId);
                //         toId = bankTo.ID;
                //     }
                // }
                // else
                // {
                //     var bankFrom = await bankRule.GetByAccountId(Convert.ToInt32(transfer.FromDetailAccountId));
                //     fromId = bankFrom.ID;

                //     if (transfer.To == "cash")
                //     {
                //         var cashTo = await cashRule.GetByAccountId(transfer.ToDetailAccountId);
                //         toId = cashTo.ID;
                //     }
                //     else
                //     {
                //         var bankTo = await bankRule.GetByAccountId(transfer.ToDetailAccountId);
                //         toId = bankTo.ID;
                //     }
                // }
                loadTransfer = new LoadTransfer()
                {
                    Amount                = transfer.Amount,
                    Date                  = transfer.Date,
                    DisplayDate           = transfer.DisplayDate,
                    Description           = transfer.Description,
                    DocumentId            = (int)transfer.DocumentId,
                    DocumentNumber        = transfer.DocumentNumber,
                    From                  = transfer.From,
                    FromDetailAccountId   = Convert.ToInt32(transfer.FromDetailAccountId),
                    FromDetailAccountName = transfer.FromDetailAccountName,
                    FromReference         = transfer.FromReference,
                    To = transfer.To,
                    ToDetailAccountId   = Convert.ToInt32(transfer.ToDetailAccountId),// toId,
                    ToDetailAccountName = transfer.ToDetailAccountName,
                    ToReference         = transfer.ToReference,
                };

                return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ZhivarEnums.ResultCode.Successful, data = loadTransfer }));
            }

            loadTransfer = new LoadTransfer()
            {
                Amount                = 0,
                Date                  = null,
                Description           = "",
                DocumentId            = 0,
                DocumentNumber        = 0,
                From                  = null,
                FromDetailAccountId   = 0,
                FromDetailAccountName = null,
                FromReference         = "",
                To = null,
                ToDetailAccountId   = 0,
                ToDetailAccountName = null,
                ToReference         = "",
            };

            return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ZhivarEnums.ResultCode.Successful, data = loadTransfer }));
        }