コード例 #1
0
 public void AddDeal(IDeal deal)
 {
     lock (list)
     {
         Get(deal.Symbol).Value += (int)deal.BuySell * deal.Value;
     }
 }
コード例 #2
0
 public readonly IList <IDeal> Deals = new List <IDeal>();  // надеюсь менять сделки в результате никто не дадумается :)
 public void AddDeal(IDeal deal)
 {
     lock (Deals)
     {
         Deals.Add(deal);
     }
 }
コード例 #3
0
 public void AddDeal(IDeal deal)
 {
     lock (list)
     {
         Get(deal.Symbol).Value += (int)deal.BuySell * deal.Value;
     }
 }
コード例 #4
0
 public MenuWriter(IWriteClass writer, IDeal deal, IPlayersHand playersHand, IShowPlayers showPlayer)
 {
     _writer      = writer;
     _deal        = deal;
     _playersHand = playersHand;
     _showPlayers = showPlayer;
 }
コード例 #5
0
 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
     });
 }
コード例 #6
0
ファイル: ORPTeam.cs プロジェクト: MyRSG/COAT
 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();
 }
コード例 #7
0
ファイル: TestBaseUnit.cs プロジェクト: MyRSG/COAT
 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);
 }
コード例 #8
0
ファイル: BaseUnit.cs プロジェクト: MyRSG/COAT
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
ファイル: SalesOperation.cs プロジェクト: MyRSG/COAT
 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();
 }
コード例 #11
0
ファイル: IsoAdmin.cs プロジェクト: MyRSG/COAT
 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();
 }
コード例 #12
0
ファイル: BaseUnit.cs プロジェクト: MyRSG/COAT
        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;
        }
コード例 #13
0
        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);
        }
コード例 #14
0
ファイル: SalesTeam.cs プロジェクト: MyRSG/COAT
        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);
        }
コード例 #15
0
ファイル: DealMapper.cs プロジェクト: MasthanPMJ/DealerTrack
 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
     });
 }
コード例 #16
0
        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"));
        }
コード例 #17
0
ファイル: TestWorkFlowFactory.cs プロジェクト: MyRSG/COAT
        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);
        }
コード例 #18
0
ファイル: OhlcMaker.cs プロジェクト: 810912015/option
 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;
 }
コード例 #19
0
ファイル: OhlcMaker.cs プロジェクト: 810912015/option
 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);
            }
        }
コード例 #22
0
ファイル: BaseUnit.cs プロジェクト: MyRSG/COAT
 protected abstract void ApproveDeal(IDeal deal, BaseApprArgs args);
コード例 #23
0
 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>()))));
 }
コード例 #24
0
ファイル: TestBaseUnit.cs プロジェクト: MyRSG/COAT
 protected void AssertAssignWrongApproval(IDeal d, IApproval approval)
 {
     AssertApproval(d, approval, ApprovalAction.AssignWrong);
 }
コード例 #25
0
ファイル: TestBaseUnit.cs プロジェクト: MyRSG/COAT
 protected void AssertDeclineApproval(IDeal d, IApproval approval)
 {
     AssertApproval(d, approval, ApprovalAction.Decline);
 }
コード例 #26
0
ファイル: TestDataFacoty.cs プロジェクト: MyRSG/COAT
 public IDeal SaveDeal(IDeal deal)
 {
     return deal;
 }
コード例 #27
0
        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());
        }
コード例 #28
0
ファイル: TestBaseUnit.cs プロジェクト: MyRSG/COAT
 protected void AssertApproveApproval(IDeal d, IApproval approval)
 {
     AssertApproval(d, approval, ApprovalAction.Approve);
 }
コード例 #29
0
 public void AddDeal(IDeal deal)
 {
     lock (Deals)
     {
         Deals.Add(deal);
     }
 }
コード例 #30
0
ファイル: BaseUnit.cs プロジェクト: MyRSG/COAT
 public virtual IApproval Decline(IDeal deal, BaseApprArgs args)
 {
     deal.Switch(WorkFlowStep.Decline);
     deal.Save();
     return CreateApproval(deal.Id, args.ActionUser, ApprovalAction.Decline, args.Comment);
 }
コード例 #31
0
ファイル: BaseUnit.cs プロジェクト: MyRSG/COAT
 protected abstract void SendNotifcationMail(IDeal deal, BaseApprArgs args);
コード例 #32
0
ファイル: TestSalesTeam.cs プロジェクト: MyRSG/COAT
 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);
 }
コード例 #33
0
ファイル: ChannelDirector.cs プロジェクト: MyRSG/COAT
 protected override void ApproveDeal(IDeal deal, BaseApprArgs args)
 {
     deal.Switch(WorkFlowStep.Approve);
     deal.Save();
 }
コード例 #34
0
ファイル: SalesTeam.cs プロジェクト: MyRSG/COAT
 protected override void ApproveDeal(IDeal deal, BaseApprArgs args)
 {
     deal.Switch(deal.Size > DirectorSize ? WorkFlowStep.ChannelDirector : WorkFlowStep.Approve);
     deal.Save();
 }
コード例 #35
0
 public DealsViewModel(INavigationService navigationService, IDeal service) : base(navigationService)
 {
     this.service = service;
 }
コード例 #36
0
 public Task AddAsync(IDeal obj)
 {
     return(_tableStorage.InsertAsync(_convertService.Convert <IDeal, DealEntity>(obj)));
 }
コード例 #37
0
 public void RegisterDeal(IDeal deal, int discount)
 {
     _deals.Add(new KeyValuePair <IDeal, int>(deal, discount));
 }
コード例 #38
0
ファイル: IBotHost.cs プロジェクト: vvsur/open-wealth-project
 public DealEventArgs(IDeal deal)
 {
     this.deal = deal;
 }
コード例 #39
0
ファイル: ORPTeam.cs プロジェクト: MyRSG/COAT
 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));
        }
コード例 #41
0
        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;
        }
コード例 #42
0
 public PokerController(Deal deal)
 {
     this.deal = deal;
 }
コード例 #43
0
 public DealEventArgs(IDeal deal)
 {
     this.deal = deal;
 }
コード例 #44
0
ファイル: BaseUnit.cs プロジェクト: MyRSG/COAT
 protected virtual void AdditionOpeation(IDeal deal, IApproval approval, BaseApprArgs args)
 {
 }