示例#1
0
        static void Main(string[] args)
        {
            var parameters = new ConnectorParameters(
                account: "MyAccount",
                pathToQuik: Terminal.GetPathToActiveQuik(),
                ddeServerName: "QServer");


            using (var QUIK = new QConnector(parameters))
            {
                QUIK.Connection.Connected += (sender, e) => Console.WriteLine("Connected.");

                QUIK.ImportStarted += (sender, e) => Console.WriteLine("Import started.");

                QUIK.Connect();
                QUIK.StartImport();


                IDataTable <Security> securitiesTable = QUIK.AddDataTable <Security>();

                securitiesTable.Updated += securitiesTable_Updated;

                Console.ReadLine();

                OrderChannel lkoh = QUIK.CreateOrderChannel("LKOH", "EQBR");

                OrderResult result = lkoh.SendTransaction(Direction.Buy, price: 3000.00M, volume: 1);

                lkoh.KillOrder(result);

                Console.ReadLine();
            }
        }
        public async Task <OrderChannel> Add(OrderChannel model)
        {
            var entity = _orderChannelRepository.Add(model);
            await _orderChannelRepository.SaveChangeAsync();

            return(model);
        }
        public async Task <bool> Put(OrderChannel model)
        {
            var result = false;

            if (ModelState.IsValid)
            {
                result = await _orderChannelBusiness.Update(model);
            }
            return(result);
        }
示例#4
0
        public bool RemoveOrderChannel(OrderChannel channel)
        {
            if (_connection.Channels.Remove(channel))
            {
                OnOrderChannelRemoved(this, channel);

                return(true);
            }

            return(false);
        }
        public async Task <int> Post(OrderChannel model)
        {
            var result = 0;

            if (ModelState.IsValid)
            {
                model.Status = 1;
                var modelInsert = await _orderChannelBusiness.Add(model);

                result = modelInsert.Id;
            }
            return(result);
        }
        public async Task <bool> Update(OrderChannel model)
        {
            var result = false;
            var record = await _orderChannelRepository.Repo.FirstOrDefaultAsync(c => c.Id == model.Id);

            if (record != null)
            {
                record.Name        = model.Name;
                record.OpenTime    = model.OpenTime;
                record.CloseTime   = model.CloseTime;
                record.AllDay      = model.AllDay;
                record.Description = model.Description;

                await _orderChannelRepository.SaveChangeAsync();

                result = true;
            }
            return(result);
        }
示例#7
0
 protected virtual void OnOrderChannelCreated(object sender, OrderChannel e) => OrderChannelCreated?.Invoke(sender, e);
示例#8
0
        public void AddOrderChannel(OrderChannel channel)
        {
            _connection.Subscribe(channel);

            OnOrderChannelAdded(this, channel);
        }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Purchase" /> class.
 /// </summary>
 /// <param name="BrowserIpAddress">The IP Address of the browser that was used to make the purchase. This is the IP Address that was used to connect to your site and make the purchase. (required).</param>
 /// <param name="OrderId">A string uniquely identifying this order. (required).</param>
 /// <param name="CreatedAt">&#x60;yyyy-MM-dd&#39;T&#39;HH:mm:ssZ&#x60; The date and time when the order was placed, shown on the signifyd console. See the Dates section of these docs for more information about date formats. (required).</param>
 /// <param name="AvsResponseCode">The response code from the address verification system (AVS). Accepted codes: http://www.emsecommerce.net/avs_cvv2_response_codes.htm (required).</param>
 /// <param name="CvvResponseCode">The response code from the card verification value (CVV) check. Accepted codes listed on above link. (required).</param>
 /// <param name="TotalPrice">The total price of the order, including shipping price and taxes. (required).</param>
 /// <param name="OrderSessionId">The unique ID for the user&#39;s browsing session. This is to be used in conjunction with the Signifyd Fingerprinting Javascript..</param>
 /// <param name="DiscountCodes">Any discount codes, coupons, or promotional codes used during checkout to recieve a discount on the order..</param>
 /// <param name="Shipments">The shipments associated with this purchase..</param>
 /// <param name="Products">The products purchased in the transaction..</param>
 /// <param name="PaymentGateway">The gateway that processed the transaction..</param>
 /// <param name="PaymentMethod">PaymentMethod.</param>
 /// <param name="TransactionId">The unique identifier provided by the payment gateway for this order. If you have provided us with credentials for your payment gateway we can obtain additional details about the order, like AVS and CVV status, from your payment provider..</param>
 /// <param name="Currency">The currency type of the order, in 3 letter ISO 4217 format. Defaults to USD..</param>
 /// <param name="OrderChannel">OrderChannel.</param>
 /// <param name="ReceivedBy">If the order was was taken by a customer service or sales agent, his or her name..</param>
 public Purchase(string BrowserIpAddress = default(string), string OrderId = default(string), string CreatedAt = default(string), string AvsResponseCode = default(string), string CvvResponseCode = default(string), double?TotalPrice = default(double?), string OrderSessionId = default(string), List <DiscountCodes> DiscountCodes = default(List <DiscountCodes>), List <Shipment> Shipments = default(List <Shipment>), List <Product> Products = default(List <Product>), string PaymentGateway = default(string), PaymentMethod PaymentMethod = default(PaymentMethod), string TransactionId = default(string), string Currency = default(string), OrderChannel OrderChannel = default(OrderChannel), string ReceivedBy = default(string))
 {
     // to ensure "BrowserIpAddress" is required (not null)
     if (BrowserIpAddress == null)
     {
         throw new InvalidDataException("BrowserIpAddress is a required property for Purchase and cannot be null");
     }
     else
     {
         this.BrowserIpAddress = BrowserIpAddress;
     }
     // to ensure "OrderId" is required (not null)
     if (OrderId == null)
     {
         throw new InvalidDataException("OrderId is a required property for Purchase and cannot be null");
     }
     else
     {
         this.OrderId = OrderId;
     }
     // to ensure "CreatedAt" is required (not null)
     if (CreatedAt == null)
     {
         throw new InvalidDataException("CreatedAt is a required property for Purchase and cannot be null");
     }
     else
     {
         this.CreatedAt = CreatedAt;
     }
     // to ensure "AvsResponseCode" is required (not null)
     if (AvsResponseCode == null)
     {
         throw new InvalidDataException("AvsResponseCode is a required property for Purchase and cannot be null");
     }
     else
     {
         this.AvsResponseCode = AvsResponseCode;
     }
     // to ensure "CvvResponseCode" is required (not null)
     if (CvvResponseCode == null)
     {
         throw new InvalidDataException("CvvResponseCode is a required property for Purchase and cannot be null");
     }
     else
     {
         this.CvvResponseCode = CvvResponseCode;
     }
     // to ensure "TotalPrice" is required (not null)
     if (TotalPrice == null)
     {
         throw new InvalidDataException("TotalPrice is a required property for Purchase and cannot be null");
     }
     else
     {
         this.TotalPrice = TotalPrice;
     }
     this.OrderSessionId = OrderSessionId;
     this.DiscountCodes  = DiscountCodes;
     this.Shipments      = Shipments;
     this.Products       = Products;
     this.PaymentGateway = PaymentGateway;
     this.PaymentMethod  = PaymentMethod;
     this.TransactionId  = TransactionId;
     this.Currency       = Currency;
     this.OrderChannel   = OrderChannel;
     this.ReceivedBy     = ReceivedBy;
 }
