Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(long id)
        {
            BuyInfo buyInfo = db.BuyInfoes.Find(id);

            db.BuyInfoes.Remove(buyInfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,DeviceId,ProductId,Quantity,Amount,BuyTime")] BuyInfo buyInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(buyInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(buyInfo));
 }
Exemplo n.º 3
0
        public GBuyGump_OfferedItem(GBuyGump owner, BuyInfo bi)
            : base(32, 67, 196, 0)
        {
            this.m_OfferMenu = owner.OfferMenu;
            IFont font = (IFont)Engine.GetUniFont(3);
            IHue  hue  = Hues.Load(648);

            this.m_xAmount     = bi.ToBuy;
            this.m_Amount      = new GLabel(bi.ToBuy.ToString(), font, hue, 0, 0);
            this.m_Description = (GLabel) new GWrappedLabel(string.Format("{0} at {1} gp", (object)bi.Name, (object)bi.Price), font, hue, 41, 0, 105);
            this.m_More        = new GBuyGump_AmountButton(owner, bi, 5, 55, 155);
            this.m_Less        = new GBuyGump_AmountButton(owner, bi, -5, 56, 173);
            this.m_Height      = this.m_Amount.Image.yMax - this.m_Amount.Image.yMin + 1;
            int num = this.m_Description.Image.yMax - this.m_Description.Image.yMin + 1;

            if (num > this.m_Height)
            {
                this.m_Height = num;
            }
            int height1 = this.m_More.Height;

            if (height1 > this.m_Height)
            {
                this.m_Height = height1;
            }
            int height2 = this.m_Less.Height;

            if (height2 > this.m_Height)
            {
                this.m_Height = height2;
            }
            this.m_Amount.X      -= this.m_Amount.Image.xMin;
            this.m_Amount.Y       = (this.m_Height - (this.m_Amount.Image.yMax - this.m_Amount.Image.yMin + 1)) / 2;
            this.m_Description.X -= this.m_Description.Image.xMin;
            this.m_Description.Y  = (this.m_Height - (this.m_Description.Image.yMax - this.m_Description.Image.yMin + 1)) / 2;
            if (this.m_Amount.Y > this.m_Description.Y)
            {
                this.m_Amount.Y = this.m_Description.Y;
            }
            this.m_Amount.Y      -= this.m_Amount.Image.yMin;
            this.m_Description.Y -= this.m_Description.Image.yMin;
            this.m_More.Y         = (this.m_Height - this.m_More.Height) / 2;
            this.m_Less.Y         = (this.m_Height - this.m_Less.Height) / 2;
            this.m_Children.Add((Gump)this.m_Amount);
            this.m_Children.Add((Gump)this.m_Description);
            this.m_Children.Add((Gump)this.m_More);
            this.m_Children.Add((Gump)this.m_Less);
            this.Clipper = this.m_OfferMenu.ContentClipper;
            if (!Engine.ServerFeatures.AOS)
            {
                return;
            }
            this.Tooltip = (ITooltip) new ItemTooltip(bi.Item);
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "Id,DeviceId,ProductId,Quantity,Amount,BuyTime")] BuyInfo buyInfo)
        {
            if (ModelState.IsValid)
            {
                db.BuyInfoes.Add(buyInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(buyInfo));
        }
Exemplo n.º 5
0
        // GET: BuyInfoes/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BuyInfo buyInfo = db.BuyInfoes.Find(id);

            if (buyInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(buyInfo));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 购买
        /// </summary>
        /// <param name="invitelInfo"></param>
        /// <returns></returns>
        public static int ADDbuy(BuyInfo buyInfo)
        {
            string sqltext = "insert into BuyInfo ([UserID],[LotteryTcketID],[NtesItegration],[NtesID],[NtesGade],[NtesTimer]) values(@UserID,@LotteryTcketID,@NtesItegration,@NtesID,@NtesGade,@NtesTimer)";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@UserID", buyInfo.UserID),
                new SqlParameter("@LotteryTcketID", buyInfo.LotteryTcketID),
                new SqlParameter("@NtesItegration", buyInfo.NtesItegration),
                new SqlParameter("@NtesID", buyInfo.NtesID),
                new SqlParameter("@NtesGade", buyInfo.NtesGade),
                new SqlParameter("@NtesTimer", buyInfo.NtesTimer)
            };
            return((int)SqlHelper.ExecuteNonQuery(connection, CommandType.Text, sqltext, para));
        }
