예제 #1
0
        public List<AllOperation> Find(string find)
        {
            var all = new List<AllOperation>();
            decimal summa = 0;
            Decimal.TryParse(find, out summa);

            var bank = new BankOperationsRepository().GetAll().Where(c => c.Contractor.Contains(find)
                || c.DocNum == find || c.Summa == summa);
            var kassa = new KassaOperationRepository().GetAll().Where(c => c.Contractor.Contains(find)
                || c.DocNum == find || c.Summa == summa);

            var alloperations = bank.Select(c => new AllOperation()
            {
                Id = c.Id,
                FlagOperation = c.FlagOperation,
                OperationType = c.OperationType,
                DocNum = c.DocNum,
                DocDate = c.DocDate,
                DocType = c.DocType,
                Contractor = c.Contractor,
                Summa = c.Summa,
                Osnovanie = c.Osnovanie,
                FlagBankOrKassa = BankOrKassa.Bank
            })
                .Union(kassa.Select(c => new AllOperation()
                {
                    FlagOperation = c.FlagOperation,
                    OperationType = c.OperationType,
                    DocNum = c.DocNum,
                    DocDate = c.DocDate,
                    DocType = null,
                    Contractor = c.Contractor,
                    Summa = c.Summa,
                    Osnovanie = c.Osnovanie,
                    FlagBankOrKassa = BankOrKassa.Kassa
                })).OrderBy(c => c.DocDate).ThenBy(c => c.DocNum).ToList();
            return alloperations;
        }
예제 #2
0
        public List<AllOperation> GetAllOperation(DateTime from, DateTime to)
        {
            var bank = new BankOperationsRepository().GetBankOperations(from, to);
            var kassa = new KassaOperationRepository().GetKassaOperations(from, to);

            var all = new List<AllOperation>();

            var alloperations = bank.Select(c => new AllOperation()
            {
                Id = c.Id,
                FlagOperation = c.FlagOperation,
                OperationType = c.OperationType,
                DocNum = c.DocNum,
                DocDate = c.DocDate,
                DocType = c.DocType,
                Contractor = c.Contractor,
                Summa = c.Summa,
                Osnovanie = c.Osnovanie,
                FlagBankOrKassa = BankOrKassa.Bank
            })
                .Union(kassa.Select(c => new AllOperation()
                {
                    FlagOperation = c.FlagOperation,
                    OperationType = c.OperationType,
                    DocNum = c.DocNum,
                    DocDate = c.DocDate,
                    DocType = null,
                    Contractor = c.Contractor,
                    Summa = c.Summa,
                    Osnovanie = c.Osnovanie,
                    FlagBankOrKassa = BankOrKassa.Kassa
                })).OrderBy(c => c.DocDate).ThenBy(c => c.DocNum).ToList();
            return alloperations;
        }