/// <summary> /// 刷新每日分享次数 /// </summary> /// <param name="record"></param> /// <returns></returns> private MessageCode RefreshRecord(ShareManagerEntity record, ConfigShareEntity config) { if (!config.IsRepetition) { return(MessageCode.Success); } record.ShareNumber = 0; record.UpdateTime = DateTime.Now; if (ShareManagerMgr.Update(record)) { return(MessageCode.Success); } return(MessageCode.NbUpdateFail); }
/// <summary> /// 分享游戏奖励(发放奖励) /// </summary> /// <param name="record"></param> /// <param name="mail"></param> /// <returns></returns> private MessageCode SavePrize(ShareManagerEntity record, MailBuilder mail) { using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault())) { transactionManager.BeginTransaction(); var messageCode = MessageCode.NbUpdateFail; do { if (record.Idx == 0) { if (!ShareManagerMgr.Insert(record, transactionManager.TransactionObject)) { break; } } else { if (!ShareManagerMgr.Update(record, transactionManager.TransactionObject)) { break; } } if (!mail.Save(transactionManager.TransactionObject)) { break; } messageCode = MessageCode.Success; } while (false); if (messageCode == MessageCode.Success) { transactionManager.Commit(); } else { transactionManager.Rollback(); } } return(MessageCode.Success); }