示例#1
0
        public GoodsInfoDto GetGoodsInfoById(string goodId, SellType sellType)
        {
            using (var conn = GetLotteryConnection())
            {
                string sql = string.Empty;
                if (sellType == SellType.Point)
                {
                    sql =
                        @"SELECT A.Id, A.GoodName,A.Term,A.AuthRankId,B.MemberRank,B.Title,B.PointPrice AS UnitPrice  FROM [dbo].[S_GoodInfo] AS A
LEFT JOIN dbo.MS_AuthRank AS B ON B.Id=A.AuthRankId
LEFT JOIN dbo.L_LotteryInfo AS C ON C.Id=B.LotteryId
WHERE A.Id=@Id";
                }
                else
                {
                    sql =
                        @"SELECT A.Id, A.GoodName,A.Term,A.AuthRankId,B.MemberRank,B.Title,B.AccountPrice AS UnitPrice  FROM [dbo].[S_GoodInfo] AS A
LEFT JOIN dbo.MS_AuthRank AS B ON B.Id=A.AuthRankId
LEFT JOIN dbo.L_LotteryInfo AS C ON C.Id=B.LotteryId
WHERE A.Id=@Id";
                }

                return(conn.Query <GoodsInfoDto>(sql, new
                {
                    Id = goodId
                }).FirstOrDefault());
            }
        }
示例#2
0
 public SaveOrder(string kurreNr, DateTime orderDelivered, DateTime orderSentToCoreSystem, TradeType typeofTrade, SellType typeOfSell, Channel channelId)
 {
     KurreNr               = kurreNr;
     OrderDelivered        = orderDelivered;
     OrderSentToCoreSystem = orderSentToCoreSystem;
     TypeofTrade           = typeofTrade;
     TypeOfSell            = typeOfSell;
     ChannelId             = channelId;
 }
示例#3
0
        public ActivityDto GetAuthAcivity(string authRankId, SellType sellType)
        {
            var sql = "SELECT * FROM [dbo].[S_Activity] WHERE AuthRankId=@AuthRankId AND Status=0";

            using (var conn = GetLotteryConnection())
            {
                conn.Open();
                return(conn.Query(sql, new { AuthRankId = authRankId }).FirstOrDefault());
            }
        }
示例#4
0
        public double GetDiscount(string authRankId, SellType sellType)
        {
            var activity = _activityQueryService.GetAuthAcivity(authRankId, sellType);

            if (activity == null)
            {
                return(1.00);
            }
            return(activity.Discount);
        }
示例#5
0
        public GoodsInfoDto GetGoodsInfoById(string goodId, SellType sellType)
        {
            var goodInfo = _sellQueryService.GetGoodsInfoById(goodId, sellType);

            if (goodInfo == null)
            {
                throw new LotteryException("获取商品信息失败,请稍后重试");
            }
            return(goodInfo);
        }
    public Sprite GetSellSprite(SellType type)
    {
        switch (type)
        {
        case SellType.Empty:
            return(empty);

        case SellType.Full:
            return(full);
        }

        return(empty);
    }
示例#7
0
 public AddOrderRecordCommand(string id, string salesOrderNo, string goodsId, string authRankId, string lotteryId, OrderSourceType orderSourceType,
                              int count, double unitPrice, double originalCost, double orderCost, SellType amountType, string createBy) : base(id)
 {
     SalesOrderNo    = salesOrderNo;
     GoodsId         = goodsId;
     AuthRankId      = authRankId;
     LotteryId       = lotteryId;
     OrderSourceType = orderSourceType;
     Count           = count;
     UnitPrice       = unitPrice;
     OriginalCost    = originalCost;
     OrderCost       = orderCost;
     AmountType      = amountType;
     CreateBy        = createBy;
 }
