Example #1
0
        private int Chapter(Novel novelInfo)
        {
            int result = (int)ErrorMessage.失败;

            if (!novelInfo.IsNullOrEmpty <Novel>() && novelInfo.Id > 0 &&
                (novelInfo.FeeType == (int)Constants.Novel.FeeType.chapter || novelInfo.FeeType == (int)Constants.Novel.FeeType.novelchapter))
            {
                Chapter chapter = _chapterService.GetChapter(NovelId, ChapterCode, ChapterDirection, out ChapterCode);
                if (!chapter.IsNullOrEmpty <Chapter>() && chapter.Id > 0)
                {
                    ChapterOrderInfo model = new ChapterOrderInfo();
                    model             = GetLogInfo(model) as ChapterOrderInfo;
                    model.NovelId     = NovelId;
                    model.ChapterCode = ChapterCode;
                    model.UserName    = currentUser.UserName;
                    model.WordSize    = chapter.WordSize;

                    // 千字价格
                    int chapterWordSizeFee = novelInfo.ChapterWordSizeFee;
                    chapterWordSizeFee = chapterWordSizeFee > 0 ? chapterWordSizeFee : SiteSection.Novel.ChapterWordSizeFee;
                    int fee = GetFee(chapter.WordSize, chapterWordSizeFee);
                    model.FeeType   = 0;
                    model.Fee       = fee;
                    model.Cash      = fee;
                    model.Status    = (int)Constants.Status.yes;
                    model.OrderTime = DateTime.Now;
                    result          = _orderService.OrderChapter(model);
                }
            }

            return(result);
        }
Example #2
0
        /// <summary>
        /// 按章订购
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int OrderChapter(ChapterOrderInfo model)
        {
            if (model == null)
            {
                return(0);
            }

            using (var conn = DbConnection(DbOperation.Write))
            {
                var repo = new Repository.OrderRepo(conn);
                return(repo.OrderChapter(model));
            }
        }
Example #3
0
        /// <summary>
        /// 是否按本订购
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int IsOrderNovel(ChapterOrderInfo model)
        {
            if (model == null)
            {
                return(0);
            }

            using (var conn = DbConnection(DbOperation.Read))
            {
                var repo = new Repository.OrderRepo(conn);
                return(repo.IsOrderNovel(model));
            }
        }
Example #4
0
        private int OrderChapter(ChapterOrderInfo model, int clientType)
        {
            string spName = "Users.Chapter_Order";

            var p = new DynamicParameters();

            p.Add("@NovelId", model.NovelId);
            p.Add("@NovelName", model.NovelName);
            p.Add("@Fee", model.Fee);
            p.Add("@ChapterId", model.ChapterId);
            p.Add("@ChapterName", model.ChapterName);
            p.Add("@OrderTime", model.OrderTime);
            p.Add("@Status", model.Status);
            p.Add("@PayChannel", model.PayChannel);
            p.Add("@OrderCode", model.OrderCode);
            p.Add("@ChapterCode", model.ChapterCode);
            p.Add("@AutoBuy", model.AutoBuy);
            p.Add("@Rebate", model.Rebate);
            p.Add("@RebateFee", model.RebateFee);
            p.Add("@Balance", model.Balance);
            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("@BindFee", model.BindFee);
            p.Add("@Cash", model.Cash);
            p.Add("@Integral", model.Integral);
            p.Add("@RebateExpression", model.RebateExpression);
            p.Add("@FeeId", model.FeeId);
            p.Add("@WordSize", model.WordSize);
            p.Add("@FeeType", model.FeeType);
            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>
        /// <param name="service"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        protected bool IsOrder(IOrderService service, string userName = "")
        {
            userName = string.IsNullOrEmpty(userName) ? currentUser.UserName : userName;
            if (string.IsNullOrEmpty(userName) || NovelId <= 0)
            {
                return(false);
            }

            ChapterOrderInfo model = new ChapterOrderInfo();

            model.UserName = userName;
            model.NovelId  = NovelId;

            return(service.IsOrderNovel(model) == (int)ErrorMessage.成功);
        }
        /// <summary>
        /// 章节是否可读
        /// </summary>
        /// <param name="service"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        protected bool IsRead(IOrderService service, string userName = "")
        {
            if (NovelId <= 0 || ChapterCode < 0)
            {
                return(false);
            }

            ChapterOrderInfo model = new ChapterOrderInfo();

            model.UserName    = string.IsNullOrEmpty(userName) ? currentUser.UserName : userName;
            model.NovelId     = NovelId;
            model.ChapterCode = ChapterCode;

            return(service.IsReadChapter(model) == (int)ErrorMessage.成功);
        }
Example #7
0
        /// <summary>
        /// 是否订购全本
        /// </summary>
        /// <param name="func"></param>
        /// <param name="userName"></param>
        /// <param name="curNovelId"></param>
        /// <returns></returns>
        protected bool IsOrder(Func <ChapterOrderInfo, int> func, string userName, int curNovelId = 0)
        {
            curNovelId = (curNovelId > 0 ? curNovelId : NovelId);

            if (func == null || string.IsNullOrEmpty(userName) || NovelId <= 0)
            {
                return(false);
            }

            ChapterOrderInfo model = new ChapterOrderInfo();

            model.UserName = userName;
            model.NovelId  = curNovelId;

            return(func(model) == (int)ErrorMessage.成功);
        }
Example #8
0
        /// <summary>
        /// 章节是否可读
        /// </summary>
        /// <param name="func"></param>
        /// <param name="userName"></param>
        /// <param name="curNovelId"></param>
        /// <returns></returns>
        public bool IsRead(Func <ChapterOrderInfo, int> func, string userName, int curNovelId = 0)
        {
            curNovelId = (curNovelId > 0 ? curNovelId : NovelId);

            if (func == null || curNovelId <= 0 || ChapterCode < 0)
            {
                return(false);
            }

            ChapterOrderInfo model = new ChapterOrderInfo();

            model.UserName    = userName;
            model.NovelId     = curNovelId;
            model.ChapterCode = CurChapterCode;

            return(func(model) == (int)ErrorMessage.成功);
        }
Example #9
0
        private int IsOrder(ChapterOrderInfo model, int funcType, int clientType)
        {
            string spName = "Users.Novel_IsRead";

            var p = new DynamicParameters();

            p.Add("@FuncType", funcType);
            p.Add("@UserId", model.UserId);
            p.Add("@UserName", model.UserName);
            p.Add("@NovelId", model.NovelId);
            p.Add("@ChapterCode", model.ChapterCode);
            p.Add("@ClientId", model.ClientId);
            p.Add("@ClientType", clientType);
            p.Add("@ROut", dbType: DbType.Int32, direction: ParameterDirection.Output);

            DbManage.Execute(spName, p, CommandType.StoredProcedure);

            return(p.Get <int>("@ROut"));
        }
Example #10
0
 /// <summary>
 /// 按章订购
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int OrderChapter(ChapterOrderInfo model)
 {
     return(OrderChapter(model, 0));
 }
Example #11
0
 /// <summary>
 /// 是否按本订购
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int IsOrderNovel(ChapterOrderInfo model)
 {
     return(IsOrder(model, 2, 0));
 }
Example #12
0
 /// <summary>
 /// 是否按本或按章订购
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int IsReadChapter(ChapterOrderInfo model)
 {
     return(IsOrder(model, 3, 0));
 }