/// <summary> /// Регистрация/перерегистрация ККТ /// </summary> /// <param name="type">Тип регистрации ККТ</param> /// <param name="operatorParams">Оператор (кассир)</param> /// <param name="organizationParams">Информация об организации</param> /// <param name="kktParams">Параметры ККТ</param> /// <param name="ofdParams">Параметры ОФД</param> /// <param name="localDateTime">Локальные дата и время в месте (по адресу) осуществления расчетов</param> /// <param name="taxationTypes">Системы налогообложения, с которыми работает ККТ</param> /// <param name="kktRegistrationReason">Причина перерегистрации ККТ</param> public RegisterKKTOperation(KKTRegistrationType type, OperatorParams operatorParams, OrganizationParams organizationParams, KKTParams kktParams, OfdParams ofdParams, DateTime localDateTime, ISet <TaxationType> taxationTypes, KKTRegistrationReason?kktRegistrationReason = null) : base(type.ToString()) { DateTime = localDateTime; CashierInfo = operatorParams ?? throw new ArgumentNullException(nameof(operatorParams)); Owner = organizationParams ?? throw new ArgumentNullException(nameof(organizationParams)); Kkt = kktParams ?? throw new ArgumentNullException(nameof(kktParams)); Ofd = ofdParams ?? throw new ArgumentNullException(nameof(ofdParams)); if (taxationTypes?.Any() != true) { throw new ArgumentException(string.Format(ErrorStrings.ResourceManager.GetString("MinLengthError"), this.GetType().GetProperty(nameof(TaxSystem)).GetDisplayName(), 1), nameof(taxationTypes)); } TaxSystem = taxationTypes; if (type == KKTRegistrationType.ReregisterKKT && kktRegistrationReason == null) { throw new ArgumentNullException(nameof(kktRegistrationReason)); } Reason = kktRegistrationReason; }
public async Task <IActionResult> GetOrganizations([FromQuery] OrganizationParams organizationParams) { var currentUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); organizationParams.UserId = currentUserId; var organizations = await _repo.GetOrganizations(organizationParams); var organizationsToReturn = _mapper.Map <IEnumerable <OrganizationForListDto> >(organizations); Response.AddPagination(organizations.CurrentPage, organizations.PageSize, organizations.TotalCount, organizations.TotalPages); return(Ok(organizationsToReturn)); }
/// <summary> /// Регистрация/перерегистрация ККТ /// </summary> /// <param name="type">Тип регистрации ККТ</param> /// <param name="operatorParams">Оператор (кассир)</param> /// <param name="organizationParams">Информация об организации-пользователе</param> /// <param name="kktParams">Параметры ККТ</param> /// <param name="ofdParams">Параметры ОФД</param> /// <param name="kktRegistrationReason">Причина перерегистрации ККТ</param> public RegisterKKTOperation(KKTRegistrationType type, OperatorParams operatorParams, OrganizationParams organizationParams, KKTParams kktParams, OfdParams ofdParams, KKTRegistrationReason?kktRegistrationReason = null) : base(type.ToString() .ToLowerFirstChar()) { Operator = operatorParams ?? throw new ArgumentNullException(nameof(operatorParams)); Organization = organizationParams ?? throw new ArgumentNullException(nameof(organizationParams)); Device = kktParams ?? throw new ArgumentNullException(nameof(kktParams)); Ofd = ofdParams ?? throw new ArgumentNullException(nameof(ofdParams)); if (type == KKTRegistrationType.ChangeRegistrationParameters && kktRegistrationReason == null) { throw new ArgumentNullException(nameof(kktRegistrationReason)); } Reason = kktRegistrationReason; }
public async Task <PagedList <Organization> > GetOrganizations(OrganizationParams organizationParams) { var organizations = _context.Organizations .Include(x => x.OrganizationPhotos) .Include(x => x.OrganizationHeadPhotos) .Include(x => x.OrganizationFollowers).AsQueryable(); if (organizationParams.Followees) { var follows = await _context.OrganizationFollowers.Where(u => u.FollowerId == organizationParams.UserId).ToListAsync(); var followedOrganizationId = follows.Select(i => i.FolloweeId); organizations = organizations.Where(u => followedOrganizationId.Contains(u.Id)); } return(await PagedList <Organization> .CreateAsync(organizations, organizationParams.PageNumber, organizationParams.PageSize)); }