public static uint CalculateBid(this AuctionInfo auctionInfo)
        {
            var currentPrice = auctionInfo.CurrentPrice == 0 ? auctionInfo.StartingBid : auctionInfo.CurrentPrice;

            if (currentPrice < 1000)
            {
                return(currentPrice + 50);
            }

            if (currentPrice < 10000)
            {
                return(currentPrice + 100);
            }

            if (currentPrice < 50000)
            {
                return(currentPrice + 250);
            }

            if (currentPrice < 100000)
            {
                return(currentPrice + 500);
            }

            return(currentPrice + 1000);
        }
示例#2
0
文件: Auction.cs 项目: isoundy000/vr
        /**
         * 取消拍卖
         */
        public static bool cancelAuction(byte[] sender, BigInteger dressId)
        {
            object[] objInfo = _getAuctionInfo(dressId.AsByteArray());
            if (objInfo.Length > 0)
            {
                AuctionInfo info  = (AuctionInfo)(object)objInfo;
                byte[]      owner = info.owner;

                if (sender != owner)
                {
                    return(false);
                }

                if (Runtime.CheckWitness(sender))
                {
                    object[] args = new object[3] {
                        ExecutionEngine.ExecutingScriptHash, owner, dressId
                    };
                    bool res = (bool)deleNgcall("transfer_A2P", args);
                    if (res)
                    {
                        Storage.Delete(Storage.CurrentContext, dressId.AsByteArray());
                        // notify
                        BigInteger oid = _add_oid();
                        CancelAuctioned(oid, owner, dressId);
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#3
0
        /**
         * 上架0代角斗士
         */
        private static bool _saleGen0(byte[] tokenOwner, BigInteger tokenId, BigInteger beginPrice, BigInteger endPrice, BigInteger duration, int sellType)
        {
            if (beginPrice < 0 || endPrice < 0 || beginPrice < endPrice)
            {
                return(false);
            }

            if (endPrice < TX_MIN_FEE)
            {
                // 结束价格不能低于最低手续费
                return(false);
            }

            var nowtime = Blockchain.GetHeader(Blockchain.GetHeight()).Timestamp;

            AuctionInfo info = new AuctionInfo();

            info.owner      = tokenOwner;
            info.sellType   = sellType;
            info.sellTime   = nowtime;
            info.beginPrice = beginPrice;
            info.endPrice   = endPrice;
            info.duration   = duration;

            // 入库记录
            _putAuctionInfo(tokenId.AsByteArray(), info);

            // notify
            Auctioned(tokenOwner, tokenId, beginPrice, endPrice, duration, sellType, nowtime);
            return(true);
        }
示例#4
0
        /**
         * 获取拍卖信息
         */
        public static AuctionInfo getAuctionById(BigInteger tokenId)
        {
            object[]    objInfo = _getAuctionInfo(tokenId.AsByteArray());
            AuctionInfo info    = (AuctionInfo)(object)objInfo;

            return(info);
        }
示例#5
0
        /**
         * 取消拍卖
         */
        public static bool cancelAuction(byte[] sender, BigInteger tokenId)
        {
            object[] objInfo = _getAuctionInfo(tokenId.AsByteArray());
            if (objInfo.Length > 0)
            {
                AuctionInfo info       = (AuctionInfo)(object)objInfo;
                byte[]      tokenOwner = info.owner;

                if (sender != tokenOwner)
                {
                    return(false);
                }

                if (Runtime.CheckWitness(sender))
                {
                    object[] args = new object[3] {
                        ExecutionEngine.ExecutingScriptHash, tokenOwner, tokenId
                    };
                    bool res = (bool)nftCall("transfer_app", args);
                    if (res)
                    {
                        //Storage.Delete(Storage.CurrentContext, tokenId.AsByteArray());
                        _delAuctionInfo(tokenId.AsByteArray());
                        // notify
                        CancelAuctioned(tokenOwner, tokenId);
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#6
0
        public static BigInteger GetAuctionPrice(byte[] auctionid)
        {
            //获取域名的拍卖情况
            AuctionInfo auctionInfo = GetAuctionInfo(auctionid);

            if (auctionInfo.fullDomain == "")
            {
                return(0);
            }
            //获取当前的时间戳
            var currentTimeStamp = Blockchain.GetHeader(Blockchain.GetHeight()).Timestamp;
            //距离开始拍卖已经过了多久
            var timeStamp = currentTimeStamp - auctionInfo.startTimeStamp;
            //获取降价的间隔
            var interval = getSysSetting("interval").AsBigInteger();
            var phase    = timeStamp / interval;
            //计算当前的价格
            var currentPrice = auctionInfo.startPrice - auctionInfo.salePrice * phase;

            if (currentPrice < auctionInfo.endPrice)
            {
                currentPrice = auctionInfo.endPrice;
            }
            return(currentPrice);
        }
示例#7
0
        public void Process(C.MarketPlaceSearchIndex p)
        {
            if (Stage != GameStage.Game && Stage != GameStage.Observer)
            {
                return;
            }

            if (p.Index < 0 || p.Index >= MPSearchResults.Count)
            {
                return;
            }


            AuctionInfo info = MPSearchResults[p.Index];

            if (VisibleResults.Contains(info))
            {
                return;
            }

            VisibleResults.Add(info);

            Enqueue(new S.MarketPlaceSearchIndex {
                Index = p.Index, Result = info.ToClientInfo(Account), ObserverPacket = false
            });
        }
示例#8
0
 protected void lnk_Delete_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
     {
         base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
     }
     else
     {
         int         @int     = WebUtils.GetInt((sender as LinkButton).CommandArgument);
         AuctionInfo dataById = SinGooCMS.BLL.Auction.GetDataById(@int);
         if (dataById == null)
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa");
         }
         else if (SinGooCMS.BLL.Auction.Delete(@int))
         {
             this.BindData();
             PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除拍卖活动[" + dataById.ActName + "] thành công");
             base.ShowAjaxMsg(this.UpdatePanel1, "删除成功");
         }
         else
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "删除失败");
         }
     }
 }
        public IActionResult Add(AuctionInfo model)
        {
            if (ActiveUser == null)
            {
                return(RedirectToAction("Index", "Home"));
            }



            TimeSpan Zero         = new TimeSpan(0, 0, 0);
            Auction  addedAuction = model.NewAuction;
            Bid      firstBid     = model.NewBid;
            TimeSpan start        = addedAuction.end_date.Subtract(DateTime.Now);

            firstBid.auction            = addedAuction;
            firstBid.user               = ActiveUser;
            addedAuction.user           = ActiveUser;
            addedAuction.top_bid        = firstBid.amount;
            addedAuction.auction_status = "active";
            addedAuction.time_remaining = start.Days;

            if (firstBid.amount < 0.01)
            {
                ModelState.AddModelError("amount", "Starting bid is at least $0.01");
            }

            if (ModelState.IsValid)
            {
                _context.auctions.Add(addedAuction);
                _context.bids.Add(firstBid);
                _context.SaveChanges();
                return(RedirectToAction("Dashboard"));
            }
            return(View("New"));
        }
        public AuctionInfo ListAuctionTwiceWithoutTransaction(string auctionId)
        {
            ClearLog();
            AuctionInfo ai = GetNonTransactionalAuctionService().ListAuctionTwiceWithoutTransaction(auctionId);

            ai.Sql = GetLog();
            return(ai);
        }
        public AuctionInfo listPartialAuction(string auctionId)
        {
            ClearLog();
            AuctionInfo ai = GetTransactionalAuctionService().ListPartialAuction(auctionId);

            ai.Sql = GetLog();
            return(ai);
        }
示例#12
0
        public void AuctionEnd(int localID)
        {
            IParcelManagementModule parcelManagement = m_scene.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILandObject landObject = parcelManagement.GetLandObject(localID);
                if (landObject == null)
                {
                    return;
                }

                AuctionInfo info = GetAuctionInfo(localID);
                if (info == null)
                {
                    return; // cannot find this auction??
                }
                AuctionBid highestBid = new AuctionBid()
                {
                    Amount = 0
                };
                foreach (AuctionBid bid in info.AuctionBids)
                {
                    if (highestBid.Amount < bid.Amount)
                    {
                        highestBid = bid;
                    }
                }

                IOfflineMessagesConnector offlineMessages =
                    Framework.Utilities.DataManager.RequestPlugin <IOfflineMessagesConnector>();
                if (offlineMessages != null)
                {
                    offlineMessages.AddOfflineMessage(new GridInstantMessage()
                    {
                        BinaryBucket  = new byte[0],
                        Dialog        = (byte)InstantMessageDialog.MessageBox,
                        FromAgentID   = UUID.Zero,
                        FromAgentName = "System",
                        FromGroup     = false,
                        SessionID     = UUID.Random(),
                        Message       =
                            "You won the auction for the parcel " +
                            landObject.LandData.Name + ", paying " +
                            highestBid.Amount + " for it",
                        Offline        = 0,
                        ParentEstateID = 0,
                        Position       = Vector3.Zero,
                        RegionID       = m_scene.RegionInfo.RegionID,
                        Timestamp      = (uint)Util.UnixTimeSinceEpoch(),
                        ToAgentID      = highestBid.AuctionBidder
                    });
                }
                landObject.UpdateLandSold(highestBid.AuctionBidder, UUID.Zero, false, landObject.LandData.AuctionID,
                                          highestBid.Amount, landObject.LandData.Area);
            }
        }
示例#13
0
        public override void FromOSD(OSDMap map)
        {
            RegionID         = map["RegionID"].AsUUID();
            ScopeID          = map["ScopeID"].AsUUID();
            GlobalID         = map["GlobalID"].AsUUID();
            LocalID          = map["LocalID"].AsInteger();
            SalePrice        = map["SalePrice"].AsInteger();
            UserLocation     = map["UserLocation"].AsVector3();
            UserLookAt       = map["UserLookAt"].AsVector3();
            Name             = map["Name"].AsString();
            Description      = map["Description"].AsString();
            Flags            = (uint)map["Flags"].AsInteger();
            Dwell            = map["Dwell"].AsInteger();
            InfoUUID         = map["InfoUUID"].AsUUID();
            AuctionID        = map["AuctionID"].AsUInteger();
            Area             = map["Area"].AsInteger();
            Maturity         = map["Maturity"].AsInteger();
            OwnerID          = map["OwnerID"].AsUUID();
            GroupID          = map["GroupID"].AsUUID();
            IsGroupOwned     = (GroupID != UUID.Zero);
            SnapshotID       = map["SnapshotID"].AsUUID();
            MediaDescription = map["MediaDescription"].AsString();
            MediaWidth       = map["MediaWidth"].AsInteger();
            MediaHeight      = map["MediaHeight"].AsInteger();
            MediaLoop        = map["MediaLoop"].AsBoolean();
            MediaType        = map["MediaType"].AsString();
            ObscureMedia     = map["ObscureMedia"].AsBoolean();
            ObscureMusic     = map["ObscureMusic"].AsBoolean();
            MediaLoopSet     = (float)map["MediaLoopSet"].AsReal();
            MediaAutoScale   = (byte)map["MediaAutoScale"].AsInteger();
            MediaURL         = map["MediaURL"].AsString();
            MusicURL         = map["MusicURL"].AsString();
            Bitmap           = map["Bitmap"].AsBinary();
            Category         = (ParcelCategory)map["Category"].AsInteger();
            FirstParty       = map["FirstParty"].AsBoolean();
            ClaimDate        = map["ClaimDate"].AsInteger();
            ClaimPrice       = map["ClaimPrice"].AsInteger();
            Status           = (ParcelStatus)map["Status"].AsInteger();
            LandingType      = (byte)map["LandingType"].AsInteger();
            PassHours        = (float)map["PassHours"].AsReal();
            PassPrice        = map["PassPrice"].AsInteger();
            AuthBuyerID      = map["AuthBuyerID"].AsUUID();
            OtherCleanTime   = map["OtherCleanTime"].AsInteger();
            RegionHandle     = map["RegionHandle"].AsULong();
            Private          = map["Private"].AsBoolean();
            AuctionInfo      = new AuctionInfo();
            if (map.ContainsKey("AuctionInfo"))
            {
                AuctionInfo.FromOSD((OSDMap)map["AuctionInfo"]);
            }

            if ((IsGroupOwned) && (GroupID != OwnerID))
            {
                OwnerID = GroupID;
            }
        }
示例#14
0
        public void AddAuctionBid(int LocalID, UUID userID, int bid)
        {
            AuctionInfo info = GetAuctionInfo(LocalID);

            info.AuctionBids.Add(new AuctionBid()
            {
                Amount = bid, AuctionBidder = userID, TimeBid = DateTime.Now
            });
            SaveAuctionInfo(LocalID, info);
        }
示例#15
0
        public async Task <AuctionResponse> PlaceBid(AuctionInfo auctionInfo, uint bidAmount)
        {
            var content   = string.Format("{{\"bid\":{0}}}", bidAmount);
            var uriString = string.Format(Resources.FutHostName + Resources.Bid, auctionInfo.TradeId);
            var response  = await Client.SendAsync(CreateRequestMessage(content, uriString, HttpMethod.Put));

            response.EnsureSuccessStatusCode();

            return(await Deserialize <AuctionResponse>(response));
        }
示例#16
0
        public void ListAuctionTwiceWithTransactionTest()
        {
            AuctionTestService svc = new AuctionTestService();

            AuctionInfo ai = svc.ListAuctionTwiceWithTransaction("3");

            Assert.IsNotNull(ai);

            PrintAuction(ai);
        }
示例#17
0
        public void RunTest()
        {
            PrintTestTitle();
            string      auctionID = "3";
            AuctionInfo ai        = AuctionService.listPartialAuction(auctionID);

            PrintAuction(ai);
            PrintSQL(ai.Sql);
            CloseResult();
        }
示例#18
0
        public void RunTest()
        {
            PrintTestTitle();
            string      auctionID = "3";
            AuctionInfo ai        = AuctionService.ListAuctionTwiceWithoutTransaction(auctionID);

            PrintAuction(ai);
            PrintSQL(ai.Sql);
            CloseResult();
        }
示例#19
0
        public Task <AuctionResponse> PlaceBidAsync(AuctionInfo auctionInfo, uint bidAmount = 0)
        {
            auctionInfo.ThrowIfNullArgument();

            if (bidAmount == 0)
            {
                bidAmount = auctionInfo.CalculateBid();
            }

            return(_requestFactories.PlaceBidRequestFactory(auctionInfo, bidAmount).PerformRequestAsync());
        }
 protected void PrintAuction(AuctionInfo ai)
 {
     WriteLine("AuctionID=" + ai.AuctionID);
     WriteLine("Item " + ai.ItemName);
     WriteLine("ItemID=" + ai.ItemID);
     WriteLine("Description " + ai.Description);
     WriteLine("Graphic file name=" + ai.ItemGraphicFilename);
     WriteLine("Lowest price=" + ai.LowPrice.ToString());
     WriteLine("Seller's name is " + ai.SellerName);
     PrintBids(ai.Bids);
 }
示例#21
0
        public async Task <byte[]> GetPlayerImageAsync(AuctionInfo auctionInfo)
        {
            auctionInfo.ThrowIfNullArgument();

            try
            {
                return(await _requestFactories.PlayerImageRequestFactory(auctionInfo).PerformRequestAsync());
            }
            catch (Exception e)
            {
                throw new FutException("Get player image failed", e);
            }
        }
示例#22
0
        public async Task <Item> GetItemAsync(AuctionInfo auctionInfo)
        {
            auctionInfo.ThrowIfNullArgument();

            try
            {
                return(await _requestFactories.ItemRequestFactory(auctionInfo).PerformRequestAsync());
            }
            catch (Exception e)
            {
                throw new FutException("Get item failed", e);
            }
        }
示例#23
0
        private void SaveAuctionInfo(int LocalID, AuctionInfo info)
        {
            IParcelManagementModule parcelManagement = m_scene.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILandObject landObject = parcelManagement.GetLandObject(LocalID);
                if (landObject == null)
                {
                    return;
                }
                landObject.LandData.AuctionInfo = info;
            }
        }
示例#24
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["GroupID"]          = OSD.FromUUID(GroupID);
            map["IsGroupOwned"]     = OSD.FromBoolean(IsGroupOwned);
            map["OwnerID"]          = OSD.FromUUID(OwnerID);
            map["Maturity"]         = OSD.FromInteger(Maturity);
            map["Area"]             = OSD.FromInteger(Area);
            map["AuctionID"]        = OSD.FromUInteger(AuctionID);
            map["SalePrice"]        = OSD.FromInteger(SalePrice);
            map["InfoUUID"]         = OSD.FromUUID(InfoUUID);
            map["Dwell"]            = OSD.FromInteger(Dwell);
            map["Flags"]            = OSD.FromInteger((int)Flags);
            map["Name"]             = OSD.FromString(Name);
            map["Description"]      = OSD.FromString(Description);
            map["UserLocation"]     = OSD.FromVector3(UserLocation);
            map["LocalID"]          = OSD.FromInteger(LocalID);
            map["GlobalID"]         = OSD.FromUUID(GlobalID);
            map["RegionID"]         = OSD.FromUUID(RegionID);
            map["ScopeID"]          = OSD.FromUUID(ScopeID);
            map["MediaDescription"] = OSD.FromString(MediaDescription);
            map["MediaWidth"]       = OSD.FromInteger(MediaWidth);
            map["MediaHeight"]      = OSD.FromInteger(MediaHeight);
            map["MediaLoop"]        = OSD.FromBoolean(MediaLoop);
            map["MediaType"]        = OSD.FromString(MediaType);
            map["ObscureMedia"]     = OSD.FromBoolean(ObscureMedia);
            map["ObscureMusic"]     = OSD.FromBoolean(ObscureMusic);
            map["SnapshotID"]       = OSD.FromUUID(SnapshotID);
            map["MediaAutoScale"]   = OSD.FromInteger(MediaAutoScale);
            map["MediaLoopSet"]     = OSD.FromReal(MediaLoopSet);
            map["MediaURL"]         = OSD.FromString(MediaURL);
            map["MusicURL"]         = OSD.FromString(MusicURL);
            map["Bitmap"]           = OSD.FromBinary(Bitmap);
            map["Category"]         = OSD.FromInteger((int)Category);
            map["FirstParty"]       = OSD.FromBoolean(FirstParty);
            map["ClaimDate"]        = OSD.FromInteger(ClaimDate);
            map["ClaimPrice"]       = OSD.FromInteger(ClaimPrice);
            map["Status"]           = OSD.FromInteger((int)Status);
            map["LandingType"]      = OSD.FromInteger(LandingType);
            map["PassHours"]        = OSD.FromReal(PassHours);
            map["PassPrice"]        = OSD.FromInteger(PassPrice);
            map["UserLookAt"]       = OSD.FromVector3(UserLookAt);
            map["AuthBuyerID"]      = OSD.FromUUID(AuthBuyerID);
            map["OtherCleanTime"]   = OSD.FromInteger(OtherCleanTime);
            map["RegionHandle"]     = OSD.FromULong(RegionHandle);
            map["Private"]          = OSD.FromBoolean(Private);
            map["AuctionInfo"]      = AuctionInfo.ToOSD();
            return(map);
        }
示例#25
0
        public static int Add(AuctionInfo entity)
        {
            int result;

            if (entity == null)
            {
                result = 0;
            }
            else
            {
                result = BizBase.dbo.InsertModel <AuctionInfo>(entity);
            }
            return(result);
        }
示例#26
0
 public static XElement CreateAuctionInfo(AuctionInfo info)
 {
     return(new XElement("Item", new XAttribute("AuctionID", info.AuctionID),
                         new XAttribute("AuctioneerID", info.AuctioneerID),
                         new XAttribute("AuctioneerName", info.AuctioneerName == null ? "" : info.AuctioneerName),
                         new XAttribute("BeginDate", info.BeginDate.ToString("yyyy-MM-dd HH:mm:ss")),
                         new XAttribute("BuyerID", info.BuyerID),
                         new XAttribute("BuyerName", info.BuyerName == null ? "" : info.BuyerName),
                         new XAttribute("ItemID", info.ItemID),
                         new XAttribute("Mouthful", info.Mouthful),
                         new XAttribute("PayType", info.PayType),
                         new XAttribute("Price", info.Price),
                         new XAttribute("Rise", info.Rise),
                         new XAttribute("ValidDate", info.ValidDate)));
 }
示例#27
0
        /**
         * 存储拍卖信息
         */
        private static void _putAuctionInfo(byte[] tokenId, AuctionInfo info)
        {
            /*
             * // 用一个老式实现法
             * byte[] auctionInfo = _ByteLen(info.owner.Length).Concat(info.owner);
             * auctionInfo = auctionInfo.Concat(_ByteLen(info.sellType.AsByteArray().Length)).Concat(info.sellType.AsByteArray());
             * auctionInfo = auctionInfo.Concat(_ByteLen(info.beginPrice.AsByteArray().Length)).Concat(info.beginPrice.AsByteArray());
             * auctionInfo = auctionInfo.Concat(_ByteLen(info.endPrice.AsByteArray().Length)).Concat(info.endPrice.AsByteArray());
             * auctionInfo = auctionInfo.Concat(_ByteLen(info.duration.AsByteArray().Length)).Concat(info.duration.AsByteArray());
             */
            // 新式实现方法只要一行
            byte[] auctionInfo = Helper.Serialize(info);

            Storage.Put(Storage.CurrentContext, tokenId, auctionInfo);
        }
示例#28
0
        /**
         * sellType:0 拍卖 1克隆拍卖
         */
        private static bool _saleItemWithType(byte[] tokenOwner, BigInteger tokenId, BigInteger beginPrice, BigInteger endPrice, BigInteger duration, int sellType)
        {
            if (tokenOwner.Length != 20)
            {
                Runtime.Log("Owner error.");
                return(false);
            }

            if (beginPrice < 0 || endPrice < 0 || beginPrice < endPrice)
            {
                return(false);
            }

            if (endPrice < TX_MIN_FEE)
            {
                // 结束价格不能低于最低手续费
                return(false);
            }

            //if (Runtime.CheckWitness(tokenOwner))
            // 物品放在拍卖行
            object[] args = new object[3] {
                tokenOwner, ExecutionEngine.ExecutingScriptHash, tokenId
            };
            bool res = (bool)nftCall("transferFrom_app", args);

            if (res)
            {
                var nowtime = Blockchain.GetHeader(Blockchain.GetHeight()).Timestamp;

                AuctionInfo info = new AuctionInfo();
                info.owner      = tokenOwner;
                info.sellType   = sellType;
                info.sellTime   = nowtime;
                info.beginPrice = beginPrice;
                info.endPrice   = endPrice;
                info.duration   = duration;

                // 入库记录
                _putAuctionInfo(tokenId.AsByteArray(), info);

                // notify
                Auctioned(tokenOwner, tokenId, beginPrice, endPrice, duration, sellType, nowtime);
                return(true);
            }

            return(false);
        }
示例#29
0
        public static AuctionInfo GetAuctionInfo(byte[] auctionid)
        {
            //获取域名的拍卖情况
            StorageMap  auctionInfoMap = Storage.CurrentContext.CreateMap("auctionInfoMap");
            var         bytes          = auctionInfoMap.Get(auctionid);
            AuctionInfo auctionInfo    = new AuctionInfo()
            {
                fullHash = new byte[] { }, assetHash = new byte[] { }, auctioner = new byte[] { }, endPrice = 0, fullDomain = "", salePrice = 0, startPrice = 0, startTimeStamp = 0
            };

            if (bytes.Length == 0)
            {
                return(auctionInfo);
            }
            auctionInfo = bytes.Deserialize() as AuctionInfo;
            return(auctionInfo);
        }
示例#30
0
        public static void Process(IHttpRequest Request, IHttpResponse Response)
        {
            bool     value      = false;
            string   message    = "Fail!";
            int      total      = 0;
            XElement result     = new XElement("Result");
            int      page       = int.Parse(Request.Uri.QueryString["page"]);
            string   name       = csFunction.ConvertSql(HttpUtility.UrlDecode(Request.Uri.QueryString["name"]));
            int      type       = int.Parse(Request.Uri.QueryString["type"]);
            int      pay        = int.Parse(Request.Uri.QueryString["pay"]);
            int      userID     = int.Parse(Request.Uri.QueryString["userID"]);
            int      buyID      = int.Parse(Request.Uri.QueryString["buyID"]);
            int      order      = int.Parse(Request.Uri.QueryString["order"]);
            bool     sort       = bool.Parse(Request.Uri.QueryString["sort"]);
            string   AuctionIDs = csFunction.ConvertSql(HttpUtility.UrlDecode(Request.Uri.QueryString["Auctions"]));

            AuctionIDs = (string.IsNullOrEmpty(AuctionIDs) ? "0" : AuctionIDs);
            int size = 100;

            using (PlayerBussiness db = new PlayerBussiness())
            {
                AuctionInfo[] infos = db.GetAuctionPage(page, name, type, pay, ref total, userID, buyID, order, sort, size, AuctionIDs);
                AuctionInfo[] array = infos;
                for (int i = 0; i < array.Length; i++)
                {
                    AuctionInfo info = array[i];
                    XElement    temp = FlashUtils.CreateAuctionInfo(info);
                    using (PlayerBussiness pb = new PlayerBussiness())
                    {
                        ItemInfo item = pb.GetUserItemSingle(info.ItemID);
                        if (item != null)
                        {
                            temp.Add(FlashUtils.CreateGoodsInfo(item));
                        }
                        result.Add(temp);
                    }
                }
                value   = true;
                message = "Success!";
            }
            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("vaule", value));
            result.Add(new XAttribute("message", message));
            Response.Write(result.ToString(false));
        }
