public async Task DeleteOrganizationUnit(EntityDto <long> input)
 {
     await _organizationUnitManager.DeleteAsync(input.Id);
 }
Example #2
0
 public async Task Delete(EntityDto input)
 {
     await _servicePriceRepository.DeleteAsync(input.Id);
 }
Example #3
0
 public async Task GetDeleteView(EntityDto input)
 {
     await _viewRepository.DeleteAsync(input.Id);
 }
Example #4
0
        public async Task <GetViews> GetViewForEdit(EntityDto input)
        {
            var output = new GetViews
            {
            };
            var query = (from r in _viewRepository.GetAll()
                         join ur in UserManager.Users on r.CreatorUserId equals ur.Id into urJoined
                         from ur in urJoined.DefaultIfEmpty()
                         join pr in UserManager.Users on r.AllPersonId equals pr.Id into prJoined
                         from pr in prJoined.DefaultIfEmpty()
                         join mr in _quotationStatusRepository.GetAll() on r.QuotationStatusId equals mr.Id into mrJoined
                         from mr in mrJoined.DefaultIfEmpty()
                         join or in _DatefilterRepository.GetAll() on r.DateFilterId equals or.Id into orJoined
                         from or in orJoined.DefaultIfEmpty()

                         where r.Id == input.Id
                         select new ViewListDto
            {
                Id = r.Id,
                Name = r.Name,
                Query = r.Query,
                CreationTime = r.CreationTime.ToString(),
                CreatedBy = ur != null ? ur.UserName : "",
                IsEditable = r.IsEditable,
                IsEnquiry = r.IsEnquiry,
                AllPersonId = r.AllPersonId,
                PersonName = pr != null ? pr.UserName : "",
                DateFilterId = r.DateFilterId,
                FilterName = or != null ? or.Name : "",
                QuotationStatusId = r.QuotationStatusId,
                StatusName = mr != null ? mr.Name : "",
                GraterAmount = r.GraterAmount,
                LessAmount = r.LessAmount,
                EnqStatusId = r.EnqStatusId,
                ClosureDateFilterId = r.ClosureDateFilterId,
                LastActivityDateFilterId = r.LastActivityDateFilterId,
                ClosureDate = r.ClosureDate,
                LastActivity = r.LastActivity,
                QuotationCreateBy = r.QuotationCreateBy,
                QuotationStatus = r.QuotationStatus,
                Salesman = r.Salesman,
                InquiryCreateBy = r.InquiryCreateBy,
                PotentialCustomer = r.PotentialCustomer,
                MileStoneName = r.MileStoneName,
                EnquiryStatus = r.EnquiryStatus,
                TeamName = r.TeamName,
                Coordinator = r.Coordinator,
                Designer = r.Designer,
                DesignationName = r.DesignationName,
                Emirates = r.Emirates,
                DepatmentName = r.DepatmentName,
                Categories = r.Categories,
                Status = r.Status,
                WhyBafco = r.WhyBafco,
                Probability = r.Probability,
                QuotationCreation = r.QuotationCreation,
                InquiryCreation = r.InquiryCreation,
                StatusForQuotation = r.StatusForQuotation,
            }).FirstOrDefault();

            output.Viewdatas = query.MapTo <ViewListDto>();
            return(output);
        }
 public async Task Delete(EntityDto input)
 {
     await _locationRepository.DeleteAsync(input.Id);
 }
 public async Task ClearCache(EntityDto <string> input)
 {
     var cache = _cacheManager.GetCache(input.Id);
     await cache.ClearAsync();
 }
Example #7
0
        public async Task ResetUserSpecificPermissions(EntityDto <long> input)
        {
            var user = await UserManager.GetUserByIdAsync(input.Id);

            await UserManager.ResetAllPermissionsAsync(user);
        }
 public async Task DeletePerson(EntityDto input)
 {
     await _personRepository.DeleteAsync(input.Id);
 }
 public async Task Delete(EntityDto input)
 {
     await _cruiseReductionsRepository.DeleteAsync(input.Id);
 }
