Beispiel #1
0
        public ActionResult View(int?id = null)
        {
            if (!_authorizer.Authorize(ContentSyncPermissions.SnapshotManager, T("You need the {0} permission to do this.", ContentSyncPermissions.SnapshotManager.Name)))
            {
                return(new HttpUnauthorizedResult());
            }

            SnapshotRecord record = null;

            if (id.HasValue)
            {
                record = _snapshotService.GetSnaphot(id.Value);
            }

            if (record == null)
            {
                record = new SnapshotRecord
                {
                    TimeTaken = _clock.UtcNow,
                    Data      = _contentExportService.GetContentExportText()
                };
            }

            return(View(record));
        }
        public ActionResult View(int?id = null)
        {
            SnapshotRecord record = null;

            if (id.HasValue)
            {
                record = _snapshotService.GetSnaphot(id.Value);
            }

            if (record == null)
            {
                record = new SnapshotRecord {
                    TimeTaken = _clock.UtcNow,
                    Data      = _contentExportService.GetContentExportFilePath()
                };
            }

            return(View(record));
        }
Beispiel #3
0
        /// <summary>
        /// Заполняет модель даными из моделей слоя DAL
        /// </summary>
        /// <param name="transaction">Транзакция с доходами</param>
        /// <param name="dalRecord">Запись из базы о транзакции</param>
        /// <returns></returns>
        public static IncomeTransaction FillFromDalEntities(this IncomeTransaction transaction, SnapshotRecord dalRecord)
        {
            transaction.ContractorName      = dalRecord.ContractorName;
            transaction.CreditAccountNumber = dalRecord.CreditAccountNumber;
            transaction.Date = dalRecord.TransactionDate;
            transaction.DebitAccountNumber = dalRecord.DebitAccountNumber;
            transaction.Puprose            = dalRecord.PaymentPurpose;
            transaction.Sum = dalRecord.IncomeSum;

            switch (dalRecord.TransactionType)
            {
            case 0:
                transaction.Type = IncomeTypes.Salary;
                break;

            case 1:
                transaction.Type = IncomeTypes.Pension;
                break;

            case 2:
                transaction.Type = IncomeTypes.Service;
                break;
            }

            return(transaction);
        }