示例#31
0
    private static void import(SymmetryEntities dc_, AuctionInfo info_)
    {
      var cusipIdentifier = findCusipIdentifier(dc_, info_);

      if (cusipIdentifier == null) return;

      // take the opportunity to update the coupon if it's different

      if (cusipIdentifier.FI != null 
        && cusipIdentifier.FI.FIBond != null 
        && info_.Coupon.HasValue
        && Math.Abs(Convert.ToDouble(cusipIdentifier.FI.FIBond.Coupon) - info_.Coupon.Value) > 1e-3)
      {
        SLog.log.InfoFormat("Changing coupon of {0} from {1} to {2}", cusipIdentifier.Identifier,
          cusipIdentifier.FI.FIBond.Coupon, info_.Coupon);

        cusipIdentifier.FI.FIBond.Coupon = Convert.ToDecimal(info_.Coupon.Value);
        FIChangeTracking.SetModified(cusipIdentifier.FI.FIBond, dc_);
        dc_.SaveChanges();
      }


      bool found = false;

      foreach (var auction in dc_.FIBondAuctions.Where(x => x.FIID == cusipIdentifier.FIID))
      {

        if (auction.AuctionDate == info_.AuctionDate.Value)
        {
          //SLog.log.DebugFormat("Auction already set up for {0} on {1}", info_.Cusip, info_.AuctionDate.Value);

          if (!auction.EffectiveDate.HasValue)
          {
            SLog.log.InfoFormat("Updating auction effective date to {0}", info_.IssueDate.Value);
            auction.EffectiveDate = info_.IssueDate.Value;
            FIChangeTracking.SetModified(auction, dc_);
          }
          found = true;
          break;
        }
      }

      if (found)
      {
        dc_.SaveChanges();
        return;
      }

      SLog.log.InfoFormat("Setting up auction for {0} on {1}", info_.Cusip, info_.AuctionDate.Value);


      var newAuction = new FIBondAuction()
      {
        FIID = cusipIdentifier.FIID,
        FIBond = dc_.FIBonds.FirstOrDefault(x => x.FIID == cusipIdentifier.FIID),
        AuctionDate = info_.AuctionDate.Value,
        EffectiveDate = info_.IssueDate.Value,
        Term = info_.Term.Value
      };

      dc_.FIBondAuctions.Add(newAuction);
      dc_.SaveChanges();
    }