Example #10
0
        public async Task <GetUserPermissionsForEditOutput> GetUserPermissionsForEdit(EntityDto <long> input)
        {
            var user = await UserManager.GetUserByIdAsync(input.Id);

            var permissions        = PermissionManager.GetAllPermissions();
            var grantedPermissions = await UserManager.GetGrantedPermissionsAsync(user);

            return(new GetUserPermissionsForEditOutput
            {
                Permissions = ObjectMapper.Map <List <FlatPermissionDto> >(permissions).OrderBy(p => p.DisplayName).ToList(),
                GrantedPermissionNames = grantedPermissions.Select(p => p.Name).ToList()
            });
        }
        public async Task <GetCruiseReductionsForEditOutput> GetCruiseReductionsForEdit(EntityDto input)
        {
            CruiseReduction cruiseReductions = await _cruiseReductionsRepository.FirstOrDefaultAsync(input.Id);

            GetCruiseReductionsForEditOutput output = new GetCruiseReductionsForEditOutput {
                CruiseReductions = ObjectMapper.Map <CreateOrEditCruiseReductionsDto>(cruiseReductions)
            };

            if (output.CruiseReductions.ServicesId != null)
            {
                CruiseService _lookupCruiseServices = await _lookup_cruiseServicesRepository.FirstOrDefaultAsync(output.CruiseReductions.ServicesId);

                output.CruiseServicesServiceName = _lookupCruiseServices.ServiceName.ToString();
            }

            if (output.CruiseReductions.AgePoliciesId != null)
            {
                AgePolicy _lookupAgePolicies = await _lookup_agePoliciesRepository.FirstOrDefaultAsync(output.CruiseReductions.AgePoliciesId);

                output.AgePoliciesTenantId = _lookupAgePolicies.TenantId.ToString();
            }

            return(output);
        }
Example #12
0
 public async Task UnlockUser(EntityDto <long> input)
 {
     await ApiClient.PostAsync(GetEndpoint(nameof(UnlockUser)), input);
 }
Example #13
0
 public async Task DeleteUser(EntityDto <long> input)
 {
     await ApiClient.DeleteAsync(GetEndpoint(nameof(DeleteUser)), input);
 }
        private  void AddCoupons(string eventId, IEnumerable<CouponTypeDto> couponTypes, IEnumerable<SupportTypeDto> supportTypes, IMyMentorRepository repository, EntityDto[] entities, IEnumerable<CouponStatusDto> couponStatuses, List<AccountStatementViewModel> accountStatementVm, string nisCurrencySymbol)
        {
            IEnumerable<Coupon> coupons = Task.Run(() => repository.FindCouponsInEvent(eventId)).Result;

            foreach (var coupon in coupons)
            {
                var asvm = new AccountStatementViewModel();
                asvm.Id = coupon.ObjectId;
                asvm.Type = entities.FindEntityName(EntityKeys.Coupons);
                asvm.UserName = coupon.IssuedBy.GetFullName(Language.CurrentLanguageCode);
                asvm.DueDate = coupon.CreatedAt.HasValue ? coupon.CreatedAt.Value : DateTime.MinValue;
                asvm.TransActionDate = coupon.CreatedAt.HasValue ? coupon.CreatedAt.Value : DateTime.MinValue;
                asvm.Item = coupon.GetItemName(entities);
                asvm.Status = couponStatuses.First(x => x.CouponStatusCode.ToLower() == coupon.CouponStatus.ToLower()).GetLocalizedField("CouponStatus");
                asvm.Amount = coupon.GetFormattedAmount();
                asvm.AmountNis = coupon.GetFormattedAmountNis();
                asvm.Balance = coupon.GetFormattedBalance();
                asvm.BalanceNis = coupon.GetFormattedBalanceNis();
                asvm.Remarks = coupon.CouponType;
                asvm.AmountClassName = "azure";
                asvm.CreatedAt = coupon.CreatedAt.Value;
                asvm.Coupon = GetCouponView(coupon, couponTypes, supportTypes, couponStatuses, nisCurrencySymbol);
                accountStatementVm.Add(asvm);
            }
        }
Example #15
0
        public async Task UnlockUser(EntityDto <long> input)
        {
            var user = await UserManager.GetUserByIdAsync(input.Id);

            user.Unlock();
        }
        private string GetAccountStatementItemString(AccountStatement accountStatement, EntityDto[] entities)
        {
            var itemIdAndName = accountStatement.GetItemIdAndName();
            var entityName = accountStatement.GetEntityName(entities);
            var isCoupon = accountStatement.Coupon != null;
            var itemString = string.Empty;

            if (isCoupon)
            {
                var coupon = accountStatement.Coupon;
                var idAndName = coupon.GetCouponItemIdAndName();
                var couponItemEntityName = coupon.GetItemEntityName(entities);
                var sb = new StringBuilder();
                sb.AppendFormat("{0} {1}", entityName, itemIdAndName.Key);
                sb.AppendFormat(" {0} {1} {2} {3}", MyMentorResources.itemFor, couponItemEntityName, idAndName.Value, idAndName.Key);
                itemString = sb.ToString();
            }
            else
            {
                itemString = string.Format("{0} {1} {2}", entityName, itemIdAndName.Key, itemIdAndName.Value);
            }
            return itemString;
        }
Example #17
0
        /// <summary>
        /// 运维专用:获取特定租户下指定角色的全部用户
        /// </summary>
        /// <param name="tenantId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <List <UserDto> > GetUsersInRoleInTenantAsync(int tenantId, EntityDto <int> input)
        {
            using (CurrentUnitOfWork.SetTenantId(tenantId))
            {
                var role = await _roleManager.GetRoleByIdAsync(input.Id);

                if (role == null)
                {
                    throw new UserFriendlyException(L("RoleNotFound", input.Id));
                }

                var users = await _userManager.GetUsersInRoleAsync(role.Name);

                return(ObjectMapper.Map <List <UserDto> >(users));
            }
        }
Example #18
0
 public async Task ResetUserSpecificPermissions(EntityDto <long> input)
 {
     await ApiClient.PostAsync(GetEndpoint(nameof(ResetUserSpecificPermissions)), input);
 }
Example #19
0
 public override Task Delete(EntityDto <int> input)
 {
     return(base.Delete(input));
 }
Example #20
0
 // <summary>
 /// 逻辑删除实体
 /// </summary>
 /// <param name="input">主键</param>
 /// <returns></returns>
 public async Task Delete(EntityDto <Guid> input)
 {
     await _repository.DeleteAsync(x => x.Id == input.Id);
 }
Example #21
0
        public async Task <PublicNoteDto> GetNote(EntityDto <int> input)
        {
            var note = await Repository.GetAsync(input.Id);

            return(ObjectMapper.Map <PublicNoteDto>(note));
        }
Example #22
0
 public async Task Delete(EntityDto input)
 {
     await _paymentMethodRepository.DeleteAsync(input.Id);
 }
Example #23
0
 public async Task ResetTenantSpecificFeatures(EntityDto input)
 {
     await TenantManager.ResetAllFeaturesAsync(input.Id);
 }
Example #24
0
 public async Task DeleteReportColumn(EntityDto input)
 {
     await _ReportColumnRepository.DeleteAsync(input.Id);
 }
Example #25
0
        public async Task DeleteTenant(EntityDto input)
        {
            var tenant = await TenantManager.GetByIdAsync(input.Id);

            await TenantManager.DeleteAsync(tenant);
        }
Example #26
0
        public override async Task Delete(EntityDto <long> input)
        {
            var user = await _userManager.GetUserByIdAsync(input.Id);

            await _userManager.DeleteAsync(user);
        }
Example #27
0
        public async Task CancelAsync(EntityDto <Guid> input)
        {
            var @event = await _eventManager.GetAsync(input.Id);

            _eventManager.Cancel(@event);
        }
Example #28
0
 public async Task Delete(EntityDto input)
 {
     await _tinhThanhRepository.DeleteAsync(input.Id);
 }
Example #29
0
        public async Task DeleteEdition(EntityDto input)
        {
            var edition = await _editionManager.GetByIdAsync(input.Id);

            await _editionManager.DeleteAsync(edition);
        }
 private void AddEvent(EntityDto[] entities, string nisCurrencySymbol, List<AccountStatementViewModel> accountStatementVm, Event eventrecord,
     string action)
 {
     accountStatementVm.Add(new AccountStatementViewModel
     {
         Id = eventrecord.ObjectId,
         Type = entities.FindEntityName(EntityKeys.Events),
         UserName = eventrecord.User.GetFullName(Language.CurrentLanguageCode),
         DueDate = eventrecord.CreatedAt.HasValue ? eventrecord.CreatedAt.Value : DateTime.MinValue,
         TransActionDate = eventrecord.CreatedAt.HasValue ? eventrecord.CreatedAt.Value : DateTime.MinValue,
         Action = action,
         Status = eventrecord.EventStatus,
         Item = eventrecord.GetItemData(),
         CreatedAt = eventrecord.CreatedAt.Value,
         EventData = GetEventData(eventrecord),
         Amount = eventrecord.GetFormattedPayment(),
         AmountNis =
             eventrecord.PaymentAmountNIS != 0.0
                 ? eventrecord.PaymentAmountNIS.ToCurrency(nisCurrencySymbol)
                 : string.Empty
     });
 }
