示例#1
0
        public Boolean RequestOrder(POrder order)
        {
            try
            {
                order.SetAsLegalPrice();

                if (!IsValidPT(order))
                {
                    return false;
                }

                if (!IsValidOrder(order))
                {
                    logger.Error("It is not valid order");
                    logger.Error(order.ToString());
                    Util.KillWithNotice(order.ToString());
                    return false;
                }

                order.RoundReqPrice();

                if (AccountManager.Ins().IsSingleShotWeaponMode)
                {
                    if (AccountManager.Ins().IsBulletEmpty())
                    {
                        SoundManager.Ins().PlayAlertSound();

                        DialogResult dr = MessageBox.Show(null, order.ToString(),
                            "SingleWeaponMode, Do you want reload bullets?", MessageBoxButtons.YesNoCancel);

                        if (dr == DialogResult.Yes)
                        {
                            AccountManager.Ins().ReloadBullet();
                        }
                        else
                        {
                            logger.Error("Cancel Order(Single Weapon Mode)");
                            Util.KillWithNotice("Cancel Order(Single Weapon Mode)");
                            return false;
                        }
                    }

                    AccountManager.Ins().DecreaseBullet();
                }

                if (this.Hts.SendOrder(order))
                {
                    //// 주문을 한다.
                    _requestOrders.Add(order);

                    POrderLegalManager.Ins().Add(order);

                    POrderBidAskCountManager.Ins().Register(order);

                    logger.Debug("Request: {0}", order.ToString());

                    order.IsAllocatedYetRequestOrFree = false;

                    return true;
                }
                logger.Error("Fail order");
                Util.KillWithNotice("Fail order");
                return false;
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.ToString());
                Util.KillWithNotice(ex.ToString());
            }
            return false;
        }