Exemplo n.º 7
0
 private void stockExchange(string stockID, double changingProportion, double value, int order)
 {
     if (Surface.MyTimer.Data.MDDict.ContainsKey(stockID))
     {
         string optionStockID = "";
         if (order == 1)
         {
             optionStockID = Surface.MyTimer.Data.OperationDict[stockID].OptionStockID1;
             BuyInfo bi = new BuyInfo(Surface.MyTimer.Data.OperationDict[stockID], stockID, 1);
             Surface.MyTimer.Data.StockInfo si = bi.Si;
             si            = new Surface.MyTimer.Data.StockInfo();
             si.StockID    = optionStockID;
             si.Proportion = changingProportion;
             buyStock(bi);
         }
         else if (order == 2)
         {
             optionStockID = Surface.MyTimer.Data.OperationDict[stockID].OptionStockID2;
             BuyInfo bi = new BuyInfo(Surface.MyTimer.Data.OperationDict[stockID], stockID, 2);
             Surface.MyTimer.Data.StockInfo si = bi.Si;
             si            = new Surface.MyTimer.Data.StockInfo();
             si.StockID    = optionStockID;
             si.Proportion = changingProportion;
             buyStock(bi);
         }
         else if (order == 3)
         {
             optionStockID = Surface.MyTimer.Data.OperationDict[stockID].OptionStockID3;
             BuyInfo bi = new BuyInfo(Surface.MyTimer.Data.OperationDict[stockID], stockID, 3);
             Surface.MyTimer.Data.StockInfo si = bi.Si;
             si            = new Surface.MyTimer.Data.StockInfo();
             si.StockID    = optionStockID;
             si.Proportion = changingProportion;
             buyStock(bi);
         }
         else
         {
             Console.WriteLine("Buying option stock failed.");
         }
     }
     else
     {
         Console.WriteLine("Target list add error!");
     }
 }
Exemplo n.º 8
0
    public IList <BuyInfo> SelectAllBuy()
    {
        IList <BuyInfo> list = new List <BuyInfo>();
        DataTable       dt   = DBHelper.ExecuteDataTable(SQL_SELECT_ALL_BUY);

        foreach (DataRow dr in dt.Rows)
        {
            BuyInfo info = new BuyInfo();
            info.Nick     = dr["Nick"].ToString();
            info.FeeId    = new Guid(dr["FeeId"].ToString());
            info.BuyTime  = DateTime.Parse(dr["BuyTime"].ToString());
            info.IsExpied = (bool)dr["IsExpied"];

            list.Add(info);
        }

        return(list);
    }
Exemplo n.º 9
0
        public IHttpActionResult SetStatus([FromBody] Status status)
        {
            var     jsonData   = Base64Decode(status.data);
            BuyInfo info       = JsonConvert.DeserializeObject <BuyInfo>(jsonData);
            var     privateKey = Config.LiqPayPrivateKey;
            var     hash       = System.Convert.ToBase64String(sha1Hash(privateKey + status.data + privateKey));

            if (!hash.Equals(status.signature))
            {
                return(BadRequest("Signature is'n correct"));
            }
            OrderAccess oAccess = new OrderAccess();
            bool        result  = oAccess.SetStatusByOrderId(info.order_id, info.status);

            if (result)
            {
                return(Ok("Success"));
            }
            else
            {
                return(BadRequest("Data is'n correct"));
            }
        }