示例#10
0
        private async void lvChannelsList_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (cbCheckAllChannels.Checked)
            {
                return;
            }

            //id original of channel
            var idOrigin = lvChannelsList.Items[e.Index].SubItems[4].Text.GetInt();

            var userRepo         = new BaseRepository <User>();
            var user             = userRepo.Get(u => u.Id == CurrentUserId).FirstOrDefault();
            var orderChannelRepo = new BaseRepository <OrderChannel>(userRepo.ContextDb);

            switch (e.NewValue)
            {
            case CheckState.Checked:
                var channelRepo = new BaseRepository <Channel>(userRepo.ContextDb);
                var showsRepo   = new BaseRepository <TvShow>(userRepo.ContextDb);
                if (orderChannelRepo.Get(s => /*s.Channel.Id*/ s.Channel.OriginalId == idOrigin &&
                                         s.User.Id == CurrentUserId).FirstOrDefault() == null)
                {
                    var orderedCh = new OrderChannel
                    {
                        Channel = channelRepo.Get(c => c.OriginalId == idOrigin).FirstOrDefault(),
                        User    = user
                    };
                    orderChannelRepo.Insert(orderedCh);
                }

                var showsByChannel = await showsRepo.Get(x => x.CodeOriginalChannel == idOrigin).ToListAsync();

                var addedShows =
                    showsByChannel.Where(show => (int)show.Date.DayOfWeek == GetSelectedDay()).ToList();
                ControlForShows.AddTvShowsToControl(addedShows);
                break;

            case CheckState.Unchecked:
                var userSchedRepo = new BaseRepository <UserSchedule>(userRepo.ContextDb);
                var removeCh      = orderChannelRepo.Get(x => x.Channel.OriginalId == idOrigin &&
                                                         x.Order == null && x.User.Id == CurrentUserId).FirstOrDefault();
                if (removeCh != null)
                {
                    ControlForShows.RemoveTvShowsFromControl(removeCh.Channel.OriginalId);

                    var schedFromRemovingChann = userSchedRepo
                                                 .Get(sc => sc.TvShow.CodeOriginalChannel == removeCh.Channel.OriginalId &&
                                                      sc.User.Id == CurrentUserId).ToList();
                    userSchedRepo.RemoveRange(schedFromRemovingChann);
                    orderChannelRepo.Remove(removeCh);
                }
                ControlForShows.RemoveTvShowsFromControl(idOrigin);
                break;

            //case CheckState.Indeterminate:
            //    MessagesContainer.DisplayError("Something went wrong in checking/unchecking channels (case CheckState.Indeterminate:)", "Error");
            //    break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }