public ActionResult AllAudioPackage() { string url = ""; ErrorMessage errorMessage = ErrorMessage.失败; PackageOrderInfo model = new PackageOrderInfo(); model = GetLogInfo(model) as PackageOrderInfo; model.UserName = currentUser.UserName; model.Fee = SiteSection.Audio.AllPackageFee; model.Cash = SiteSection.Audio.AllPackageFee; model.Status = (int)Constants.Status.yes; model.OrderTime = DateTime.Now; model.AutoRenew = 0; model.Balance = 0; model.BeginTime = DateTime.Now; model.EndTime = DateTime.Now; model.FeeId = 0; model.Integral = 0; model.OrderCode = ""; model.OrderContentType = 2; model.PackageId = 0; model.PackageTitle = ""; model.PayChannel = 0; model.Rebate = 0; model.RebateExpression = ""; model.RebateFee = 0; model.CancelTime = DateTime.Now; int result = _orderService.OrderPackage(model); if (EnumHelper.TryParsebyValue <ErrorMessage>(result, out errorMessage)) { switch (errorMessage) { case ErrorMessage.成功: url = NovelId > 0 ? ChapterContext.GetUrl("/chapter/detail", NovelId, ChapterCode, channelId: RouteChannelId) : "/"; break; case ErrorMessage.余额不足: url = StringHelper.GetReturnUrl("/order/recharge", UrlParameterHelper.GetParams("returnUrl"), channelId: RouteChannelId); break; case ErrorMessage.已包月: url = ChapterContext.GetUrl("/chapter/detail", NovelId, ChapterCode, channelId: RouteChannelId); break; case ErrorMessage.用户不存在: url = DataContext.GetErrorUrl(ErrorMessage.用户不存在, channelId: RouteChannelId); break; } } return(Redirect(url)); }
/// <summary> /// 包月订购 /// </summary> /// <param name="model"></param> /// <returns></returns> public int OrderPackage(PackageOrderInfo model) { if (model == null) { return(0); } using (var conn = DbConnection(DbOperation.Write)) { var repo = new Repository.OrderRepo(conn); return(repo.OrderPackage(model)); } }
private int OrderPackage(PackageOrderInfo model, int clientType) { string spName = "Users.Package_Order"; var p = new DynamicParameters(); p.Add("@PackageId", model.PackageId); p.Add("@PackageTitle", model.PackageTitle); p.Add("@Fee", model.Fee); p.Add("@OrderTime", model.OrderTime); p.Add("@Status", model.Status); p.Add("@PayChannel", model.PayChannel); p.Add("@OrderCode", model.OrderCode); p.Add("@Rebate", model.Rebate); p.Add("@RebateFee", model.RebateFee); p.Add("@FeeId", model.FeeId); p.Add("@Balance", model.Balance); p.Add("@BindFee", model.BindFee); p.Add("@Cash", model.Cash); p.Add("@Integral", model.Integral); p.Add("@RebateExpression", model.RebateExpression); p.Add("@UserId", model.UserId); p.Add("@UserName", model.UserName); p.Add("@ClientId", model.ClientId); p.Add("@Version", model.Version); p.Add("@UserAgent", model.UserAgent); p.Add("@IMEI", model.IMEI); p.Add("@IMSI", model.IMSI); p.Add("@ChannelId", model.ChannelId); p.Add("@SourceType", model.SourceType); p.Add("@Mobile", model.Mobile); p.Add("@NetType", model.NetType); p.Add("@Province", model.Province); p.Add("@City", model.City); p.Add("@ReferUrl", model.ReferUrl); p.Add("@IPAddress", model.IPAddress); p.Add("@RemoteHost", model.RemoteHost); p.Add("@BeginTime", model.BeginTime); p.Add("@EndTime", model.EndTime); p.Add("@CancelTime", model.CancelTime); p.Add("@AutoRenew", model.AutoRenew); p.Add("@OrderContentType", model.OrderContentType); p.Add("@ClientType", clientType); p.Add("@ROut", dbType: DbType.Int32, direction: ParameterDirection.Output); DbManage.Execute(spName, p, CommandType.StoredProcedure); return(p.Get <int>("@ROut")); }
/// <summary> /// 听书包月页 /// </summary> /// <returns></returns> public ActionResult AllPackage() { IEnumerable <RecommendView> recList = GetRecList(RecSection.BookIndex.ListenRec, 10); //获取包月信息 string where = string.Format("and status = {0} AND PackageId = 0 AND OrderContentType & 2 = 2 AND begintime <= getdate() AND endtime >= getdate() AND UserId = {1}", (int)Constants.Status.yes, currentUser.UserId); PackageOrderInfo packageOrderInfo = _orderService.GetPackageOrder(where); AudioView audioView = new AudioView() { HotRecList = new SimpleResponse <IEnumerable <RecommendView> >(!recList.IsNullOrEmpty(), recList), UserBalance = GetUserBalance(), AllAudioFee = SiteSection.Audio.AllPackageFee, IsPackageOrder = !packageOrderInfo.IsNullOrEmpty() && packageOrderInfo.Id > 0 }; return(View("/views/audio/allpackage.cshtml", audioView)); }
/// <summary> /// 包月订购 /// </summary> /// <param name="model"></param> /// <returns></returns> public int OrderPackage(PackageOrderInfo model) { return(OrderPackage(model, 0)); }