Example #31
0
 /// <summary>
 /// 删除车辆管理
 /// </summary>
 public async Task DeleteCarAsync(EntityDto <int> input)
 {
     await _carRepository.DeleteAsync(input.Id);
 }
 private AccountStatementViewModel[] GetAccountStatements(
     IEnumerable<AccountStatement> accountStatements, EntityDto[] entities, 
     IEnumerable<EventTypeDto> eventTypes, IEnumerable<TransactionTypeDto> transactionTypes, 
     IEnumerable<CouponTypeDto> couponTypes, IEnumerable<SupportTypeDto> supportTypes, 
     IEnumerable<CouponStatusDto> couponStatuses, string nisCurrencySymbol, IEnumerable<Purchase> purchases, 
     IEnumerable<ClipStatus> clipStatuses, PurchaseStatusDto[] purchaseStatuses)
 {
     
     return accountStatements.Select(accountStatement =>
     {
         var eventTypeCode = accountStatement.GetPointerValue<string>("event", "eventType");
         var transactionTypeCode = accountStatement.GetPointerValue<string>("transactionType", "transactionCode");
         return new AccountStatementViewModel
         {
             Id = accountStatement.ObjectId,
             Type = entities.FindEntityName(EntityKeys.AccountStatement),
             UserName = accountStatement.User.GetFullName(Language.CurrentLanguageCode),
             TransActionDate = accountStatement.TransactionDate,
             DueDate = accountStatement.DueDate,
             Action = GetAccountStatementActionString(eventTypeCode, transactionTypeCode, eventTypes, transactionTypes),
             Item =GetAccountStatementItemString(accountStatement, entities),
             Status = string.Empty,
             Amount = accountStatement.GetFormattedAmount(),
             AmountNis = accountStatement.GetAmountNis(),
             Balance = accountStatement.GetFormattedBalance(),
             BalanceNis = accountStatement.BalanceNIS.ToCurrency(nisCurrencySymbol),
             HasCredit = accountStatement.Balance >= 0,
             ActionType = accountStatement.GetActionType(),
             Remarks = accountStatement.GetLocalizedField("accountStatementRemarks"),
             Coupon =GetCouponView(accountStatement.Coupon, couponTypes, supportTypes, couponStatuses, nisCurrencySymbol),
             Lesson = GetLessonPurchaseView(accountStatement.Lesson, purchases, nisCurrencySymbol, clipStatuses, purchaseStatuses, accountStatement.Event.ObjectId),
             Bundle = GetBundlePurchaseView(accountStatement.Bundle, purchases, nisCurrencySymbol, clipStatuses, purchaseStatuses, accountStatement.Event.ObjectId),
             EventData = GetEventData(accountStatement.Event),
             CreatedAt = accountStatement.CreatedAt.Value,
            
         };
     }).ToArray();
 }
