public void AddDeal(IDeal deal) { lock (list) { Get(deal.Symbol).Value += (int)deal.BuySell * deal.Value; } }
public readonly IList <IDeal> Deals = new List <IDeal>(); // надеюсь менять сделки в результате никто не дадумается :) public void AddDeal(IDeal deal) { lock (Deals) { Deals.Add(deal); } }
public MenuWriter(IWriteClass writer, IDeal deal, IPlayersHand playersHand, IShowPlayers showPlayer) { _writer = writer; _deal = deal; _playersHand = playersHand; _showPlayers = showPlayer; }
public static DealEntity Create(IDeal deal) { return(new DealEntity { DealId = deal.DealId, Created = deal.Created, AccountId = deal.AccountId, AssetPairId = deal.AssetPairId, OpenTradeId = deal.OpenTradeId, OpenOrderType = deal.OpenOrderType.ToString(), OpenOrderVolume = deal.OpenOrderVolume, OpenOrderExpectedPrice = deal.OpenOrderExpectedPrice, CloseTradeId = deal.CloseTradeId, CloseOrderType = deal.CloseOrderType.ToString(), CloseOrderVolume = deal.CloseOrderVolume, CloseOrderExpectedPrice = deal.CloseOrderExpectedPrice, Direction = deal.Direction.ToString(), Volume = deal.Volume, Originator = deal.Originator.ToString(), OpenPrice = deal.OpenPrice, OpenFxPrice = deal.OpenFxPrice, ClosePrice = deal.ClosePrice, CloseFxPrice = deal.CloseFxPrice, Fpl = deal.Fpl, AdditionalInfo = deal.AdditionalInfo, PnlOfTheLastDay = deal.PnlOfTheLastDay, CorrelationId = deal.CorrelationId }); }
protected override void ApproveDeal(IDeal deal, BaseApprArgs args) { var orpArgs = (ORPTeamApprArgs)args; deal.ORPType = orpArgs.ORPType; deal.Switch(deal.ORPType == ORPType.SMB ? WorkFlowStep.ISOAdmin : WorkFlowStep.SalesOperation); deal.Save(); }
protected void AssertApproval(IDeal d, IApproval approval, int action) { Assert.AreEqual(d.Id, approval.DealId); Assert.AreEqual(CurrentStep, approval.Step); Assert.AreEqual(action, approval.ApprovalAction); Assert.AreEqual(Comment, approval.Comment); }
public virtual IApproval AssignWrong(IDeal deal, BaseApprArgs args) { IApproval lastAppr = WorkFlowManager.WorkFlowFactory.GetLastApproval(deal); deal.Switch(lastAppr.Step); deal.Save(); return CreateApproval(deal.Id, args.ActionUser, ApprovalAction.AssignWrong, args.Comment); }
public IEnumerable <DealsModels.DealViewModel> RelatedDeals(int DealID) { dealServices = new DealServices(new DealsDB()); IEnumerable <DealsModels.DealViewModel> DealList = dealServices.AllDeal().Where(x => x.DealId != DealID).OrderBy(x => Guid.NewGuid()).Take(3); return(DealList); }
protected override void ApproveDeal(IDeal deal, BaseApprArgs args) { var soArgs = (SalesOperationApprArgs)args; deal.Industry2 = soArgs.Industry2; deal.Province2 = soArgs.Province2; deal.CurrentStep = WorkFlowStep.ChannelManager; deal.Save(); }
protected override void ApproveDeal(IDeal deal, BaseApprArgs args) { var isoArgs = (IsoAdminApprArgs)args; deal.Industry2 = isoArgs.Industry2; deal.Province2 = isoArgs.Province2; deal.Switch(WorkFlowStep.InsideSales); deal.Save(); }
public virtual IApproval Approve(IDeal deal, BaseApprArgs args) { ApproveDeal(deal, args); var rslt = CreateApproval(deal.Id, args.ActionUser, ApprovalAction.Approve, args.Comment); AdditionOpeation(deal, rslt, args); SendNotifcationMail(deal, args); return rslt; }
public async Task AddAsync(IPositionHistory positionHistory, IDeal deal) { var entity = _convertService.Convert <IPositionHistory, PositionHistoryEntity>(positionHistory, o => o.ConfigureMap(MemberList.Source)); entity.Timestamp = DateTimeOffset.UtcNow; await _tableStorage.InsertOrReplaceAsync(entity); }
protected override void AdditionOpeation(IDeal deal, IApproval approval, BaseApprArgs args) { var stArgs = (SalesTeamApprArgs)args; var answer = WorkFlowManager.WorkFlowFactory.CreateAnswer(); answer.DealId = deal.Id; answer.ApprovalId = approval.Id; answer.QuestionId = stArgs.QuestionId; answer.Answer = stArgs.Answer; WorkFlowManager.DataFactory.SaveAnswer(answer); }
public static DealDataModel ToDataModel(this IDeal deal) { return(new DealDataModel() { CustomerName = deal.CustomerName, DealershipName = deal.DealershipName, DealNumber = deal.DealNumber, Price = deal.Price, SoldDate = deal.SoldDate, Vehicle = deal.Vehicle }); }
public ActionResult ViewDeal() { if (RouteData.Values["id"] != null) { int ID = Convert.ToInt32(RouteData.Values["id"].ToString()); dealServices = new DealServices(new DealsDB()); ViewSingleDeal SingleDeal = dealServices.GetSingleDeal(ID); ViewBag.Message = " "; dealServices.Dispose(); return(View("Index", SingleDeal)); } return(RedirectToAction("Index", "Home")); }
public IApproval GetLastApproval(IDeal deal) { switch (deal.CurrentStep) { case WorkFlowStep.SalesOperation: return new TestApproval { DealId = deal.Id, Step = WorkFlowStep.ORPTeam }; case WorkFlowStep.ISOAdmin: return new TestApproval { DealId = deal.Id, Step = WorkFlowStep.ORPTeam }; case WorkFlowStep.ChannelManager: return new TestApproval { DealId = deal.Id, Step = WorkFlowStep.SalesOperation }; case WorkFlowStep.InsideSales: return new TestApproval { DealId = deal.Id, Step = WorkFlowStep.ISOAdmin }; case WorkFlowStep.ChannelDirector: return new TestApproval { DealId = deal.Id, Step = WorkFlowStep.SalesTeam }; } return WorkFlowManager.DataFactory.GetApprovals().Last(a => a.DealId == deal.Id); }
public void Handle(IDeal d) { if (ohlc.Open == 0 || d.When < ohlc.WhenInDt) { ohlc.Open = (double)d.Price; } if (ohlc.High == 0 || (double)d.Price > ohlc.High) { ohlc.High = (double)d.Price; } if (ohlc.Low == 0 || (double)d.Price < ohlc.Low) { ohlc.Low = (double)d.Price; } if (ohlc.Close == 0 || d.When >= ohlc.WhenInDt) { ohlc.Close = (double)d.Price; } ohlc.Volume += (double)d.DealCount; }
public void Handle(IDeal d) { if (!dic.ContainsKey(d.WhatById)) { if (!dic.ContainsKey(d.WhatById)) { var td = new Dictionary <OhlcType, OhlcMaker>(); td.Add(OhlcType.M5, new OhlcMaker(d.WhatById, OhlcType.M5)); td.Add(OhlcType.M15, new OhlcMaker(d.WhatById, OhlcType.M15)); td.Add(OhlcType.M30, new OhlcMaker(d.WhatById, OhlcType.M30)); td.Add(OhlcType.M60, new OhlcMaker(d.WhatById, OhlcType.M60)); td.Add(OhlcType.M480, new OhlcMaker(d.WhatById, OhlcType.M480)); td.Add(OhlcType.M1440, new OhlcMaker(d.WhatById, OhlcType.M1440)); dic.Add(d.WhatById, td); } } foreach (var v in dic[d.WhatById].Values) { v.Handle(d); } }
public async Task AddAsync(IPositionHistory positionHistory, IDeal deal) { await TransactionWrapperExtensions.RunInTransactionAsync( (conn, transaction) => DoAdd(conn, transaction, positionHistory, deal), _connectionString, RollbackExceptionHandler, commitException => CommitExceptionHandler(commitException, positionHistory, deal)); if (deal != null) { Task.Run(async() => { using (var conn = new SqlConnection(_connectionString)) { try { await conn.ExecuteAsync("[dbo].[UpdateDealCommissionParamsOnDeal]", new { deal.DealId, deal.OpenTradeId, deal.OpenOrderVolume, deal.CloseTradeId, deal.CloseOrderVolume, deal.Volume, }, commandType: CommandType.StoredProcedure); } catch (Exception e) { await _log.WriteErrorAsync(nameof(PositionsHistorySqlRepository), nameof(AddAsync), $"Failed to calculate commissions for the deal {deal.DealId}, skipping.", e); } } }); } }
private async Task DoAdd(SqlConnection conn, SqlTransaction transaction, IPositionHistory positionHistory, IDeal deal) { var positionEntity = PositionsHistoryEntity.Create(positionHistory); await conn.ExecuteAsync($"insert into {TableName} ({GetColumns}) values ({GetFields})", positionEntity, transaction); if (deal != null) { var entity = DealEntity.Create(deal); await conn.ExecuteAsync( $@"INSERT INTO [dbo].[Deals] ({string.Join(",", DealsSqlRepository.DealInsertColumns)}) VALUES (@{string.Join(",@", DealsSqlRepository.DealInsertColumns)})", new { entity.DealId, entity.Created, entity.AccountId, entity.AssetPairId, entity.OpenTradeId, entity.OpenOrderType, entity.OpenOrderVolume, entity.OpenOrderExpectedPrice, entity.CloseTradeId, entity.CloseOrderType, entity.CloseOrderVolume, entity.CloseOrderExpectedPrice, entity.Direction, entity.Volume, entity.Originator, entity.OpenPrice, entity.OpenFxPrice, entity.ClosePrice, entity.CloseFxPrice, entity.Fpl, entity.PnlOfTheLastDay, entity.AdditionalInfo, entity.CorrelationId }, transaction); await conn.ExecuteAsync("INSERT INTO [dbo].[DealCommissionParams] (DealId) VALUES (@DealId)", new { deal.DealId }, transaction); } }
protected abstract void ApproveDeal(IDeal deal, BaseApprArgs args);
private DealContract Convert(IDeal deal) { return(_convertService.Convert <IDeal, DealContract>(deal, opts => opts.ConfigureMap() .ForMember(x => x.Direction, o => o.ResolveUsing(z => z.Direction.ToType <PositionDirectionContract>())))); }
protected void AssertAssignWrongApproval(IDeal d, IApproval approval) { AssertApproval(d, approval, ApprovalAction.AssignWrong); }
protected void AssertDeclineApproval(IDeal d, IApproval approval) { AssertApproval(d, approval, ApprovalAction.Decline); }
public IDeal SaveDeal(IDeal deal) { return deal; }
public ActionResult CouponGenerator(ViewSingleDeal CreateCoupon) { if (Session[KeyList.SessionKeys.UserID] == null) { return(RedirectToAction("Index", "Register_Login")); } // walleservice = new UserWalletServices(new DealsDB()); walleservice = new UserWalletServices(new DealsDB()); Wallet AddTrans = walleservice.GetCreditByUserID(Convert.ToInt32(Session[DealsNZ.Helpers.KeyList.SessionKeys.UserID].ToString())); if (CreateCoupon.CouponPrice > AddTrans.WalletCredit) { walleservice.Dispose(); } else { AddTrans.UserId = Convert.ToInt32(Session[DealsNZ.Helpers.KeyList.SessionKeys.UserID].ToString()); AddTrans.WalletCredit = Convert.ToDecimal(Convert.ToDecimal(AddTrans.WalletCredit) - Convert.ToDecimal(CreateCoupon.CouponPrice)); AddTrans.WalletCreditDate = System.DateTime.Now; Wallet DealUserWallet = walleservice.GetCreditByDealUserID(CreateCoupon.DealId); DealUserWallet.WalletCredit = Convert.ToDecimal(Convert.ToDecimal(DealUserWallet.WalletCredit) + Convert.ToDecimal(CreateCoupon.CouponPrice)); if (walleservice.WalletUpdate(AddTrans) == true && walleservice.WalletUpdate(DealUserWallet) == true) { Coupon InsertCoupon = new Coupon() { CouponUniqueText = CreateCoupon.DealId.ToString() + GenerateCode(), CouponValidTill = CreateCoupon.ValidTill, CouponQty = CreateCoupon.CouponQty, CouponPrice = CreateCoupon.CouponPrice, AddedOn = System.DateTime.Now.Date, DealId = CreateCoupon.DealId, UserId = Convert.ToInt32(Session[KeyList.SessionKeys.UserID]), ReedemNo = 0 }; couponservice = new CouponService(new DealsDB()); couponservice.Insert(InsertCoupon); couponservice.Dispose(); Session[KeyList.SessionKeys.WalletCredit] = walleservice.ShowWalletAmount(Convert.ToInt32(Session[DealsNZ.Helpers.KeyList.SessionKeys.UserID].ToString())); walleservice.Dispose(); string CouponBody = createEmailBody(CreateCoupon.StoreName, CreateCoupon.Address, CreateCoupon.Title, CreateCoupon.Price.ToString(), CreateCoupon.StrikePrice.ToString(), CreateCoupon.Discount.ToString(), InsertCoupon.CouponQty.ToString(), InsertCoupon.CouponValidTill.ToString(), InsertCoupon.CouponUniqueText); string Title = "Coupon For " + CreateCoupon.Title; IUserProfile UserProfileService = new UserProfileServices(new DealsDB()); if (UserProfileService.UserMail(CouponBody, Title, Session[KeyList.SessionKeys.UserEmail].ToString()) == true) { dealServices = new DealServices(new DealsDB()); ViewSingleDeal SingleDeal = dealServices.GetSingleDeal(CreateCoupon.DealId); dealServices.Dispose(); ViewBag.Message = "Check Your Mail To Get Coupon"; return(View("Index", SingleDeal)); } } else { walleservice.Dispose(); } } return(View()); }
protected void AssertApproveApproval(IDeal d, IApproval approval) { AssertApproval(d, approval, ApprovalAction.Approve); }
public void AddDeal(IDeal deal) { lock (Deals) { Deals.Add(deal); } }
public virtual IApproval Decline(IDeal deal, BaseApprArgs args) { deal.Switch(WorkFlowStep.Decline); deal.Save(); return CreateApproval(deal.Id, args.ActionUser, ApprovalAction.Decline, args.Comment); }
protected abstract void SendNotifcationMail(IDeal deal, BaseApprArgs args);
private void AssertAnswer(IDeal deal, IApproval app, IAnswer answer) { var actureAnswer = WorkFlowManager.WorkFlowFactory.GetAnswer(deal.Id, app.Id); Assert.AreEqual(deal.Id, actureAnswer.DealId); Assert.AreEqual(app.Id, actureAnswer.ApprovalId); Assert.AreEqual(answer.QuestionId, actureAnswer.QuestionId); Assert.AreEqual(answer.Answer, actureAnswer.Answer); }
protected override void ApproveDeal(IDeal deal, BaseApprArgs args) { deal.Switch(WorkFlowStep.Approve); deal.Save(); }
protected override void ApproveDeal(IDeal deal, BaseApprArgs args) { deal.Switch(deal.Size > DirectorSize ? WorkFlowStep.ChannelDirector : WorkFlowStep.Approve); deal.Save(); }
public DealsViewModel(INavigationService navigationService, IDeal service) : base(navigationService) { this.service = service; }
public Task AddAsync(IDeal obj) { return(_tableStorage.InsertAsync(_convertService.Convert <IDeal, DealEntity>(obj))); }
public void RegisterDeal(IDeal deal, int discount) { _deals.Add(new KeyValuePair <IDeal, int>(deal, discount)); }
public DealEventArgs(IDeal deal) { this.deal = deal; }
protected override void SendNotifcationMail(IDeal deal, BaseApprArgs args) { }
private Task CommitExceptionHandler(Exception exception, IPositionHistory positionHistory, IDeal deal) { var context = $"Error {exception.Message} \n" + $"Entity <{nameof(IPositionHistory)}>: \n" + positionHistory.ToJson() + " \n" + $"Entity <{nameof(IDeal)}>: \n" + deal?.ToJson(); return(_log.WriteErrorAsync(nameof(PositionsHistorySqlRepository), nameof(AddAsync), context, exception)); }
public string Save(IDeal deal) { //if (_dealRepository == null) // throw new ArgumentNullException("DealRepository cannot be null"); //if (deal.Id == Guid.Empty) //{ // // new deal // deal.DateCreated = DateTime.Now; // deal.Active = true; // deal.Id = Guid.NewGuid(); // deal.DateModified = null; // _dealRepository.Add((DF.Domain.Concrete.Deal)deal); // _dealRepository.UnitOfWork.Commit(); //} //else //{ // var oDeal = _dealRepository.Where(u => u.Id == deal.Id).SingleOrDefault(); // if (oDeal == null) // throw new ArgumentNullException("deal"); // deal.DateCreated = oDeal.DateCreated; // Magically.CopyPropertyValues(ref oDeal, (DF.Domain.Concrete.Deal)deal); // _dealRepository.UnitOfWork.Commit(); //} //return string.Format("Successfully saved deal {0} {1}", deal.FirstName, deal.LastName); return string.Empty; }
public PokerController(Deal deal) { this.deal = deal; }
protected virtual void AdditionOpeation(IDeal deal, IApproval approval, BaseApprArgs args) { }