示例#8
0
 public OrderRecord(string id, string salesOrderNo, string goodsId, string authRankId, string lotteryId, OrderSourceType orderSourceType,
                    int count, double unitPrice, double originalCost, double orderCost, SellType amountType, string createBy) : base(id)
 {
     SalesOrderNo    = salesOrderNo;
     GoodsId         = goodsId;
     AuthRankId      = authRankId;
     LotteryId       = lotteryId;
     OrderSourceType = orderSourceType;
     Count           = count;
     UnitPrice       = unitPrice;
     OriginalCost    = originalCost;
     OrderCost       = orderCost;
     AmountType      = amountType;
     CreateBy        = createBy;
     CreateTime      = DateTime.Now;
     Status          = 0;
     ApplyEvent(new AddOrderRecordEvent(salesOrderNo, goodsId, authRankId, lotteryId, orderSourceType, count, unitPrice, originalCost, orderCost, amountType, createBy, Status));
 }
示例#9
0
        public static string GenerateOrderNo(OrderType orderType, SellType sellType)
        {
            var orderNo = string.Empty;
            var prefix  = "";

            if (orderType == OrderType.Order)
            {
                switch (sellType)
                {
                case SellType.Point:
                    prefix = "OP";
                    break;

                case SellType.Rmb:
                    prefix = "OR";
                    break;
                }
            }
            else if (orderType == OrderType.Pay)
            {
                switch (sellType)
                {
                case SellType.Point:
                    prefix = "PP";
                    break;

                case SellType.Rmb:
                    prefix = "PR";
                    break;
                }
            }
            else
            {
                prefix = "AU";
            }
            var date       = DateTime.Now.ToString("yyyyMMdd");
            var timestamp  = (int)(DateTime.Now - DateTime.Today).TotalSeconds;
            var saltFigure = RandomHelper.GenerateIdentifyCode(4);

            orderNo = prefix + date + timestamp + saltFigure;
            return(orderNo);
        }
示例#10
0
 public void SellTypes()
 {
     using (var db = new DbDataContext()) {
         // Выбираю все значения из таблицы в базе
         foreach (SellType x in db.SellTypes)
         {
             CheckValue <SellTypeEnum>(x.name, x.id);
         }
         // Выбираем все значения из enum'а и ищем их в БД, если такого нет => рекомендуем удалить поле
         foreach (FieldInfo field in typeof(SellTypeEnum).GetFields())
         {
             if (field.Name == "value__")
             {
                 continue;
             }
             SellType sellType = db.SellTypes.SingleOrDefault(t => t.name == field.Name);
             Assert.IsNotNull(sellType, "Удалите " + field.Name + " - его нет в БД");
             Assert.AreEqual(sellType.name, field.Name, "Удалите " + field.Name + " - имя в БД другое");
         }
     }
 }
示例#11
0
 public static string StopLossStepError(SellType sellType, decimal priceCurrent, decimal average, string change, string needed)
 => $"{MarketOrderType.STOPLOSS.GetDescription()} " +
 $"=> CURRENT PRICE => ({priceCurrent}) " +
 $"=> DECREASED => {sellType.GetDescription()} " +
 $"=> ({average}) => BY ({change}) " +
 $"=> NEEDED DECREASED CHANGE => ({needed})";
示例#12
0
 public static string StopLossStepSuccess(SellType sellType, decimal priceCurrent, decimal average, string change)
 => $"{MarketOrderType.STOPLOSS.GetDescription()} " +
 $"=> CURRENT PRICE => ({priceCurrent}) " +
 $"=> DECREASED => {sellType.GetDescription()} " +
 $"=> ({average}) => BY ({change})";
示例#13
0
 public ICollection <GoodsOutput> GetGoodInfos(SellType sellType)
 {
     return(_sellAppService.GetGoodsInfos(_userMemberRank, _lotterySession.SystemTypeId, sellType));
 }
示例#14
0
 public static void SellSelectorMenu(Client player, List <string> names, List <int> IDs, SellType _type, int sellingObjId)
 {
     API.shared.triggerClientEvent(player, "sell_player_select", names.Count, names.ToArray(), IDs.ToArray(), _type.ToString(), sellingObjId, "return_sell_player_select");
 }
