コード例 #1
0
        public CommunicationObject AddNotify(string xml)
        {
            try
            {
                CommunicationObject notifyInfo   = XmlAnalyzer.AnalyseXmlToCommunicationObject <CommunicationObject>(xml);
                NoticeEntity        noticeEntity = new NoticeEntity();
                noticeEntity.NoticeId      = notifyInfo.Id;
                noticeEntity.NoticeVersion = notifyInfo.Version;
                noticeEntity.MessengerId   = notifyInfo.MessengerId;
                noticeEntity.Timestamp     = notifyInfo.Timestamp;
                noticeEntity.TranType      = (int)notifyInfo.TransactionType;
                noticeEntity.Digest        = notifyInfo.Digest;
                noticeEntity.ResponseText  = xml;
                noticeEntity.NotifyTime    = DateTime.Now;
                noticeEntity.XmlHeader     = notifyInfo.XmlHeader;
                NoticeManager noticeManager = new NoticeManager(DbAccess);
                noticeManager.AddNotice(noticeEntity);

                return(notifyInfo);
            }
            catch (Exception ex)
            {
                string errMsg = "添加通知XML到数据库失败!" + xml;
                throw HandleException(LogCategory.Notice, errMsg, ex);
            }
        }
コード例 #2
0
        public IssueNoticeInfo AddIssuseNotify(string xml)
        {
            IssueNoticeInfo info = XmlAnalyzer.AnalyseXmlToCommunicationObject <IssueNoticeInfo>(xml);

            try
            {
                IssueEntity issueEntity = new IssueEntity();
                issueEntity.GameName     = info.GameName;
                issueEntity.IssuseNumber = info.Number;
                issueEntity.StartTime    = info.StartTime;
                issueEntity.StopTime     = info.StopTime;
                issueEntity.Status       = (int)info.Status;
                issueEntity.BonusCode    = info.BonusCode;
                issueEntity.SalesMoney   = info.SalesMoney;
                issueEntity.BonusMoney   = info.BonusMoney;
                issueEntity.NoticeId     = info.Id;
                IssuseManager issuseManager = new IssuseManager(DbAccess);
                issuseManager.SaveIssue(issueEntity);

                if (info.Status == IssueStatus.Started)
                {
                    TicketFacade ticketFacade = new TicketFacade();
                    ticketFacade.AutoBuyChaseTicket(issueEntity.GameName, issueEntity.IssuseNumber);
                }
                //Thread thread = new Thread(AutoChaseTicket);
                //thread.Start(issueEntity);

                return(info);
            }
            catch (Exception ex)
            {
                string errMsg = "添加奖期通知失败!" + xml;
                throw HandleException(LogCategory.Notice, errMsg, ex);
            }
        }
コード例 #3
0
        public BonusNoticeInfo AddBonusNotify(string xml)
        {
            BonusNoticeInfo info = XmlAnalyzer.AnalyseXmlToCommunicationObject <BonusNoticeInfo>(xml);

            try
            {
                BonusEntity bonusEntity = new BonusEntity();
                bonusEntity.GameName      = info._Body._BonusInfo._Issue.GameName;
                bonusEntity.IssuseNumber  = info._Body._BonusInfo._Issue.Number;
                bonusEntity.BonusNumber   = info._Body._BonusInfo.BonusNumber;
                bonusEntity.TotalItems    = info._Body._BonusInfo.TotalItems;
                bonusEntity.TotalMoney    = info._Body._BonusInfo.TotalMoney;
                bonusEntity.NoticeId      = info.Id;
                bonusEntity.IsDistributed = false;
                using (ILHDBTran tran = BeginTran())
                {
                    BonusManager bonusManager = new BonusManager(tran);
                    bonusManager.AddBonus(bonusEntity);
                    List <BonusDetailEntity> bonusDetailList = new List <BonusDetailEntity>();
                    foreach (BonusMappingInfo.BonusItem bonusItem in info._Body._BonusInfo._BonusItemList)
                    {
                        BonusDetailEntity detail = new BonusDetailEntity();
                        detail.TicketId     = bonusItem.TicketId;
                        detail.BonusLevel   = bonusItem.BonusLevel;
                        detail.PlayType     = (int)bonusItem.PlayType;
                        detail.Money        = bonusItem.Money;
                        detail.IsBombBonus  = bonusItem.IsBombBonus;
                        detail.Size         = bonusItem.Size;
                        detail.GameName     = bonusEntity.GameName;
                        detail.IssuseNumber = bonusEntity.IssuseNumber;
                        bonusManager.AddBonusDetail(detail);
                    }
                    tran.Commit();
                }
                return(info);
            }
            catch (Exception ex)
            {
                string errMsg = "添加返奖通知失败!" + xml;
                throw HandleException(LogCategory.Notice, errMsg, ex);
            }
        }