示例#32
0
    private static FIIdentifier findCusipIdentifier(SymmetryEntities dc_, AuctionInfo info_)
    {
      var cusipIdentifier =
  dc_.FIIdentifiers.FirstOrDefault(
    x => string.Compare(info_.Cusip, x.Identifier, StringComparison.OrdinalIgnoreCase) == 0);

      if (cusipIdentifier == null)
      {
        // can we find by assuming that the cusip is contained within the ISIN?....

        var fi =
          dc_.FIs.FirstOrDefault(
            x =>
              x.InstrumentType == Data.Enums.InstrumentType.Bond &&
              x.SymmetryCode.ToUpper().Contains(info_.Cusip.ToUpper()));

        if (fi == null)
        {
          SLog.log.DebugFormat(
            "Couldn't find bond to update for auction info with cusip={0} ; issueDate={1} ; maturity={2}", info_.Cusip,
            info_.IssueDate, info_.Maturity);
          return null;
        }

        // let's take the opportunity to add in the cusip identifier
        cusipIdentifier = new FIIdentifier
        {
          FIID = fi.FIID,
          FI = fi,
          Identifier = info_.Cusip,
          IdentifierType = Data.Enums.IdentifierType.CUSIP
        };

        dc_.FIIdentifiers.Add(cusipIdentifier);
      }

      return cusipIdentifier;
    }
示例#33
0
 public void SetAuctionInfo(int LocalID, AuctionInfo info)
 {
     SaveAuctionInfo(LocalID, info);
 }
示例#34
0
 private void SaveAuctionInfo(int LocalID, AuctionInfo info)
 {
     IParcelManagementModule parcelManagement = m_scene.RequestModuleInterface<IParcelManagementModule>();
     if (parcelManagement != null)
     {
         ILandObject landObject = parcelManagement.GetLandObject(LocalID);
         if (landObject == null)
             return;
         landObject.LandData.AuctionInfo = info;
     }
 }