Exemplo n.º 10
0
        private void buyStock(object obj)
        {
            BuyInfo       bi           = (BuyInfo)obj;
            bool          changeFlag   = false;
            bool          overTimeFlag = false;
            bool          errorFlag    = false;
            bool          buyFlag      = false;
            int           count;
            double        price;
            countAndPrice cp = calculateCount(bi.Si.StockID, bi.Si.Proportion, Surface.MyTimer.Data.HoldingValue, "Buy");

            count = cp.Count;
            price = cp.Price;
            //Surface.WinfairTDAPI.Function.OrderInsert(bi.Si.StockID, price, count);
            Thread.Sleep(BuyWaitTime);

            if (changeFlag)
            {
                if (overTimeFlag)
                {
                    dealWithOverTime(bi.StockID, bi.Si.Proportion, Surface.MyTimer.Data.HoldingValue, bi.Order + 1);
                    return;
                }
                else if (errorFlag)
                {
                    dealWithError(bi.StockID, bi.Si.Proportion, Surface.MyTimer.Data.HoldingValue, bi.Order + 1);
                    return;
                }
            }
            else
            {
                //Surface.WinfairTDAPI.Function.OrderAction();
                for (int i = 1; i < BuyTry; i++)
                {
                    cp    = calculateCount(bi.Si.StockID, bi.Si.Proportion, Surface.MyTimer.Data.HoldingValue, "Buy");
                    count = cp.Count;
                    price = cp.Price;
                    //Surface.WinfairTDAPI.Function.OrderInsert(bi.Si.StockID, price, count);
                    Thread.Sleep(BuyWaitTime);
                    if (changeFlag)
                    {
                        if (overTimeFlag)
                        {
                            dealWithOverTime(bi.StockID, bi.Si.Proportion, Surface.MyTimer.Data.HoldingValue, bi.Order + 1);
                            return;
                        }
                        else if (errorFlag)
                        {
                            dealWithError(bi.StockID, bi.Si.Proportion, Surface.MyTimer.Data.HoldingValue, bi.Order + 1);
                            return;
                        }
                        else
                        {
                            //Surface.WinfairTDAPI.Function.OrderAction();
                            if (i == SellTry - 1)
                            {
                                cp    = calculateCount(bi.Si.StockID, bi.Si.Proportion, Surface.MyTimer.Data.HoldingValue, "BuyLimit");
                                count = cp.Count;
                                price = cp.Price;
                                //Surface.WinfairTDAPI.Function.OrderInsert(bi.Si.StockID, price, count);
                                Thread.Sleep(BuyWaitTime);
                                if (buyFlag)
                                {
                                    Console.WriteLine("Buying failed.");
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
 public static void OnGeneratorButtonStateChanged(int generatorId, BuyInfo buyInfo)
 => GeneratorButtonStateChanged?.Invoke(generatorId, buyInfo);
Exemplo n.º 12
0
        public Progress ReadPayments(string contractAddress)
        {
            PensionFund pensionFund = PensionFundBusiness.GetByContract(contractAddress);

            string         cacheKey      = GetCachePaymentKey(contractAddress);
            List <Payment> cachedPayment = MemoryCache.Get <List <Payment> >(cacheKey);

            if (cachedPayment != null && cachedPayment.Count == 120)
            {
                return(PensionFundBusiness.GetProgress(pensionFund, cachedPayment));
            }

            SmartContract smartContract = SmartContractBusiness.GetDefaultDemonstrationPensionFund();
            IEnumerable <PensionFundTransaction> transactions = Data.List(pensionFund.Option.PensionFundContract.TransactionHash).
                                                                Where(c => c.FunctionType == FunctionType.EmployeeBuy || c.FunctionType == FunctionType.CompanyBuy);
            IEnumerable <PensionFundTransaction> pendingCreateTransactions   = transactions.Where(c => string.IsNullOrEmpty(c.TransactionHash));
            IEnumerable <PensionFundTransaction> pendingCompleteTransactions = transactions.Where(c => !c.BlockNumber.HasValue && !string.IsNullOrEmpty(c.TransactionHash));

            if (!transactions.Any())
            {
                return(PensionFundBusiness.GetProgress(pensionFund, new List <Payment>()));
            }
            else if (cachedPayment != null && cachedPayment.Count == transactions.Count())
            {
                return(PensionFundBusiness.GetProgress(pensionFund, cachedPayment));
            }
            else if (cachedPayment != null && (cachedPayment.Count + pendingCreateTransactions.Count()) == transactions.Count())
            {
                transactions = HandleTransactions(smartContract, pensionFund, transactions, pendingCreateTransactions, pendingCompleteTransactions, new BaseEventInfo[] { });
                return(PensionFundBusiness.GetProgress(pensionFund, pendingCreateTransactions.Select(c => new Payment()
                {
                    CreatedDate = c.CreationDate,
                    Responsable = c.WalletAddress
                }).Concat(cachedPayment)));
            }

            List <BuyInfo> buyEvents = EthereumManager.ReadBuyFromDefaultPensionFund(contractAddress);

            transactions = HandleTransactions(smartContract, pensionFund, transactions, pendingCreateTransactions, pendingCompleteTransactions,
                                              buyEvents.Select(c => new BaseEventInfo()
            {
                BlockNumber = c.BlockNumber, TransactionHash = c.TransactionHash
            }));

            List <Payment> completedPayments = new List <Payment>();

            if (buyEvents.Count > 0)
            {
                foreach (PensionFundTransaction trans in transactions)
                {
                    BuyInfo buyInfo = buyEvents.SingleOrDefault(c => c.TransactionHash == trans.TransactionHash);
                    if (buyInfo != null)
                    {
                        completedPayments.Add(new Payment()
                        {
                            TransactionHash = trans.TransactionHash,
                            CreatedDate     = trans.CreationDate,
                            Responsable     = trans.WalletAddress,
                            BlockNumber     = buyInfo.BlockNumber,
                            Period          = buyInfo.Period,
                            AuctusFee       = buyInfo.AuctusFee,
                            LatePenalty     = buyInfo.LatePenalty,
                            PensionFundFee  = buyInfo.PensionFundFee,
                            SzaboInvested   = buyInfo.SzaboInvested,
                            TokenAmount     = buyInfo.TokenAmount,
                            DaysOverdue     = buyInfo.DaysOverdue,
                            ReferenceDate   = pensionFund.Option.PensionFundContract.CreationDate.AddMonths(buyInfo.Period).Date
                        });
                    }
                }
                if (completedPayments.Count > 0)
                {
                    MemoryCache.Set <List <Payment> >(cacheKey, completedPayments);
                }
            }
            IEnumerable <Payment> remainingPayments = transactions.Where(c => string.IsNullOrEmpty(c.TransactionHash) ||
                                                                         !completedPayments.Any(l => l.TransactionHash == c.TransactionHash)).Select(c => new Payment()
            {
                TransactionHash = c.TransactionHash,
                CreatedDate     = c.CreationDate,
                Responsable     = c.WalletAddress
            });

            return(PensionFundBusiness.GetProgress(pensionFund, remainingPayments.Concat(completedPayments)));
        }
Exemplo n.º 13
0
 public static int ADDbuy(BuyInfo buyInfo)
 {
     return(DAL.UserServer.ADDbuy(buyInfo));
 }
Exemplo n.º 14
0
        /// <summary>
        /// Analyzes packet and saves it, if it is related to vendors.
        /// </summary>
        /// <param name="packet">Packet.</param>
        public void AnalyzePacket(Packet packet)
        {
            if (packet is MobileIncoming)
            {
                MobileIncoming p = (MobileIncoming)packet;

                if (!m_Vendors.ContainsKey(p.Serial) && p.Notoriety == Notoriety.Invulnerable)
                {
                    Vendor m = new Vendor(p.Serial);
                    m.Body      = p.ModelId;
                    m.Hue       = (int)p.Hue;
                    m.Notoriety = (Notoriety)p.Notoriety;
                    m.Female    = (p.Flag & 0x2) == 1 ? true : false;
                    m.Blessed   = (p.Flag & 0x8) == 1 ? true : false;

                    foreach (MobileIncoming.EquipInfo i in p.Equipment)
                    {
                        Item item = new Item(i.Serial);
                        item.ItemID = i.ItemId;
                        item.Layer  = (Layer)i.Layer;
                        item.Hue    = i.Hue;
                        m.Items.Add(item);
                        m_Items.Add(i.Serial, item);

                        if (item.Layer == Layer.ShopBuy)
                        {
                            m_Shops.Add(item.Serial, m);
                        }
                    }

                    m_Vendors.Add(p.Serial, m);
                }
            }
            else if (packet is ContainerContent)
            {
                ContainerContent p = (ContainerContent)packet;

                foreach (ContainerContent.ContainedItem i in p.Items)
                {
                    if (m_Shops.ContainsKey(i.ContSerial))
                    {
                        Vendor m = m_Shops[i.ContSerial];

                        if (!m.Shop.ContainsKey(i.Serial))
                        {
                            VendorItem item = new VendorItem(i.Serial);

                            if (!m_Items.ContainsKey(i.Serial))
                            {
                                m_Items.Add(i.Serial, item);
                            }

                            item.ItemID = i.ItemId;
                            item.Hue    = i.Hue;
                            item.Amount = i.Amount;

                            m.Shop.Add(i.Serial, item);
                        }
                    }
                }
            }
            else if (packet is BuyInfo)
            {
                BuyInfo p = (BuyInfo)packet;

                if (m_Shops.ContainsKey(p.VendorSerial))
                {
                    m_Prices  = new int[p.ItemCount];
                    m_Counter = 0;

                    for (int i = 0; i < p.ItemCount; i++)
                    {
                        m_Prices[i] = p.List[i].Price;
                    }
                }
            }
            else if (packet is ObjectProperties)
            {
                ObjectProperties p = (ObjectProperties)packet;

                if (m_Items.ContainsKey(p.Serial))
                {
                    Item item = m_Items[p.Serial];

                    if (item.Name != null)
                    {
                        return;
                    }

                    for (int i = 0; i < p.Properties.Length; i++)
                    {
                        ObjectProperties.Property prop = p.Properties[i];
                        item.ParseProperty(i, prop.Number, prop.Arguments);
                    }

                    if (item is VendorItem && m_Prices != null && m_Counter < m_Prices.Length)
                    {
                        ((VendorItem)item).SellPrice = m_Prices[m_Counter++];
                    }
                }
                else if (m_Vendors.ContainsKey(p.Serial))
                {
                    Mobile m = m_Vendors[p.Serial];

                    if (m.Name == null && p.Properties.Length > 0)
                    {
                        m.Name = LocalizedList.Construct(p.Properties[0].Number, p.Properties[0].Arguments);
                    }
                }
            }
        }
Exemplo n.º 15
0
        private void startStrategy()
        {
            //MDCreate();
            //MDSubscribe();

            SpreadToTransfer = Convert.ToDouble(textSpreadToTransfer.Text);
            AllWaitingTime   = Convert.ToInt32(textWaitingTime.Text);
            BuyWaitTime      = Convert.ToInt32(textBuyWaitingTime.Text);
            SellWaitTime     = Convert.ToInt32(textSellWaitingTime.Text);
            switch (textBuyStrategy.Text)
            {
            case "WithCash":
                StrategyToBuy = 0;
                break;

            case "WithETF":
                StrategyToBuy = 1;
                break;

            case "WithOptionStock":
                StrategyToBuy = 2;
                break;
            }
            BuyPrice            = (int)((PRICE_NAME)Enum.Parse(typeof(PRICE_NAME), basisSell.Text));
            SellPrice           = (int)((PRICE_NAME)Enum.Parse(typeof(PRICE_NAME), basisSell.Text));
            BuyTry              = Convert.ToInt32(textBuyTry.Text);
            SellTry             = Convert.ToInt32(textSellTry.Text);
            BuyAdditionalPrice  = Convert.ToDouble(textAddtionalBuy.Text) / 100;
            SellAdditionalPrice = Convert.ToDouble(textAdditionalSell.Text) / 100;

            //TargetDict
            getTarget();

            //OperationDict
            //var intersect = FormerDict.Keys.Intersect(TargetDict.Keys);
            //foreach (var item in intersect)
            //{
            //    StockInfo si = new StockInfo();
            //    si.StockID = item;
            //    si.Name = TargetDict[item].Name;
            //    si.Proportion = TargetDict[item].Proportion - FormerDict[item].Proportion;
            //    si.OptionStockID1 = TargetDict[item].OptionStockID1;
            //    si.OptionStockID2 = TargetDict[item].OptionStockID2;
            //    si.OptionStockID3 = TargetDict[item].OptionStockID3;
            //    OperationDict[si.StockID] = si;
            //}

            //var formerExceptTarget = FormerDict.Keys.Except(TargetDict.Keys);
            //foreach (var item in formerExceptTarget)
            //{
            //    StockInfo si = new StockInfo();
            //    si.StockID = item;
            //    si.Name = FormerDict[item].Name;
            //    si.Proportion = -FormerDict[item].Proportion;
            //    si.OptionStockID1 = FormerDict[item].OptionStockID1;
            //    si.OptionStockID2 = FormerDict[item].OptionStockID2;
            //    si.OptionStockID3 = FormerDict[item].OptionStockID3;
            //    OperationDict[si.StockID] = si;
            //}

            //var targetExceptFormer = TargetDict.Keys.Except(FormerDict.Keys);
            //foreach (var item in targetExceptFormer)
            //{
            //    StockInfo si = new StockInfo();
            //    si.StockID = item;
            //    si.Name = TargetDict[item].Name;
            //    si.Proportion = TargetDict[item].Proportion;
            //    si.OptionStockID1 = TargetDict[item].OptionStockID1;
            //    si.OptionStockID2 = TargetDict[item].OptionStockID2;
            //    si.OptionStockID3 = TargetDict[item].OptionStockID3;
            //    OperationDict[si.StockID] = si;
            //}

            OperationDict = TargetDict;
            #region changeholding
            int    i     = 0;
            Task[] tasks = new Task[OperationDict.Count];
            foreach (StockInfo item in OperationDict.Values)
            {
                if (item.Proportion > 0)
                {
                    BuyInfo bi = new BuyInfo(item, "", 0);
                    tasks[i] = new Task(buyStock, bi);
                    tasks[i].Start();
                }
                else
                {
                    tasks[i] = new Task(sellStock, item);
                    tasks[i].Start();
                }
                i++;
            }
            #endregion
        }
Exemplo n.º 16
0
        static void DoSellForMore(BuyInfo buyInfo, decimal nowPrice)
        {
            if (lastSellDate > DateTime.Now.AddMinutes(-1))
            {
                // 如果1分钟内购出售一单, 则不能再次出售
                return;
            }

            if (!string.IsNullOrEmpty(buyInfo.SellClientOid) && buyInfo.SellStatus != OrderStatus.cancelled)
            {
                return;
            }

            var percent   = 1 + ((nowPrice / buyInfo.BuyPrice) - 1) / 3;
            var sellSize  = buyInfo.BuyQuantity / percent;
            var sellPrice = nowPrice / (decimal)1.01; // 更低的价格出售, 是为了能够出售

            var okInstrument = InstrumentsUtils.GetOkInstruments(buyInfo.Quote, buyInfo.Symbol);

            if (okInstrument == null)
            {
                logger.Error($"出售时候发现 不存在的交易对 {buyInfo.Quote},{buyInfo.Symbol}");
                return;
            }

            sellPrice = decimal.Round(sellPrice, okInstrument.GetTickSizeNumber());
            sellSize  = decimal.Round(sellSize, okInstrument.GetSizeIncrementNumber());

            if (buyInfo.Quote.ToLower() == "btc" && buyInfo.Symbol.ToLower() == "bch")
            {
                if (sellSize < (decimal)0.01)
                {
                    sellSize = (decimal)0.01;
                }
            }

            var client_oid = "sell" + DateTime.Now.Ticks;

            try
            {
                logger.Error($"");
                logger.Error($"{JsonConvert.SerializeObject(buyInfo)}");
                logger.Error($"");
                logger.Error($"1: 准备出售 {buyInfo.Quote}-{buyInfo.Symbol}, client_oid:{client_oid},  nowPrice:{nowPrice.ToString()}, sellPrice:{sellPrice.ToString()}, sellSize:{sellSize}");
                var sellResult = OkApi.Sell(client_oid, buyInfo.Symbol + "-" + buyInfo.Quote, sellPrice.ToString(), sellSize.ToString());
                logger.Error($"2: 下单完成 {JsonConvert.SerializeObject(sellResult)}");

                buyInfo.SellClientOid = client_oid;
                buyInfo.SellPrice     = sellPrice;
                buyInfo.SellQuantity  = sellSize;
                buyInfo.SellResult    = sellResult.result;
                buyInfo.SellOrderId   = sellResult.order_id;
                new BuyInfoDao().UpdateBuyInfoWhenSell(buyInfo);

                logger.Error($"3: 添加记录完成");
                logger.Error($"");

                lastSellDate = DateTime.Now;
            }
            catch (Exception e)
            {
                logger.Error("出售异常 严重 --> " + e.Message, e);

                Thread.Sleep(1000 * 60 * 60);
            }
        }
Exemplo n.º 17
0
        protected void Button8_Click(object sender, EventArgs e)
        {
            if (Session["User"] == null)
            {
                Response.Write("<script type='text/javascript'>alert('请登录');</script>");
                return;
            }
            //if (jif==Convert.ToInt16(Label2.Text))
            if ("暂未选择" == Label2.Text || jif != Convert.ToInt16(Label2.Text))
            {
                Response.Write("<script type='text/javascript'>alert('请加注');</script>");
                return;
            }
            if (Label1.Text == "")
            {
                Response.Write("<script type='text/javascript'>alert('请选注');</script>");
                return;
            }
            UserInfo userInfo = new UserInfo();

            userInfo.UserName = Session["User"].ToString();


            BuyInfo   buyInfo    = new BuyInfo();
            DataSet   ds         = BLL.UserMessage.SelectNewLotterys();
            DataTable dt         = ds.Tables[0];
            long      QHnumberss = Convert.ToInt64(dt.Rows[0][0].ToString());

            //if (Regex.IsMatch(QHnumberss.ToString(), @"^[0-9]*$") == true)
            //{
            //    Response.Write("<script type='text/javascript'>alert('数据获取中');</script>");
            //    return;
            //}
            buyInfo.LotteryTcketID = QHnumberss.ToString();
            buyInfo.UserID         = BLL.UserMessage.AddselectID(userInfo);
            buyInfo.NtesItegration = Convert.ToInt16(Label2.Text);
            if (Label1.Text == "大")
            {
                buyInfo.NtesID = 1;
            }
            if (Label1.Text == "小")
            {
                buyInfo.NtesID = 2;
            }
            if (Label1.Text == "单")
            {
                buyInfo.NtesID = 3;
            }
            if (Label1.Text == "双")
            {
                buyInfo.NtesID = 4;
            }
            buyInfo.NtesGade  = 1;
            buyInfo.NtesTimer = Convert.ToDateTime(GetNetDateTime()).ToString();
            if (BLL.UserMessage.ADDbuy(buyInfo) == 1)
            {
                userInfo.UserIntegration = Convert.ToInt16(UserMessage.SelectUserInt(userInfo).ToString()) - Convert.ToInt16(Label2.Text);
                if (BLL.UserMessage.jianUserInt(userInfo) == 1)
                {
                    Response.Write("<script type='text/javascript'>alert('加注成功');</script>");
                    LoginBTN.InnerText = "当前积分为:" + UserMessage.SelectUserInt(userInfo).ToString();
                }
            }
            else
            {
                Response.Write("<script type='text/javascript'>alert('加注失败');</script>");
            }
        }