示例#15
0
        public ICollection <GoodsOutput> GetGoodsInfos(MemberRank memberRank, string lotteryId, SellType sellType)
        {
            IList <GoodsOutput> result;

            switch (sellType)
            {
            case SellType.Point:
                result = GetPointGoodInfos(memberRank, lotteryId);
                break;

            case SellType.Rmb:
                result = GetRmbGoodInfos(memberRank, lotteryId);
                break;

            default:
                throw new LotteryException("参数错误,不存在该销售类型");
            }
            return(result);
        }
示例#16
0
        public static void PlayerSelectedSell(Client sender, SellType _type, int sellingObjId, int targetplayerId, int price)
        {
            var _player = db_Accounts.FindPlayerById(targetplayerId);

            if (_player == null)
            {
                return;
            }

            switch (_type)
            {
            case SellType.vehicle:
                TradeSellModel _tradeModel = new Models.TradeSellModel
                {
                    BuyerSocialClubID  = _player.socialClubName,
                    OfferedPrice       = price,
                    SellerSocialClubID = sender.socialClubName,
                    SellingObjId       = sellingObjId,
                    Type = _type
                };

                API.shared.setEntityData(_player, SELL_KEY, _tradeModel);
                API.shared.sendChatMessageToPlayer(sender, "~y~Teklifiniz iletildi.");
                API.shared.sendChatMessageToPlayer(_player, $"{db_Accounts.GetPlayerCharacterName(sender)}~y~ alı kişi size {db_Vehicles.GetVehicle(_tradeModel.SellingObjId).VehicleModelId} model aracı ~s~{_tradeModel.OfferedPrice}$ ~y~ ücret karşılığında satmayı öneriyor.\n ~y~((/onayla))~s~ yazarak teklifi kabul edebilirsiniz..");
                break;

            case SellType.house:
                TradeSellModel _tradeModelHouse = new Models.TradeSellModel
                {
                    BuyerSocialClubID  = _player.socialClubName,
                    OfferedPrice       = price,
                    SellerSocialClubID = sender.socialClubName,
                    SellingObjId       = sellingObjId,
                    Type = _type
                };

                API.shared.setEntityData(_player, SELL_KEY, _tradeModelHouse);
                API.shared.sendChatMessageToPlayer(sender, "~y~Teklifiniz iletildi.");
                API.shared.sendChatMessageToPlayer(_player, $"{db_Accounts.GetPlayerCharacterName(sender)}~y~ alı kişi size {db_Houses.GetHouse(_tradeModelHouse.SellingObjId).Name} adlı evi ~s~{_tradeModelHouse.OfferedPrice}$ ~y~ ücret karşılığında satmayı öneriyor.\n ~y~((/onayla))~s~ yazarak teklifi kabul edebilirsiniz..");

                break;

            case SellType.metalparts:
                TradeSellModel _tradeModelMetal = new Models.TradeSellModel
                {
                    BuyerSocialClubID  = _player.socialClubName,
                    OfferedPrice       = price,
                    SellerSocialClubID = sender.socialClubName,
                    SellingObjId       = sellingObjId,
                    Type = _type
                };
                API.shared.setEntityData(_player, SELL_KEY, _tradeModelMetal);
                API.shared.sendChatMessageToPlayer(sender, "~y~Teklifiniz iletildi.");
                API.shared.sendChatMessageToPlayer(_player, $"{db_Accounts.GetPlayerCharacterName(sender)}~y~ alı kişi size {_tradeModelMetal.SellingObjId} adet metal parçayı ~s~{_tradeModelMetal.OfferedPrice}$ ~y~ ücret karşılığında satmayı öneriyor.\n ~y~((/onayla))~s~ yazarak teklifi kabul edebilirsiniz..");


                break;

            default:
                break;
            }
        }