Exemplo n.º 1
0
    /// <summary>
    /// 播放特效
    /// </summary>
    /// <param name="type"></param>
    /// <param name="tt"></param>
    /// <param name="count"></param>
    /// <param name="_type"></param>
    public void ShowLottryAnimaEffect(PosType type, LotteryType tt, int count, CostType _type)
    {
        switch (type)
        {
        case PosType.Lorry:
            ty         = type;
            typ        = tt;
            this.count = count;
            t          = _type;
            if (!Chouxiangzi.gameObject.activeInHierarchy)
            {
                Chouxiangzi.gameObject.SetActive(true);
            }
            UI_KaiBaoXiang_01.gameObject.SetActive(true); break;

        case PosType.heroEffect:
            if (!Chouxiangzi.gameObject.activeInHierarchy)
            {
                Chouxiangzi.gameObject.SetActive(true);
            }
            UI_KaiBaoXiang_Hero_01.gameObject.SetActive(true);
            break;
        }
        this.type = AnimType.None;
    }
Exemplo n.º 2
0
        public static async Task <IForecastPlanModel> GetForecastData(LotteryType type, Planner planer, int rule)
        {
            var response = await HttpUtil.GetAsync(GetForecastUrl(type, planer, rule));

            try
            {
                if (string.IsNullOrWhiteSpace(response))
                {
                    return(null);
                }

                var result = JsonConvert.DeserializeObject <JinMaForecastPlanModel>(response);
                result.Plan = planer.GetPlan();
                if (result.ForecastData != null && result.ForecastData.Any())
                {
                    var current = result.ForecastData.LastOrDefault();
                    var pn      = current.LastDrawnPeriod % 1000 >= current.LastPeriod
                        ? current.LastPeriod / 1000 * 1000 + current.LastPeriod - 1
                        : current.LastDrawnPeriod;

                    current.LastDrawnPeriod = pn;
                    result.LastDrawnPeriod  = pn;
                }

                return(result);
            }
            catch (Exception ex)
            {
                ExceptionlessUtil.Warn(ex, $"预测数据反序列化失败,内容:{response}");
                return(null);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩),创建彩票玩法
        /// </summary>
        /// <param name="lotteryType">彩票种类</param>
        private void CreatePlayMethods(LotteryType lotteryType)
        {
            this.MethodTypes.Clear();
            if (lotteryType == LotteryType.ShangHaiWelfareLottery)
            {
                PlayMethod type = new PlayMethod("15选5", "华东六省联销", "155", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("3D", "全国", "3d", lotteryType);//需要
                MethodTypes.Add(type);

                type = new PlayMethod("双色球", "全国", "ssq", lotteryType);//需要
                MethodTypes.Add(type);

                type = new PlayMethod("七乐彩", "全国", "307", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("6+1", "华东六省联销", "601", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("天天彩4", "上海", "4d", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("时时乐", "上海", "ssl", lotteryType);//需要
                MethodTypes.Add(type);
            }
        }
Exemplo n.º 4
0
        public LotteryTicketModel SellLottery(LotteryBuyer lotteryBuyer, LotteryType lotteryType)
        {
            var issue = GetlatestIssue();

            if (issue == null)
            {
                throw new Exception("没有找到本期数据。");
            }
            if (issue.Stat != (int)IssueStat.Establish)
            {
                throw new Exception("本期已经结束。");
            }
            var buyerIssue = _buyerIssueRepository.Table.Where(bi => bi.BuyerId == lotteryBuyer.Id && bi.IssueId == issue.Id).FirstOrDefault();

            if (buyerIssue == null)
            {
                buyerIssue = new BuyerIssue()
                {
                    BuyerId          = lotteryBuyer.Id,
                    IssueId          = issue.Id,
                    PurchaseQuantity = 0
                };
                _buyerIssueRepository.Insert(buyerIssue);
            }
            buyerIssue.PurchaseQuantity = buyerIssue.PurchaseQuantity + 1;
            LotteryTicketModel model = SendLotteryTicket(buyerIssue, issue, (int)lotteryType);

            return(model);
        }
        /// <summary>
        /// 根据彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩),创建彩票玩法
        /// </summary>
        /// <param name="lotteryType">彩票种类</param>
        private void CreatePlayMethods(LotteryType lotteryType)
        {
            this.MethodTypes.Clear();
            if (lotteryType == LotteryType.ShangHaiWelfareLottery)
            {
                PlayMethod type = new PlayMethod("15选5", "华东六省联销", "155", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("3D", "全国", "3d", lotteryType);//需要
                MethodTypes.Add(type);

                type = new PlayMethod("双色球", "全国", "ssq", lotteryType);//需要
                MethodTypes.Add(type);

                type = new PlayMethod("七乐彩", "全国", "307", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("6+1", "华东六省联销", "601", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("天天彩4", "上海", "4d", lotteryType);
                MethodTypes.Add(type);

                type = new PlayMethod("时时乐", "上海", "ssl", lotteryType);//需要
                MethodTypes.Add(type);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        public void InitData()
        {
            //获取彩种列表
            ILotteryTypeService lotteryTypeService = IoC.Resolve <ILotteryTypeService>();

            lotteryTypeList = lotteryTypeService.GetAll().ToList();

            //根据彩种获取玩法列表
            if (lotteryTypeList != null && lotteryTypeList.Count > 0)
            {
                //默认显示彩种
                if (lotteryId == "")
                {
                    lotteryId = lotteryTypeList[0].LotteryCode;
                    this.txtLotteryId.Value = lotteryId;
                }

                string      lotteryName = "";
                LotteryType lotteryType = lotteryTypeList.Where(m => m.LotteryCode == lotteryId).FirstOrDefault();
                if (lotteryType != null)
                {
                    lotteryName = lotteryType.LotteryName;
                    lotteryId   = lotteryType.LotteryCode;
                }
            }
            this.BindResult();
        }
Exemplo n.º 7
0
 public bool UpdateUserLotteryPlan(string userId, LotteryType lotteryType, IList <int> planIds)
 {
     if (planIds.Count <= 0)
     {
         throw new LSException("您还没选中任何计划");
     }
     return(_anylseNormService.UpdateUserLotteryPlan(userId, lotteryType, planIds));
 }
 /// <summary>
 /// 根据彩票种类和响应状态码得到状态对象
 /// </summary>
 /// <param name="lotteryType">彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩)</param>
 /// <param name="playName">响应状态</param>
 /// <returns>状态对象</returns>
 public ResponseStatus GetResponseStatus(LotteryType lotteryType, string statusCode)
 {
     foreach (ResponseStatus status in this.Statuses)
     {
         if (status.LotteryType == lotteryType && status.StatusCode == statusCode)
             return status;
     }
     return null;
 }
Exemplo n.º 9
0
        public void InsertUserPlans(string userId, LotteryType lotteryType, UserBasicNorm userBasicNorm, IList <int> planIds)
        {
            string sqlStr1 = "INSERT INTO [dbo].[LotteryAnalyseNorms]([Id],[PlanId],[PlanCycle],[LastStartPeriod],[ForecastCount],[BasicHistoryCount] ,[UnitHistoryCount],[HotWeight],[SizeWeight]" +
                             " ,[ThreeRegionWeight],[MissingValueWeight],[OddEvenWeight],[Modulus],[LotteryType],[Enable],[IsDefault],[CreatTime],[CreateUserId])" +
                             " VALUES(@Id, @PlanId, @PlanCycle, @LastStartPeriod, @ForecastCount, @BasicHistoryCount, @UnitHistoryCount, @HotWeight, @SizeWeight, @ThreeRegionWeight, @MissingValueWeight" +
                             ", @OddEvenWeight, @Modulus, @LotteryType, @ENABLE, @IsDefault, GETDATE(), @CreateUserId)";
            string sqlStr2 = "INSERT INTO [dbo].[UserAnylseNorms]([Id],[UserId],[PlanId],[LotteryAnalyseNormId],[LotteryType],[CreatTime])" +
                             " VALUES(@Id, @UserId,@PlanId, @LotteryAnalyseNormId, @LotteryType, GETDATE())";

            using (var cn = LotteryDbConnection)
            {
                cn.Open();
                using (var trans = cn.BeginTransaction())
                {
                    try
                    {
                        foreach (var planId in planIds)
                        {
                            var lotteryAnalyseNorm = new LotteryAnalyseNorm()
                            {
                                PlanId             = planId,
                                BasicHistoryCount  = userBasicNorm.BasicHistoryCount,
                                CreateUserId       = userId,
                                ForecastCount      = userBasicNorm.ForecastCount,
                                HotWeight          = userBasicNorm.HotWeight,
                                LastStartPeriod    = 0, // Todo: set LastStartPeriod
                                LotteryType        = lotteryType.ToString(),
                                UnitHistoryCount   = userBasicNorm.UnitHistoryCount,
                                Modulus            = userBasicNorm.Modulus,
                                OddEvenWeight      = userBasicNorm.OddEvenWeight,
                                MissingValueWeight = userBasicNorm.MissingValueWeight,
                                ThreeRegionWeight  = userBasicNorm.ThreeRegionWeight,
                                SizeWeight         = userBasicNorm.SizeWeight,
                                PlanCycle          = userBasicNorm.PlanCycle,
                            };
                            var userAnalyseNorm = new UserAnylseNorm()
                            {
                                LotteryAnalyseNormId = lotteryAnalyseNorm.Id,
                                LotteryType          = lotteryType.ToString(),
                                UserId = userId,
                                PlanId = planId,
                            };

                            cn.Execute(sqlStr1, lotteryAnalyseNorm, trans);
                            cn.Execute(sqlStr2, userAnalyseNorm, trans);
                        }
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        LogDbHelper.LogError(ex, GetType() + "=>InsertUserPlans");
                        throw ex;
                    }
                }
            }
        }
Exemplo n.º 10
0
 public void InitShow(long ID, int index, LotteryType type)
 {
     if (index != -1)
     {
         _index = index;
     }
     _type = type;
     showList.Add(ID);
 }
Exemplo n.º 11
0
    public void LotteryRequest(LotteryType type, int count, CostType costType)
    {
        Dictionary <string, object> newpacket = new Dictionary <string, object>();

        newpacket.Add("arg1", (int)costType); //0:免费1正常消费
        newpacket.Add("arg2", count);         //购买次数
        newpacket.Add("arg3", (int)type);     //抽奖类型 1金币抽;2钻石抽;3魂匣抽
        PackNormalKvpAndSend(MessageID.common_lucky_gamble_req, newpacket);
    }
Exemplo n.º 12
0
 public ChangeBonusWindow(double bonusPct,double scale,double bonus,int multiple,LotteryType type,int playtype)
     : this()
 {
     BonusPct = bonusPct;
     Scale = scale;
     Bonus = bonus;
     Multiple = multiple;
     lotteryType = type;
     PlayTypeID = playtype;
 }
Exemplo n.º 13
0
 /// <summary>
 /// 根据彩票种类和响应状态码得到状态对象
 /// </summary>
 /// <param name="lotteryType">彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩)</param>
 /// <param name="playName">响应状态</param>
 /// <returns>状态对象</returns>
 public ResponseStatus GetResponseStatus(LotteryType lotteryType, string statusCode)
 {
     foreach (ResponseStatus status in this.Statuses)
     {
         if (status.LotteryType == lotteryType && status.StatusCode == statusCode)
         {
             return(status);
         }
     }
     return(null);
 }
        /// <summary>
        /// 根据彩票种类和玩法名称得到玩法对象
        /// </summary>
        /// <param name="lotteryType">彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩),得到该类彩票玩法</param>
        /// <param name="playName">玩法名称</param>
        /// <returns>玩法对象</returns>
        public PlayMethod GetMethodType(LotteryType lotteryType, string playName)
        {
            playName = playName.ToUpper();
            foreach (PlayMethod methodType in this.MethodTypes)
            {
                if (methodType.LotteryType == lotteryType && (methodType.PlayName == playName || methodType.GameName.Equals(playName, StringComparison.OrdinalIgnoreCase)))
                    return methodType;
            }

            return null;
        }
Exemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="playName">玩法名称</param>
        /// <param name="area">区域</param>
        /// <param name="gameName">玩法编号</param>
        /// <param name="lotteryType">彩票种类,如:上海福彩,重庆福彩,江西福彩,山东体彩</param>
        public PlayMethod(string playName, string area, string gameName, LotteryType lotteryType)
        {
            this.PlayName    = playName;
            this.Area        = area;
            this.GameName    = gameName;
            this.LotteryType = lotteryType;

            this.PlayTypes.Clear();
            PlayType pType = null;

            switch (gameName.ToLower())
            {
            case "ssq":    //双色球(ssq)
            case "601":    //华东六省联销6+1(601)
                pType = new PlayType("101", "单式投注", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("102", "复式投注", "");
                this.PlayTypes.Add(pType);
                break;

            case "307":    //七乐彩(307)
            case "155":    //15选5(155)
                pType = new PlayType("101", "单式投注", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("102", "复式投注", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("103", "胆拖投注", "");
                this.PlayTypes.Add(pType);
                break;

            case "3d":    //3D(3d)
                pType = new PlayType("201", "直选投注", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("202", "组选投注", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("204", "直选和值", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("208", "直选按位包号", "");
                this.PlayTypes.Add(pType);
                break;

            case "4d":    //天天彩4(4d)
            case "ssl":   //时时乐(ssl)
                pType = new PlayType("201", "直选投注", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("202", "组选投注", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("208", "直选按位包号", "");
                this.PlayTypes.Add(pType);
                pType = new PlayType("230", "组选按位包号", "");
                this.PlayTypes.Add(pType);
                break;
            }
        }
Exemplo n.º 16
0
        protected LotteryDataJob(LotteryType lotteryType)
        {
            HostingEnvironment.RegisterObject(this);
            _LotteryType               = lotteryType;
            _lotteryDataAppService     = ServiceLocator.Current.GetInstance <ILotteryDataAppService>();
            _lotteryUpdateConfigLoader = ServiceLocator.Current.GetInstance <ILotteryUpdateConfigLoader>();
            _lotteryUpdateConfig       = _lotteryUpdateConfigLoader.GetLotteryUpdateConfigs().Single(p => p.Name == lotteryType.ToString());
            //_nextLotteryTime = _lotteryUpdateConfig.NextLotteryTime;

            _dataUpdateContainer = new DataUpdateContainer(_lotteryUpdateConfig, _lotteryDataAppService, this);
        }
Exemplo n.º 17
0
        public MailNotifyModel(LotteryType lottery, int rule, Plan plan, IForecastPlanModel forecastPlan, string partnerForecastNo)
        {
            Lottery      = lottery.ToStringName();
            Rule         = rule.ToStringName(lottery);
            Plan         = plan;
            ForecastPlan = forecastPlan;

            CurrentPeriod     = ForecastPlan.ForecastData.LastOrDefault();
            PassedPeriod      = ForecastPlan.ForecastData.Take(ForecastPlan.ForecastData.Count - 1);
            PartnerForecastNo = partnerForecastNo;
        }
        /// <summary>
        /// 根据彩票类型和交易类型描述得到交易类型对象
        /// </summary>
        /// <param name="lotterType">彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩)</param>
        /// <param name="typeCode">交易类型描述</param>
        /// <returns>交易类型</returns>
        public TransactionType GetTransactionTypeByDesc(LotteryType lotterType, string desc)
        {
            foreach (TransactionType transType in this.TransTypes)
            {
                if (transType.LotteryType == lotterType && transType.Description == desc)
                {
                    return(transType);
                }
            }

            return(null);
        }
        /// <summary>
        /// 根据彩票类型和交易类型编号得到交易类型对象
        /// </summary>
        /// <param name="lotterType">彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩)</param>
        /// <param name="typeCode">交易类型编号</param>
        /// <returns>交易类型</returns>
        public TransactionType GetTransactionTypeByTypeCode(LotteryType lotterType, string typeCode)
        {
            foreach (TransactionType transType in this.TransTypes)
            {
                if (transType.LotteryType == lotterType && transType.TypeCode == typeCode)
                {
                    return(transType);
                }
            }

            return(null);
        }
Exemplo n.º 20
0
        public LotteryDataAnlyer(LotteryType lotteryType, IList <NumberInfo> numberInfos, int lotteryDataCount)
        {
            _lotteryType            = lotteryType;
            _lotteryDataCount       = lotteryDataCount;
            _numberInfos            = numberInfos;
            _lotteryNumberAnalyzers = new ConcurrentDictionary <int, LotteryNumberAnalyzer>();

            _lotteryDataManager = ServiceLocator.Current.GetInstance <ILotteryDataManager>();
            _lotteryDataPackage = _lotteryDataManager.GetHistoryLotteryDatas(lotteryType, lotteryDataCount);

            InitNumberInfoAnalyzers();
        }
Exemplo n.º 21
0
        public static string ToStringName(this int rule, LotteryType lottery)
        {
            switch (lottery)
            {
            case LotteryType.Pk10:
                return(((Pk10Rule)rule).ToStringName());

            case LotteryType.Cqssc:
                return(((CqsscRule)rule).ToStringName());
            }

            throw new ArgumentException($"彩种 - “{lottery}” 暂不支持");
        }
Exemplo n.º 22
0
        /// <summary>
        /// 采集指定彩种和玩法的通知
        /// </summary>
        /// <returns>The notifications.</returns>
        /// <param name="notifications">Notifications.</param>
        /// <param name="lottery">Lottery.</param>
        /// <param name="rule">Rule.</param>
        /// <param name="criticalScore">Critical score.</param>
        private async Task GetNotifications(ICollection <string> notifications, LotteryType lottery, int rule,
                                            float criticalScore)
        {
            var plans = await _analyzer.GetForecastData(lottery, rule);

            _analyzer.CalcuteScore(plans);

            //plans.ForEach(p =>
            //{
            //    if (p.Score >= criticalScore)
            //        notifications.Add(JinMaStrategyService.Instance.CreateNotification(lottery, rule, Plan.PlanA, p.ForecastDrawNo, p.Score));
            //});
        }
Exemplo n.º 23
0
        /// <summary>
        /// 彩票引擎构造器,必须私有化,不允许外界访问
        /// </summary>
        /// <param name="lotteryType">彩种</param>
        /// <param name="lotteryConfigData">彩票配置信息</param>
        private LotteryEngine(LotteryType lotteryType, string lotteryConfigData)
        {
            _lotteryType    = lotteryType;
            _lotteryFeature = lotteryConfigData.ToObject <LotteryFeature>();
            _lotteryFeatures[lotteryType] = _lotteryFeature;
            _lotteryAnalyseNormManager    = ServiceLocator.Current.GetInstance <ILotteryAnalyseNormManager>();
            _lotteryAnalyseNorms          = _lotteryAnalyseNormManager.LoadLotteryAnalyseNorms(lotteryType);
            _lotteryDataManager           = ServiceLocator.Current.GetInstance <ILotteryDataManager>();

            InitLotteryPlan();

            RedisHelper.Set(AppUtils.GetLotteryRedisKey(lotteryType.ToString(), LsConstant.LotteryFeatureRedisKey), lotteryConfigData);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 根据彩票种类和玩法名称得到玩法对象
        /// </summary>
        /// <param name="lotteryType">彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩),得到该类彩票玩法</param>
        /// <param name="playName">玩法名称</param>
        /// <returns>玩法对象</returns>
        public PlayMethod GetMethodType(LotteryType lotteryType, string playName)
        {
            playName = playName.ToUpper();
            foreach (PlayMethod methodType in this.MethodTypes)
            {
                if (methodType.LotteryType == lotteryType && (methodType.PlayName == playName || methodType.GameName.Equals(playName, StringComparison.OrdinalIgnoreCase)))
                {
                    return(methodType);
                }
            }

            return(null);
        }
Exemplo n.º 25
0
 public static void ValidNumbers(WelfareLottery pWelfareLottery, LotteryType pLotteryType)
 {
     IValidNumber valid = null;
     switch (pLotteryType)
     {
         case LotteryType.TwoColor: valid = new TwoColor(); break;
         case LotteryType.FuCai3D: valid = new FuCai3D(); break;
         default: break;
     }
     if (null != valid)
     {
         valid.Valid(pWelfareLottery);
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// 购买数量,货币类型1金币2钻石,价格,购买药剂名称,图标名,物品品质,药水ID
 /// </summary>
 /// <param name="buyCount"></param>
 /// <param name="moneyType"></param>
 /// <param name="price"></param>
 protected override void SetUI(params object[] uiParams)
 {
     if (uiParams.Length > 0)
     {
         mBuyCount    = (int)uiParams[0];
         mLotteryType = (LotteryType)uiParams[1];
         mPrice       = int.Parse(uiParams[2].ToString());
         mName        = uiParams[3].ToString();
         mIconName    = uiParams[4].ToString();
         mQuality     = uiParams[5].ToString();
         mItemID      = long.Parse(uiParams[6].ToString());
     }
     base.SetUI(uiParams);
 }
Exemplo n.º 27
0
 /// <summary>
 /// 播放完成
 /// </summary>
 public void LottryAnimaEffectHandle()
 {
     if (typ != LotteryType.None && count != 0 && t != CostType.None)
     {
         ClientSendDataMgr.GetSingle().GetLotterySend().LotteryRequest(typ, this.count, t);
         typ   = LotteryType.None;
         count = 0;
         t     = CostType.None;
     }
     UI_KaiBaoXiang_01.gameObject.SetActive(false);
     //  HideLottryAnimaEffect();
     //   Control.HideGUI(GameLibrary.UILottryEffect);
     Control.ShowGUI(UIPanleID.UIMoney, EnumOpenUIType.DefaultUIOrSecond);
 }
Exemplo n.º 28
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="playName">玩法名称</param>
        /// <param name="area">区域</param>
        /// <param name="gameName">玩法编号</param>
        /// <param name="lotteryType">彩票种类,如:上海福彩,重庆福彩,江西福彩,山东体彩</param>
        public PlayMethod(string playName, string area, string gameName, LotteryType lotteryType)
        {
            this.PlayName = playName;
            this.Area = area;
            this.GameName = gameName;
            this.LotteryType = lotteryType;

            this.PlayTypes.Clear();
            PlayType pType = null;
            switch (gameName.ToLower())
            {
                case "ssq"://双色球(ssq)
                case "601"://华东六省联销6+1(601)
                    pType = new PlayType("101", "单式投注", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("102", "复式投注", "");
                    this.PlayTypes.Add(pType);
                    break;
                case "307"://七乐彩(307)
                case "155"://15选5(155)
                    pType = new PlayType("101", "单式投注", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("102", "复式投注", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("103", "胆拖投注", "");
                    this.PlayTypes.Add(pType);
                    break;
                case "3d"://3D(3d)
                    pType = new PlayType("201", "直选投注", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("202", "组选投注", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("204", "直选和值", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("208", "直选按位包号", "");
                    this.PlayTypes.Add(pType);
                    break;
                case "4d"://天天彩4(4d)
                case "ssl"://时时乐(ssl)
                    pType = new PlayType("201", "直选投注", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("202", "组选投注", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("208", "直选按位包号", "");
                    this.PlayTypes.Add(pType);
                    pType = new PlayType("230", "组选按位包号", "");
                    this.PlayTypes.Add(pType);
                    break;
            }
        }
Exemplo n.º 29
0
        static void MainProcess()
        {
            if (!int.TryParse(Console.ReadLine(), out int input) || input >= Enum.GetValues(typeof(LotteryType)).Length)
            {
                Console.WriteLine("[Error] Illegal inputs. Please try again." + Environment.NewLine);
            }
            else
            {
                LotteryType lotteryType = (LotteryType)input;

                var lotteryNumber = LotteryNumberGenerator.MakeLotteryNumbers(lotteryType);

                Console.WriteLine("Lottery Number:" + string.Join(", ", lotteryNumber) + Environment.NewLine);
            }
        }
Exemplo n.º 30
0
 public BetRecord(LotteryType lottery, int rule, Plan plan, long periodNo, string betNo, int chaseTimes, decimal betMoney, float odds, BetType betType, decimal balance)
 {
     Lottery    = lottery;
     Rule       = rule;
     Plan       = plan;
     PeriodNo   = periodNo;
     BetNo      = string.Join(",", betNo.Split(' '));
     ChaseTimes = chaseTimes;
     BetMoney   = betMoney;
     Odds       = odds;
     BetType    = betType;
     Balance    = balance;
     BetTime    = DateTime.UtcNow;
     IsDrawn    = false;
 }
        /// <summary>
        /// 初始化数据
        /// </summary>
        public void InitData()
        {
            //获取彩种列表
            ILotteryTypeService lotteryTypeService = IoC.Resolve <ILotteryTypeService>();

            lotteryTypeList = lotteryTypeService.GetAll().ToList();

            //根据彩种获取玩法列表
            if (lotteryTypeList != null && lotteryTypeList.Count > 0)
            {
                //默认加载第一个彩种
                if (string.IsNullOrEmpty(lotteryCode))
                {
                    lotteryCode = lotteryTypeList[0].LotteryCode;
                }


                LotteryType lotteryType = lotteryTypeList.Where(m => m.LotteryCode == lotteryCode).FirstOrDefault();
                if (lotteryType == null)
                {
                    return;
                }

                string lotteryName = lotteryType.LotteryName;
                txtLotteryCode.Value = lotteryType.LotteryCode;
                txtLotteryId.Value   = lotteryType.Id.ToString();

                List <LotteryIssueModel> lotteryIssueModelList = new List <LotteryIssueModel>();
                ILotteryIssueService     lotteryIssueService   = IoC.Resolve <ILotteryIssueService>();
                List <LotteryIssue>      lotteryIssueList      = lotteryIssueService.GetNowDayIssue(lotteryType.Id).ToList().OrderBy(x => x.IssueCode).ToList();
                if (lotteryIssueList != null && lotteryIssueList.Count > 0)
                {
                    foreach (var item in lotteryIssueList)
                    {
                        LotteryIssueModel model = new LotteryIssueModel();
                        model.Id          = item.Id;
                        model.IssueCode   = item.IssueCode;
                        model.Result      = item.Result;
                        model.LotteryTime = item.LotteryTime;
                        model.LotteryId   = lotteryType.Id;
                        model.LotteryName = lotteryName;
                        lotteryIssueModelList.Add(model);
                    }
                }
                this.repList.DataSource = lotteryIssueModelList;
                this.repList.DataBind();
            }
        }
Exemplo n.º 32
0
        public override async Task <List <IForecastPlanModel> > GetForecastData(LotteryType type,
                                                                                int rule)
        {
            var planA = await GetForecastData(type, Planner.Planner1, rule);

            var planB = await GetForecastData(type, Planner.Planner2, rule);

            if (planA == null || planB == null || planA.LastDrawnPeriod != planB.LastDrawnPeriod)
            {
                return(null);
            }

            return(new List <IForecastPlanModel> {
                planA, planB
            });
        }
Exemplo n.º 33
0
        /// <summary>
        /// 获取开奖号码历史记录接口地址
        /// </summary>
        /// <param name="type">彩种</param>
        /// <returns>开奖号码历史记录接口地址</returns>
        private static string GetHistoryUrl(LotteryType type)
        {
            var baseUrl = $"{RootUrl}ajax_getlotry.php";

            switch (type)
            {
            case LotteryType.Cqssc:
                return(baseUrl);

            case LotteryType.Pk10:
                return($"{baseUrl}?cai=pk10");

            default:
                return(null);
            }
        }
Exemplo n.º 34
0
        public IList <LotteryPlanGroupDto> GetUserLotteryPlans(string userId, LotteryType lotteryType)
        {
            var lotteryPlanGroupDtos = new List <LotteryPlanGroupDto>();
            var selectedPlanGroup    = new LotteryPlanGroupDto()
            {
                LotteryType    = lotteryType.ToString(),
                GroupId        = 0,
                GroupName      = "已选计划",
                IsSelecedGroup = true,
                Plans          = new List <PlanOutput>(),
            };

            lotteryPlanGroupDtos.Add(selectedPlanGroup);

            var lotteryFeature    = _lotteryFeatureLoader.LoadLotteryFeature(lotteryType);
            var userSelectedPlans = _anylseNormAppService.GetUserSelectedPlans(userId, lotteryType);

            foreach (var normGroup in lotteryFeature.LotteryNorm.NormGroup)
            {
                var planGroupDto = new LotteryPlanGroupDto()
                {
                    LotteryType    = lotteryType.ToString(),
                    GroupId        = normGroup.GroupId,
                    GroupName      = normGroup.Cname,
                    IsSelecedGroup = false,
                    Plans          = new List <PlanOutput>(),
                };
                foreach (var plan in normGroup.Plans)
                {
                    var planDto = new PlanOutput()
                    {
                        PlanId     = plan.PlanId,
                        PlanName   = plan.Name,
                        IsSelected = false
                    };
                    if (userSelectedPlans.Contains(planDto.PlanId))
                    {
                        planDto.IsSelected = true;
                        selectedPlanGroup.Plans.Add(planDto);
                    }
                    planGroupDto.Plans.Add(planDto);
                }
                lotteryPlanGroupDtos.Add(planGroupDto);
            }

            return(lotteryPlanGroupDtos);
        }
Exemplo n.º 35
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        public void InitData()
        {
            //获取彩种列表
            ILotteryTypeService lotteryTypeService = IoC.Resolve <ILotteryTypeService>();

            lotteryTypeList = lotteryTypeService.GetAll().ToList();

            //根据彩种获取玩法列表
            if (lotteryTypeList != null && lotteryTypeList.Count > 0)
            {
                //默认显示彩种
                if (lotteryId == 0)
                {
                    lotteryId = lotteryTypeList[0].Id;
                }

                string      lotteryName = "";
                LotteryType lotteryType = lotteryTypeList.Where(m => m.Id == lotteryId).FirstOrDefault();
                if (lotteryType != null)
                {
                    lotteryName = lotteryType.LotteryName;
                    lotteryId   = lotteryType.Id;
                }

                List <LotteryIssueModel> lotteryIssueModelList = new List <LotteryIssueModel>();
                ILotteryIssueService     lotteryIssueService   = IoC.Resolve <ILotteryIssueService>();
                List <LotteryIssue>      lotteryIssueList      = lotteryIssueService.GetNowDayIssue(lotteryId).ToList();
                if (lotteryIssueList != null && lotteryIssueList.Count > 0)
                {
                    foreach (var item in lotteryIssueList)
                    {
                        LotteryIssueModel model = new LotteryIssueModel();
                        model.Id          = item.Id;
                        model.IssueCode   = item.IssueCode;
                        model.StartTime   = item.StartTime;
                        model.EndTime     = item.EndTime;
                        model.LotteryTime = item.LotteryTime;
                        model.EndSaleTime = item.EndSaleTime;
                        model.LotteryId   = lotteryId;
                        model.LotteryName = lotteryName;
                        lotteryIssueModelList.Add(model);
                    }
                }
                this.repList.DataSource = lotteryIssueModelList;
                this.repList.DataBind();
            }
        }
Exemplo n.º 36
0
        /// <summary>
        /// 提款工厂
        /// </summary>
        /// <param name="lotterType"></param>
        /// <returns></returns>
        public static IHPGateway.IDrawingGateway CreateDrawingGatewayFactory(LotteryType lotterType)
        {
            try
            {
                if (lotterType == LotteryType.ShangHaiWelfareLottery)
                {
                    IDrawingGateway gateway = new DrawingGateway();
                    return gateway;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return null;
        }
Exemplo n.º 37
0
        /// <summary>
        /// 获取预测开奖号码接口地址
        /// </summary>
        /// <param name="type">彩种</param>
        /// <param name="planner">计划员</param>
        /// <param name="rule">玩法(请使用具体玩法枚举,如"PK10Rule","CQSSCRule")</param>
        /// <returns>预测开奖号码接口地址</returns>
        private static string GetForecastUrl(LotteryType type, Planner planner, int rule)
        {
            var format =
                $"{RootUrl}ajax_getapi.php?type={{0}}{((int) planner > 1 ? ((int) planner).ToString() : string.Empty)}&a={rule}&t=0.{new Random().Next()}";

            switch (type)
            {
            case LotteryType.Cqssc:
                return(string.Format(format, "ssc"));

            case LotteryType.Pk10:
                return(string.Format(format, "pk10"));

            default:
                return(null);
            }
        }
Exemplo n.º 38
0
 public static string GetScale(double MaxScale, double Bonus, int Multiple, LotteryType type)
 {
     if (type == LotteryType.SSC || type == LotteryType._3D)
     {
         if (Multiple == 100)
             return ((MaxScale - Bonus * 20/Multiple)).ToString("F2");
         else if(Multiple == 10)
             return ((MaxScale - Bonus * 20/Multiple)).ToString("F1");
         else if (Multiple == 1000)
             return (MaxScale).ToString("F2");
         else
             return ((MaxScale - Bonus * 20/Multiple)).ToString("F0");
     }
     else
     {
         return (MaxScale).ToString("F2");
     }
 }
Exemplo n.º 39
0
        public void GoPaiJiang(LotteryType type)
        {
            s = WcfProxy.GetProxy;
            List<LotteryNumsInfo> info = s.getIsNotPJ((int)type).ToList();
            foreach (LotteryNumsInfo ln in info)
            {
                try
                {

                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine(type.ToString() + "==>" + DateTime.Now.ToString() + "," + ln.IssueNo + "期派奖开始");
                    s.UpdateLotteryFlag(1, ln.LotteryTypeID, ln.IssueNo);
                    //派奖开始
                    List<BetRecord> listOrders = s.getOrders(ln.IssueNo, (int)type).ToList();
                    List<BetRecord> listResult_bet = new List<BetRecord>();
                    List<ProfitLossInfo> listResult_prl = new List<ProfitLossInfo>();
                    foreach (BetRecord order in listOrders)
                    {
                        try
                        {
                            BetRecord record = JudgeWin(order, ln);
                            listResult_bet.Add(record);
                        }
                        catch(Exception ex) {
                            Console.WriteLine(ex.Message);
                        }
                    }
                    bool returnBool = s.UpdateOrdersWinInfo(new ObservableCollection<BetRecord>(listResult_bet));//更新中奖信息
                    //派奖结束
                    if (returnBool)
                        s.UpdateLotteryFlag(2, ln.LotteryTypeID, ln.IssueNo);
                    sb.AppendLine(type.ToString() + "==>" + DateTime.Now.ToString() + "," + ln.IssueNo + "期共有" + listResult_bet.Count.ToString() + "个订单");
                    sb.AppendLine(type.ToString() + "==>" + DateTime.Now.ToString() + "," + ln.IssueNo + "期派奖结束");
                    Console.WriteLine(sb.ToString());
                }
                catch (Exception e)
                {
                    s.UpdateLotteryFlag(0, ln.LotteryTypeID, ln.IssueNo);
                }
            }
        }
 /// <summary>
 /// 根据彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩),得到该类彩票玩法
 /// </summary>
 /// <param name="lotteryType">彩票种类</param>
 public PlayMethodManager(LotteryType lotteryType)
 {
     this.MethodTypes.Clear();
     this.CreatePlayMethods(lotteryType);
 }
Exemplo n.º 41
0
 /// 
 /// <param name="pLotteryType"></param>
 /// <param name="pLottery"></param>
 public static List<WinDetail> GetWinResult(LotteryType pLotteryType, ILottery pLottery)
 {
     return null;
 }
Exemplo n.º 42
0
 /// <summary>
 /// 交易类型带参构造
 /// </summary>
 /// <param name="typeCode">交易类型编号</param>
 /// <param name="desc">说明</param>
 public TransactionType(string typeCode, string desc,LotteryType lotteryType)
 {
     this.TypeCode = typeCode;
     this.Description = desc;
     this.LotteryType = lotteryType;
 }
 /// <summary>
 /// 根据彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩),得到该类彩票响应状态集合
 /// </summary>
 /// <param name="lotteryType">彩票种类</param>
 public ResponseStatusManager(LotteryType lotteryType)
 {
     this.Statuses.Clear();
     this.CreateResponseStatus(lotteryType);
 }
Exemplo n.º 44
0
        //切换彩种
        private void buttonGroup_Checked(object sender, RoutedEventArgs e)
        {
            if (MainPage.kaijiang_timer != null && MainPage.kaijiang_timer.IsEnabled == true)
            {
                MainPage.kaijiang_timer.Stop();
                MainPage.kaijiang_timer = null;
            }
            RadioButton rbtn = sender as RadioButton;
            foreach (RadioButton rb in SP_Button_P.Children)
            {
                if (rb != rbtn)
                {
                    rb.IsChecked = false;
                    //rb.IsEnabled = false; // lsyuan 不禁用
                }
            }
            foreach (RadioButton rb in SP_Button_R.Children)
            {
                if (rb != rbtn)
                {
                    rb.IsChecked = false;
                    //rb.IsEnabled = false; // lsyuan 不禁用
                }
            }
            Controls.MainBet MainBet;
            //if (MainPanel.Children.Count != 0 && MainPanel.Children[0] is Controls.MainBet)
            //{
            //    ClearChildren();
            //    MainBet = (Controls.MainBet)MainPanel.Children[0];
            //}
            //else
            //{
            ClearMainPanel();
            MainBet = new MainBet();
            MainPanel.Children.Add(MainBet);
            MainBet.LoadData();
            //}
            mainBet = MainBet;
            dicWs.Clear();
            LotteryTypeInfo ltype = (App.Session[Constant.LOTTERYPLAYTYPE_SESSION] as List<LotteryTypeInfo>).Where(p => p.LotteryTypeID == Convert.ToInt32(rbtn.Tag)).FirstOrDefault();
            if (ltype != null && ltype.IsOpen == 1)
            {
                ShowIsNotOpen();
                return;
            }
            switch ((LotteryType)(Convert.ToInt32(rbtn.Tag)))
            {
                case LotteryType.SSC:
                    lotteryType = LotteryType.SSC;
                    lotteryTypeAll = LotteryType.SSC;
                    MainBet.XuanHaoPanel.Children.Add(new LotteryView.SSC.Positive.ZSSC());
                    break;
                case LotteryType._3D:
                    lotteryType = LotteryType._3D;
                    lotteryTypeAll = LotteryType._3D;
                    MainBet.XuanHaoPanel.Children.Add(new LotteryView._3D.Positive.Z3D());
                    break;
                case LotteryType.SSQ:
                    lotteryType = LotteryType.SSQ;
                    lotteryTypeAll = LotteryType.SSQ;
                    MainBet.XuanHaoPanel.Children.Add(new LotteryView.SSQ.Positive.ZSSQ());
                    break;
                case LotteryType.SSCRX:
                    lotteryType = LotteryType.SSC;
                    lotteryTypeAll = LotteryType.SSCRX;
                    MainBet.XuanHaoPanel.Children.Add(new LotteryView.SSC.RX.SSCRX());
                    break;
                case LotteryType.NSSC:
                    lotteryType = LotteryType.SSC;
                    lotteryTypeAll = LotteryType.NSSC;
                    MainBet.XuanHaoPanel.Children.Add(new LotteryView.SSC.Reverse.NSSC());
                    break;
                case LotteryType.N3D:
                    lotteryType = LotteryType._3D;
                    lotteryTypeAll = LotteryType.N3D;
                    MainBet.XuanHaoPanel.Children.Add(new LotteryView._3D.Reverse.N3D());
                    break;
                case LotteryType.NSSQ:
                    lotteryType = LotteryType.SSQ;
                    lotteryTypeAll = LotteryType.NSSQ;
                    MainBet.XuanHaoPanel.Children.Add(new LotteryView.SSQ.Reverse.NSSQ());
                    break;
                default:
                    ShowIsNotOpen();
                    return;

            }
            LotteryServiceClient srv = WcfProxy.GetProxy;
            srv.GetRecentlyLotteryNumAsync((int)lotteryType);
            srv.GetRecentlyLotteryNumCompleted += (s, er) =>
                {
                    if (er.Result.Count > 0)
                    {
                        MainBet.LotteryNum = er.Result[0].LotteryNums;
                        MainBet.BallSize = Controls.BallSize.Big;
                        MainBet.DataSource = er.Result.ToList();
                        MainBet.CreateElement(er.Result[0].LotteryNums, Controls.BallSize.Big, er.Result.ToList());
                        MainBet.RefreshGrid();
                    }
                };
        }
        /// <summary>
        /// 根据彩票种类(如:上海福彩,重庆福彩,江西福彩,山东体彩),创建彩票响应状态集合
        /// </summary>
        /// <param name="lotteryType">彩票种类</param>
        private void CreateResponseStatus(LotteryType lotteryType)
        {
            this.Statuses.Clear();
            if (lotteryType == LotteryType.ShangHaiWelfareLottery)
            {
                #region 上海福彩响应状态
                ResponseStatus status = new ResponseStatus("0000", "成功,系统处理正常。",lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0010", "消息格式错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0011", "不支持的协议版本,比如设定了message的version属性为0.1。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0012", "messageID格式错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0014", "timestamp时间戳格式错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0015", "消息摘要不匹配。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0016", "不支持该交易类型。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0017", "MessageId重复。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0098", "单个请求超出最大并发数。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0099", "单个请求与上次时间间隔不能小于最小时间间隔。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("0097", "调用委托投注接口的IP地址不是绑定的投注IP地址", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1008", "玩法不存在。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1009", "奖期不存在。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1010", "处理投注过程中出现票投注失败。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1011", "奖期非投注状态。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1012", "请求消息中指定的玩法不存在。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1013", "奖期未截止。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1014", "奖期未完成期结。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1015", "奖期未完成兑奖。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1016", "代理不支持某个特定玩法(恒朋电话投注系统可以管理投注代理商支持的玩法)。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1017", "请求消息中指定的某玩法的奖期不存在。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("1018", "代理商无此奖期销售统计数据。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2001", "用户证件号码格式错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2002", "用户手机号码错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2003", "必须填写用户证件号码。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2004", "必须填写用户手机号码。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2010", "投注号码个数超出允许范围。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2011", "单个号码值超出允许范围(比如双色球投注号码中包含了78)。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2012", "禁止倍投。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2013", "禁止多期投注。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2014", "禁止胆拖投注。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2015", "禁止复式投注。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2016", "禁止组选投注。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2017", "禁止和值投注。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2018", "单票投注金额超出上限。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2030", "倍投的倍数超出范围。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2031", "多期投注的期数超出允许范围。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2032", "单个号码购买注数超出允许范围。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2040", "票金额不相符(比如ticket的money属性值与根据item计算出来的资金不符合)。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2041", "超出返奖截止时间,禁止返奖。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2042", "票流水号格式错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2043", "不支持的投注方式。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2044", "投注号码格式错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2045", "投注代理商的交易请求过于密集(系统可能对投注代理商的交易请求发送频率进行限制)", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2046", "单个投注请求中包含的投注票数超出上限。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2047", "单个票查询请求中包含的投注票数超出上限。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2048", "重复发送的投注票(该投注票已经发送到恒朋电话投注系统了)。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2049", "不存在该票号。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2051", "投注失败。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("2052", "投注中。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3000", "非归集帐户", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3001", "投注代理商已经被冻结。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3002", "投注代理商已经被关闭。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3003", "投注代理商不存在,比如指定的messengerID非法。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3004", "投注代理商已经被暂停。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3005", "投注代理商未开启。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3010", "投注代理商销售金额已经超出上限。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3011", "投注代理商配置信息错误(管理资金账户代理商调用非管理资金账户投注接口)。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3012", "彩民帐户不存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3013", "彩民用户资金账户可用余额不足", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3014", "代理商资金账户不存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3015", "代理商帐户余额不足", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3016", "赠送彩金编号重复", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3017", "单次交易赠送笔数超限", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3018", "赠送彩金编号不存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3100", "发起人已存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3101", "发起人资格无法发起资格或发起人不存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3201", "代理商联合购买方案编号重复", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3202", "方案发起人无权限", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3203", "佣金比例超限", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3204", "佣金比例设置错误", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3205", "投注明细统计结果与总金额或总票数不符", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3206", "联合购买总票数超限", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3207", "代理商无联合购买权限", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3208", "代理联合购买方案不存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3220", "不支持的证件类型", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3221", "缺少用户登录名", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3222", "缺少用户登录密码", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3223", "帐户已经存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3224", "缺少证件类型", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("3225", "邮件格式不正确", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9001", "未找到支付提供商", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9002", "未找到交易类型", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9003", "提交参数不能为空", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9004", "不支持的字符编码", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9005", "支付网关返回错误", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9006", "数字签名错误", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9007", "交易金额不符", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9008", "交易重复处理", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9009", "交易不存在", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9010", "电话投注卡不存在或密码错误。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9011", "电话投注卡卡面余额不相符。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9012", "电话投注卡状态处于非销售状态。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9013", "电话投注卡已过期。", lotteryType);
                this.Statuses.Add(status);

                status = new ResponseStatus("9999", "系统未知异常。", lotteryType);
                this.Statuses.Add(status);
                #endregion
            }
        }
Exemplo n.º 46
0
        private void prepareLottery(LotteryType type)
        {
            textBox2.Text = "";
            int loop = 1;
            if (textBox3.Text != "")
                loop = Convert.ToInt32(textBox3.Text);

            int count = Convert.ToInt32(textBox1.Text);
            TryTimes = loop;

            statistics[type].resetValue();

            while (loop > 0)
            {
                doLottery(count, type);
                loop--;
            }

            displayLotteryStatistics(type);
        }
Exemplo n.º 47
0
        private void doLottery(int count,LotteryType type)
        {
            List<int> lotteryResults = new List<int>();

            switch (type)
            {
                case LotteryType.FreeMoney:
                    {
                        int lotteryTimes = count;
                        while (lotteryTimes > 0)
                        {
                            int id = 0;
                            if (count - lotteryTimes < 35)
                                id = getRandomGeneralID(200, 28, 0);
                            else
                                id = getRandomGeneralID(85, 14, 0);

                            int star = DBConfigMgr.Instance.MapGeneral[id].Star;

                            if ( star == 3)
                                statistics[type].Value1++;

                            if (star == 4)
                                statistics[type].Value2++;

                            lotteryResults.Add(id);
                            lotteryTimes--;
                        }
                        break;
                    }
                case LotteryType.MoneyCost:
                    {
                        int lotteryTimes = count;
                        while (lotteryTimes > 0)
                        {
                            int id = 0;
                            if (count - lotteryTimes < 35)
                                id = getRandomGeneralID(200, 28, 0);
                            else
                                id = getRandomGeneralID(125, 22, 0);

                            int star = DBConfigMgr.Instance.MapGeneral[id].Star;
                            if (star == 3)
                                statistics[type].Value1++;

                            if (star == 4)
                                statistics[type].Value2++;

                            lotteryResults.Add(id);
                            lotteryTimes--;
                        }
                        break;
                    }
                case LotteryType.MoneyTen:
                    {
                        int lotteryTimes = 10 * count;
                        while (lotteryTimes > 0)
                        {
                            int id = 0;
                            if (count - lotteryTimes < 35)
                                id = getRandomGeneralID(200, 28, 0);
                            else
                                id = getRandomGeneralID(125, 22, 0);

                            int star = DBConfigMgr.Instance.MapGeneral[id].Star;
                            if (star == 3)
                                statistics[type].Value1++;

                            if (star == 4)
                                statistics[type].Value2++;

                            lotteryResults.Add(id);
                            lotteryTimes--;
                        }
                        break;
                    }
                case LotteryType.FreeDiamond:
                    {
                        int lotteryTimes = count;
                        while (lotteryTimes > 0)
                        {
                            int id = 0;
                            if (count - lotteryTimes < 10)
                                id = getRandomGeneralID(0, 700, 300);
                            else
                                id = getRandomGeneralID(0, 900, 100);

                            int star = DBConfigMgr.Instance.MapGeneral[id].Star;
                            if (star == 4)
                                statistics[type].Value1++;

                            if (star == 5)
                                statistics[type].Value2++;

                            lotteryResults.Add(id);
                            lotteryTimes--;
                        }
                        break;
                    }

                case LotteryType.DiamondCost:
                    {
                        int lotteryTimes = count;
                        while (lotteryTimes > 0)
                        {
                            int id = 0;
                            if (count - lotteryTimes < 10)
                                id = getRandomGeneralID(0, 700, 300);
                            else
                                id = getRandomGeneralID(0, 850, 150);

                            int star = DBConfigMgr.Instance.MapGeneral[id].Star;
                            if (star == 4)
                                statistics[type].Value1++;

                            if (star == 5)
                                statistics[type].Value2++;

                            lotteryResults.Add(id);
                            lotteryTimes--;
                        }
                        break;
                    }
                case LotteryType.DiamondTen:
                    {
                        int lotteryTimes = 10*count;
                        while (lotteryTimes > 0)
                        {
                            int id = 0;
                            if (count - lotteryTimes < 10)
                                id = getRandomGeneralID(0, 700, 300);
                            else
                                id = getRandomGeneralID(0, 800, 200);

                            int star = DBConfigMgr.Instance.MapGeneral[id].Star;
                            if (star == 4)
                                statistics[type].Value1++;

                            if (star == 5)
                                statistics[type].Value2++;

                            lotteryResults.Add(id);
                            lotteryTimes--;
                        }
                        break;
                    }
                default:
                    break;
            }

            if (checkBox1.Checked)
                displayLotteryResult(type,lotteryResults);
        }
Exemplo n.º 48
0
        private void displayLotteryStatistics(LotteryType type)
        {
            string message = String.Empty;
            switch (type)
            {
                case LotteryType.FreeMoney:
                    {
                        message = string.Format("平均获得3星武将{0} 个, 4星武将{1}个。",
                            statistics[type].Value1/(TryTimes * 1.0f),
                            statistics[type].Value2 / (TryTimes * 1.0f));
                        break;
                    }
                case LotteryType.MoneyCost:
                    {
                        message = string.Format("平均获得3星武将{0} 个, 4星武将{1}个。",
                            statistics[type].Value1 / (TryTimes * 1.0f),
                            statistics[type].Value2 / (TryTimes * 1.0f));
                        break;
                    }
                case LotteryType.FreeDiamond:
                    {
                        message = string.Format("平均获得4星武将{0} 个, 5星武将{1}个。",
                            statistics[type].Value1 / (TryTimes * 1.0f),
                            statistics[type].Value2 / (TryTimes * 1.0f));
                        break;
                    }
                case LotteryType.DiamondCost:
                    {
                        message = string.Format("平均获得4星武将{0} 个, 5星武将{1}个。",
                            statistics[type].Value1 / (TryTimes * 1.0f),
                            statistics[type].Value2 / (TryTimes * 1.0f));
                        break;
                    }
                case LotteryType.DiamondTen:
                    {
                        message = string.Format("平均获得4星武将{0} 个, 5星武将{1}个。",
                            statistics[type].Value1 / (TryTimes  * 1.0f),
                            statistics[type].Value2 / (TryTimes  * 1.0f));
                        break;
                    }
                default: break;
            }

            textBox2.Text += message + Environment.NewLine;
        }
Exemplo n.º 49
0
        private void displayLotteryResult(LotteryType type,List<int> results)
        {
            dataGridView1.Rows.Clear();

            Dictionary<int,int> starCount = new Dictionary<int,int>();
            starCount.Add(2,0);
            starCount.Add(3,0);
            starCount.Add(4,0);
            starCount.Add(5,0);

            foreach(int i in results)
            {
                addRow(i);

                starCount[DBConfigMgr.Instance.MapGeneral[i].Star] += 1;
            }

            int totalLotteryCount = results.Count();
            String message = String.Empty;
            switch (type)
            {
                case LotteryType.FreeMoney:
                    {
                        message = String.Format("免费金币抽取{0}次,需要{1}天; 三星武将共{2}个", totalLotteryCount, totalLotteryCount / 5,starCount[3]);

                        break;
                    }
                case LotteryType.FreeDiamond:
                    {
                        message = String.Format("免费钻石抽取{0}次,需要{1}天。三星武将共{2}个,四星武将共{3}个。", totalLotteryCount, totalLotteryCount * 2,starCount[3],starCount[4]);
                        break;
                    }
                case LotteryType.MoneyCost:
                    {
                        message = String.Format("金币抽取{0}次,花费金币共{1}。", totalLotteryCount, totalLotteryCount * 1000);
                        break;
                    }
                case LotteryType.DiamondCost:
                    {
                        message = String.Format("钻石抽取{0}次,花费钻石共{1}。", totalLotteryCount, totalLotteryCount * 150);
                        break;
                    }
                case LotteryType.MoneyTen:
                    {
                        message = String.Format("金币10连抽{0}次,花费金币共{1}。", totalLotteryCount, totalLotteryCount / 10 * 9000);
                        break;
                    }
                case LotteryType.DiamondTen:
                    {
                        message = String.Format("钻石10连抽{0}次,花费钻石共{1}。", totalLotteryCount, totalLotteryCount / 10 * 1350);
                        break;
                    }
                default: break;
            }

            textBox2.Text += message + Environment.NewLine;
        }