public DemoLeadService( IReferralLeadRepository referralLeadRepository, ISettingsService settingsService, INotificationPublisherService notificationPublisherService, IHashingManager hashingManager, IAgentManagementClient agentManagementClient, ICustomerProfileClient customerProfileClient, IDictionariesClient dictionariesClient, CommissionManager commissionManager, ILogFactory logFactory, int delay, IOfferToPurchasePurchaseRepository offerToPurchasePurchaseRepository, IRabbitPublisher <PropertyLeadApprovedReferralEvent> propertyLeadApprovedReferralPublisher, IRabbitPublisher <OfferToPurchaseByLeadEvent> offerToPurchasePublisher, IRabbitPublisher <LeadStateChangedEvent> leadStateChangedPublisher, IMapper mapper, IPropertyPurchaseRepository propertyPurchaseRepository) { _referralLeadRepository = referralLeadRepository; _settingsService = settingsService; _notificationPublisherService = notificationPublisherService; _hashingManager = hashingManager; _agentManagementClient = agentManagementClient; _customerProfileClient = customerProfileClient; _dictionariesClient = dictionariesClient; _commissionManager = commissionManager; _delay = delay; _offerToPurchasePurchaseRepository = offerToPurchasePurchaseRepository; _propertyLeadApprovedReferralPublisher = propertyLeadApprovedReferralPublisher; _offerToPurchasePublisher = offerToPurchasePublisher; _leadStateChangedPublisher = leadStateChangedPublisher; _propertyPurchaseRepository = propertyPurchaseRepository; _mapper = mapper; _log = logFactory.CreateLog(this); }
public ActionResult Detail(int detailId = 0) { PoDetailViewModel model = new PoDetailViewModel(); PoManager manager = new PoManager(); EmployeeManager empManager = new EmployeeManager(); CommissionManager comManager = new CommissionManager(); if (detailId > 0) { ViewBag.Action = "Edit"; int currentProfilerId = 0; // if role is not "Able" then has to get profilerId if (Helper.UserRole != "1") { currentProfilerId = empManager.GetEmployeeDetail(0).ProfileId; } model = manager.GetPoDetail(detailId); if (currentProfilerId.Equals(model.SalesProfileId1) || currentProfilerId.Equals(model.SalesProfileId2) || currentProfilerId.Equals(model.SalesProfileId3)) { model.IsOwner = true; } else { model.IsOwner = false; } } else { ViewBag.Action = "New"; model = manager.MappingCommissionDetail(model); model.IsOwner = true; model.PoDate = DateTime.UtcNow; model.CommissionRate = comManager.GetCommissionRate(false); } // Set config model.CommissionPayRate = Helper.CommissionPayRate; model.CommissionForSale = Helper.CommissionForSale; // Set Lookup List <LookupModel> lookupEmployee = new List <LookupModel> { new LookupModel { Key = "-1", Value = "Please select employee" } }; lookupEmployee.AddRange(empManager.GetLookup()); model.LookupEmployee = lookupEmployee; model.LookupProductType = Helper.LookupProductType; model.LookupProductBrand = Helper.LookupProductBrand; model.LookupTransportLocation = Helper.LookupTransportationProvince; model.LookupPosition = Helper.LookupPosition; return(View(model)); }
public async Task ChangeOrCreateCommission([FromBody] ChangeCommissionRequest request) { var currencyId = (await _context.Currencies.FirstOrDefaultAsync(c => c.Name == request.CurrencyName)).Id; var userId = request.UserName == null ? null : (await _context.Users.FirstOrDefaultAsync(c => c.UserName == request.UserName)).Id; var commission = await _context.Commissions.FirstOrDefaultAsync(c => c.OperationType == request.Type && c.CurrencyId == currencyId && c.UserId == userId); var dto = request.CommissionDto; if (commission == null) { commission = CommissionManager.CreateCommission(currencyId, dto, request.Type, userId); await _context.AddAsync(commission); } else { commission.Rate = dto.Rate; commission.Value = dto.Value; commission.MaxCommission = dto.MaximalCommission; commission.MinCommission = dto.MinimalCommission; commission.Type = dto.Type; commission.MaxValue = dto.MaxOperationValue; } await _context.SaveChangesAsync(); }
public ActionResult Rate() { CommissionManager manager = new CommissionManager(); CommissionRateViewModel model = manager.GetCommissionRate(); return(View(model)); }
public ActionResult List(DateTime dateFrom, DateTime dateTo, int profileId = -1, int roleId = -1) { CommissionManager manager = new CommissionManager(); EmployeeManager empManager = new EmployeeManager(); CommissionCollectionViewModel model = new CommissionCollectionViewModel { SearchDateFrom = dateFrom, SearchDateTo = dateTo, SearchProfileId = profileId, SearchRoleId = roleId }; model = profileId > 0 ? manager.GetCommissionList(model) : manager.GetCommissionList(model, int.Parse(Helper.UserId)); List <LookupModel> lookupEmployee = new List <LookupModel> { new LookupModel { Key = "-1", Value = "---- Employee ----" } }; lookupEmployee.AddRange(empManager.GetLookup()); model.LookupEmployee = lookupEmployee; model.LookupPosition = Helper.LookupPosition; return(PartialView("List", model)); }
public ActionResult Index(int userId = -1) { CommissionManager manager = new CommissionManager(); EmployeeManager empManager = new EmployeeManager(); CommissionCollectionViewModel model = new CommissionCollectionViewModel { SearchDateFrom = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1), SearchDateTo = DateTime.UtcNow, SearchProfileId = -1, SearchRoleId = -1, CommissionViewCollection = new List <CommissionViewModel>() }; if (userId > 0) { model = manager.GetCommissionList(model, userId); } List <LookupModel> lookupEmployee = new List <LookupModel> { new LookupModel { Key = "-1", Value = "---- Employee ----" } }; lookupEmployee.AddRange(empManager.GetLookup()); model.LookupEmployee = lookupEmployee; model.LookupPosition = Helper.LookupPosition; return(View(model)); }
public ActionResult PrintReport(DateTime dateFrom, DateTime dateTo, int profileId = -1, int roleId = -1) { try { FastReportManager FastReportManager = new FastReportManager(); CommissionManager manager = new CommissionManager(); EmployeeManager empManager = new EmployeeManager(); CommissionCollectionViewModel model = new CommissionCollectionViewModel { SearchDateFrom = dateFrom, SearchDateTo = dateTo, SearchProfileId = profileId, SearchRoleId = roleId }; model = profileId > 0 ? manager.GetCommissionList(model) : manager.GetCommissionList(model, int.Parse(Helper.UserId)); List <LookupModel> lookupEmployee = new List <LookupModel> { new LookupModel { Key = "-1", Value = "---- Employee ----" } }; lookupEmployee.AddRange(empManager.GetLookup()); model.LookupEmployee = lookupEmployee; model.LookupPosition = Helper.LookupPosition; byte[] strm = FastReportManager.GenPDFFile(Request.PhysicalApplicationPath + "Reports/ReportCommission.frx", model).ToArray(); return(File(strm, "application/pdf", "Report.pdf")); } catch (Exception e) { return(null); } }
public PropertyPurchaseService( IReferralLeadRepository referralLeadRepository, IPropertyPurchaseRepository propertyPurchaseRepository, IStakeService stakeService, CommissionManager commissionManager) { _referralLeadRepository = referralLeadRepository; _propertyPurchaseRepository = propertyPurchaseRepository; _stakeService = stakeService; _commissionManager = commissionManager; }
/// <summary> /// Создать <see cref="ManagedMessageAdapter"/>. /// </summary> /// <param name="innerAdapter">Адаптер, в который будут перенаправляться сообщения.</param> public ManagedMessageAdapter(IMessageAdapter innerAdapter) { if (innerAdapter == null) { throw new ArgumentNullException("innerAdapter"); } _innerAdapter = innerAdapter; _innerAdapter.NewOutMessage += ProcessOutMessage; CommissionManager = new CommissionManager(); LatencyManager = new LatencyManager(); RiskManager = new RiskManager(); }
public ActionResult EditRate(CommissionRateViewModel model) { try { CommissionManager manager = new CommissionManager(); manager.UpdateCommissionRate(model); } catch (Exception e) { return(Json(new { Result = false, Message = e.Message })); } return(Json(new { Result = true })); }
private void ProcessExecution(Message message) { if (message.Type != MessageTypes.Execution) { return; } var execMsg = (ExecutionMessage)message; var latency = LatencyManager.ProcessMessage(execMsg); if (latency != null) { execMsg.Latency = latency; } if (execMsg.Commission == null) { execMsg.Commission = CommissionManager.ProcessExecution(execMsg); } }
void IMessageChannel.SendInMessage(Message message) { if (message.LocalTime.IsDefault()) { message.LocalTime = _innerAdapter.CurrentTime.LocalDateTime; } if (message.Type == MessageTypes.Connect) { LatencyManager.Reset(); CommissionManager.Reset(); RiskManager.Reset(); } else { LatencyManager.ProcessMessage(message); ProcessRisk(message); } _innerAdapter.SendInMessage(message); }
public TransferOperationService(WalletContext context, CommissionManager commissionManager) : base(context, commissionManager, OperationType.Transfer) { }
public WithdrawalOperationService(WalletContext context, CommissionManager commissionManager) : base(context, commissionManager, OperationType.Withdrawal) { }
public DepositOperationService(WalletContext context, CommissionManager commissionManager) : base(context, commissionManager, OperationType.Deposit) { }
protected OperationServiceBase(WalletContext context, CommissionManager commissionManager, OperationType type) { Context = context; Type = type; CommissionManager = commissionManager; }