Beispiel #1
0
        protected void btnLadderPrize_Click(object sender, EventArgs e)
        {
            try
            {
                var zone      = AdminMgr.GetSelectZoneId(HttpContext.Current, ddlZone);
                var curSeason = ConvertHelper.ConvertToInt(txtLadderSeason.Text);
                if (curSeason <= 0)
                {
                    ShowMessage("天梯赛季不能小于1");
                    return;
                }
                ShowMessage("天梯发奖开始...");
                var managers = LadderManagerhistoryMgr.GetPrizeManager(curSeason, zone);
                if (managers != null)
                {
                    List <MailBuilder> mails = new List <MailBuilder>(managers.Count);
                    foreach (var manager in managers)
                    {
                        LadderThread.Instance.SendPrize(manager, 0, ref mails);
                    }

                    var mailDataTable = MailCore.BuildMailBulkTable(mails);
                    LadderSqlHelper.SaveManagerPrize(managers, mailDataTable, zone);
                }
                ShowMessage("天梯发奖成功。");
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex);
                ShowMessage("local exception:" + ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 合区所需的提前发放天梯赛奖励
        /// </summary>
        /// <returns></returns>
        public MessageCode ScoreToHonorJobMergeZone()
        {
            var season = CacheFactory.SeasonCache.GetCurrentSeason();

            if (season == null)
            {
                return(MessageCode.LadderNoSeason);
            }

            var curDate = DateTime.Today;

            if (season.Idx == 1 && curDate == season.Startdate)
            {
                return(MessageCode.LadderSeasonDonotNeedSend);
            }
            int isNewSeason = 1;
            int curSeason   = season.Idx;

            if (season.Startdate == curDate && season.Idx > 1)
            {
                isNewSeason = 1;
                curSeason   = curSeason - 1;
            }
            LadderInfoMgr.ScoreToHonorMergeZone(DateTime.Today, curSeason);
            if (isNewSeason == 1)
            {
                try
                {
                    var curSeasonEntity = CacheFactory.SeasonCache.GetEntity(curSeason);
                    var managers        = LadderManagerhistoryMgr.GetPrizeManager(curSeason);
                    if (managers != null)
                    {
                        List <MailBuilder> mails = new List <MailBuilder>(managers.Count);
                        foreach (var manager in managers)
                        {
                            SendPrize(manager, curSeasonEntity.Status, ref mails);
                            if (manager.Rank < 3)
                            {
                                NbManagerhonorMgr.Add(manager.ManagerId, (int)EnumMatchType.Ladder, 0, manager.Season,
                                                      manager.Rank);
                            }
                        }

                        var mailDataTable = MailCore.BuildMailBulkTable(mails);
                        LadderSqlHelper.SaveManagerPrize(managers, mailDataTable);
                    }
                }
                catch (Exception ex)
                {
                    SystemlogMgr.Error("ScoreToHonorJob SendPrize", ex);
                    return(MessageCode.Exception);
                }
            }
            return(MessageCode.Success);
        }