Example #1
0
        public PrintedDocumentsListDto GetPrintedList(DocumentType type)
        {
            try
            {
                _WriteLineConsole("get printed list");
                switch (type)
                {
                case DocumentType.CashTransaction:
                {
                    using (CashTransactionsHelper helper = new CashTransactionsHelper())
                    {
                        return(helper.GetPrintedList());
                    }
                }

                case DocumentType.CreditTransaction:
                {
                    using (var helper = new CreditTransactionHelper())
                    {
                        return(helper.GetPrintedList());
                    }
                }

                case DocumentType.Commission:
                {
                    using (var helper = new CommissionHelper())
                    {
                        return(helper.GetPrintedList());
                    }
                }

                default:
                    throw new NotImplementedException();
                }
            }
            catch (Exception ex)
            {
                _WriteLineError("get printed list", ex.Message);
                return(new PrintedDocumentsListDto()
                {
                    Error = true,
                    Message = ex.Message
                });
            }
        }
Example #2
0
        public CashTransactionDto GetCashTransaction(int id)
        {
            _WriteLineConsole($"get cash transaction id:{id}");

            try
            {
                using (CashTransactionsHelper helper = new CashTransactionsHelper())
                    return(helper.GetCashTransaction(id));
            }
            catch (Exception ex)
            {
                _WriteLineError("get cash transaction", ex.Message);
                return(new CashTransactionDto()
                {
                    Error = true,
                    Message = ex.Message
                });
            }
        }
Example #3
0
        public CashTransactionsDto GetCashTransactions()
        {
            try
            {
                _WriteLineConsole("get cash transactions");

                using (CashTransactionsHelper helper = new CashTransactionsHelper())
                    return(helper.GetCashTransactions());
            }
            catch (Exception ex)
            {
                _WriteLineError("get cash transaction", ex.Message);
                return(new CashTransactionsDto()
                {
                    Error = true,
                    Message = ex.Message
                });
            }
        }
Example #4
0
        public Response DeleteCashTransaction(CashTransactionDocument document)
        {
            try
            {
                _WriteLineConsole($"delete cash transaction identity: {document.Identity}");
                using (var helper = new CashTransactionsHelper())
                {
                    helper.DeleteCashTransaction(document);
                }

                return(new Response()
                {
                    Message = "Документ удален"
                });
            }
            catch (Exception ex)
            {
                _WriteLineError($"delete cash transaction identity: {document?.Identity}", ex.Message);
                return(new Response(ex));
            }
        }
Example #5
0
        public SaveEntityResult SaveCashTransaction(CashTransactionDocument document)
        {
            try
            {
                _WriteLineConsole($"save cash transaction identity: {document.Identity}");
                using (var helper = new CashTransactionsHelper())
                    helper.SaveCashTransaction(document);

                return(new SaveEntityResult()
                {
                    Message = "Данные успешно сохраненны", Id = document.Id, Number = document.Number
                });
            }
            catch (Exception ex)
            {
                _WriteLineError($"save cash transaction identity: {document?.Identity}", ex.Message);
                return(new SaveEntityResult()
                {
                    Error = true,
                    Message = ex.Message
                });
            }
        }