public async Task ProductAssigned(Guid accountId, ViewOwnerProduct product, Account targetUser) { if (object.Equals(targetUser, null) || targetUser.Id == accountId) { return; } var ownerUser = await _auth.AccountGetAsync(accountId); var targetUserNotification = await CreateNotification(targetUser); var ownerUserNotification = await CreateNotification(ownerUser); var notification = new ProductAssignedNotification(targetUserNotification, product.ProductName, ownerUserNotification); if (targetUser.IsEmptyPassword()) { var uri = await _auth.GeneratePasswordResetTokenLinkAsync(targetUser, _settings.CreatePassword); notification.CreatePasswordLink = uri.ToString(); } if (product.IsPPC) { await _repository.SendProductEditionAssignedNotification(notification); } else { await _repository.SendProductAssignedNotification(notification); } }
public async Task ProductUnassigned(Guid accountId, ViewOwnerProduct product, Account targetUser) { if (object.Equals(targetUser, null) || targetUser.Id == accountId) { return; } var ownerUser = await _auth.AccountGetAsync(accountId); var targetUserNotification = await CreateNotification(targetUser); var ownerUserNotification = await CreateNotification(ownerUser); var notification = new ProductAssignedNotification(targetUserNotification, product.ProductName, ownerUserNotification); await _repository.SendProductUnassignedNotification(notification); }
public static OwnerProductViewModel OwnerAccountProductConvertor(ViewOwnerProduct product) { var newProduct = new OwnerProductViewModel(); newProduct = Mapper.Map(product, newProduct); newProduct.Modules = new List <AccountProductModuleModel>(); //create fake modules if (product.AllowedEsignCount.GetValueOrDefault(int.MaxValue) > 0) { newProduct.Modules.Add(new AccountProductModuleModel { Module = "e-sign", Allowed = product.AllowedEsignCount, Used = product.UsedEsignCount }); } return(newProduct); }
public async Task ProductSuspend(Guid accountId, ViewOwnerProduct product, DateTime?nextRebillDate) { if (nextRebillDate.HasValue) { return; } if (product.EndDate.HasValue && product.EndDate.Value > DateTime.UtcNow && (product.EndDate.Value - DateTime.UtcNow).TotalDays <= 10) { return; } var targetUser = await _auth.AccountGetAsync(accountId); var targetUserNotification = await CreateNotification(targetUser); var productSuspendNotification = new ProductSuspendNotification(targetUserNotification, product.ProductName, product.EndDate); await _repository.SendProductSuspendNotification(productSuspendNotification); }