Example #33
0
        /// <summary>
        /// 通过指定id获取车辆管理ListDto信息
        /// </summary>
        public async Task <CarListDto> GetCarByIdAsync(EntityDto <int> input)
        {
            var entity = await _carRepository.GetAsync(input.Id);

            return(entity.MapTo <CarListDto>());
        }
        private AccountStatementViewModel[] GetStatementsByEventId(string eventId, IMyMentorRepository repository, EntityDto[] entities, 
            IEnumerable<CouponStatusDto> couponStatuses, EventTypeDto[] eventTypes, 
            IEnumerable<TransactionTypeDto> transactionTypes, IEnumerable<CouponTypeDto> couponTypes, 
            IEnumerable<SupportTypeDto> supportTypes, string nisCurrencySymbol)
        {
            var accountStatementVm = new List<AccountStatementViewModel>();
            var clipStatuses = repository.FindClipStatuses();            
            var purchaseStatuses = repository.FindPurchaseStatues().ToArray();

            Event eventrecord = null;
            eventrecord = Task.Run(() => repository.FindEventById(eventId)).Result;

            if (eventrecord == null)
            {
                return new AccountStatementViewModel[0];
            }

            var eventType = eventTypes.FirstOrDefault(x => x.EventTypeKey == eventrecord.EventType);
            var action = eventType != null ? eventType.GetLocalizedField("EventType") : string.Empty;

            // add event
            AddEvent(entities, nisCurrencySymbol, accountStatementVm, eventrecord, action);

            // add coupons
            AddCoupons(eventId, couponTypes, supportTypes, repository, entities, couponStatuses, accountStatementVm, nisCurrencySymbol);

            IEnumerable<Purchase> purchases = repository.FindPurchasesByEventId(eventId);

            // add account statements
            IEnumerable<AccountStatement> accountStatements =  Task.Run(() => repository.FindAccountStatementsByEventId(eventId)).Result;
            var accountStatementViewModels = 
                GetAccountStatements(
                accountStatements, entities, 
                eventTypes, transactionTypes, 
                couponTypes, supportTypes, 
                couponStatuses, nisCurrencySymbol,
                purchases, clipStatuses, purchaseStatuses);
            accountStatementVm.AddRange(accountStatementViewModels);
            
            // add purchases                       
            foreach (var purchase in purchases)
            {
                accountStatementVm.Add(new AccountStatementViewModel
                {
                    Id = purchase.ObjectId,
                    Type = entities.FindEntityName(EntityKeys.Purchases),                    
                    UserName = purchase.UserKey.GetFullName(Language.CurrentLanguageCode),
                    CreatedAt = purchase.UpdatedAt.HasValue ? purchase.UpdatedAt.Value : DateTime.MinValue,
                    DueDate = purchase.UpdatedAt.HasValue ? purchase.UpdatedAt.Value : DateTime.MinValue,
                    Item = purchase.GetItemName(entities),
                    Status = purchaseStatuses.Single(x=>x.StatusCode.ToLower() == purchase.PurchaseStatusCode.ToLower()).GetLocalizedField("purchaseStatus"),
                    Amount = purchase.GetFormattedPrice(),
                    AmountNis = purchase.GetFormattedPriceNis(),
                    AmountClassName = "azure",
                    Remarks = purchase.GetLocalizedField("purchaseRemarks"),
                    Lesson = GetLessonPurchaseView(purchase.ClipKey, purchases, nisCurrencySymbol, clipStatuses, purchaseStatuses, purchase.Event.ObjectId),
                    Bundle = GetBundlePurchaseView(purchase.BundleKey, purchases, nisCurrencySymbol, clipStatuses, purchaseStatuses,purchase.Event.ObjectId),
                    EventData = GetEventData(purchase.Event),
                    Action = action
                });    
            }
            
            return accountStatementVm.ToArray();
        }
        public async Task <PagedResultDto <MpMediaArticleGroupItemDto> > GetGroupItemList(EntityDto <int> input)
        {
            if (input.Id > 0)
            {
                var MPID = await _userMpAppService.GetDefaultMpId();

                var ItemList = await _ItemRepository.GetAllListAsync(c => c.IsDeleted == false && c.GroupID == input.Id && c.MpID == MPID);

                var ListSortIndex = ItemList.OrderBy(c => c.SortIndex); // 排序
                var List          = ObjectMapper.Map <List <MpMediaArticleGroupItemDto> >(ListSortIndex);

                return(new PagedResultDto <MpMediaArticleGroupItemDto>(List.Count, List));
            }
            else
            {
                return(new PagedResultDto <MpMediaArticleGroupItemDto>());
            }
        }
 public string TestPrimitiveMethod(int a, string b, EntityDto c)
 {
     return a + "#" + b + "#" + c.Id;
 }
Example #37
0
 public async Task <GetUserPermissionsForEditOutput> GetUserPermissionsForEdit(EntityDto <long> input)
 {
     return(await ApiClient.GetAsync <GetUserPermissionsForEditOutput>(GetEndpoint(nameof(GetUserPermissionsForEdit)), input));
 }