public MessageCode Charge(string account, int sourceType, decimal cash, int point, int bonus, string orderId, string eqid) //用户名, 充值类型, 现金 , 点券, 赠送点券, 订单号, 装备id { try { if (point <= 0 && bonus <= 0) { return(MessageCode.NbParameterError); } if (point > 0 && cash <= 0) { return(MessageCode.NbParameterError); } if (string.IsNullOrEmpty(orderId)) { return(MessageCode.NbParameterError); } int result = 0; int chargePoint = point; if (sourceType == (int)EnumChargeSourceType.GmCharge) { chargePoint = bonus; } ItemPackageFrame package = null; //登记装备 if (!eqid.IsNullOrWhiteSpace()) { var manager = ManagerCore.Instance.GetManager(account); package = ItemCore.Instance.GetPackage(manager.Idx, EnumTransactionType.Charge); if (package == null) { return(MessageCode.NbNoPackage); } package.AddItem(int.Parse(eqid), false, false); } using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault())) { transactionManager.BeginTransaction(); //var messageCode = Tran_SaveLottery(transactionManager.TransactionObject, matchId, managerId, package, mail, lotteryRepeatCode); var messageCode = SaveCharge(package, account, sourceType, orderId, point, chargePoint, cash, bonus, transactionManager.TransactionObject, eqid); if (messageCode == ShareUtil.SuccessCode) { transactionManager.Commit(); if (point > 0) { doChargeAfter(account, point); } if (sourceType == (int)EnumChargeSourceType.GmCharge) { GmVip(account, bonus, PayContinuePoint, DateTime.Now); } } else { transactionManager.Rollback(); } } } catch (Exception ex) { SystemlogMgr.Error("Charge", ex); return(MessageCode.Exception); } if (point > 0) { doChargeAfter(account, point); } if (sourceType == (int)EnumChargeSourceType.GmCharge) { GmVip(account, bonus, PayContinuePoint, DateTime.Now); } return(MessageCode.Success); }