Esempio n. 1
0
        /// <summary>
        /// vip会员费
        /// </summary>
        /// <returns></returns>
        //public ActionResult VipOrder()
        //{
        //    UserViewModel model = new UserViewModel { UserEntity = UserInfo ?? new User() };
        //    UserService service = new UserService();
        //    try
        //    {
        //        model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
        //        if (model.VipInfo != null)
        //        {
        //            if (!model.VipInfo.State.HasValue || model.VipInfo.State.Value == (int)VipState.Normal || model.VipInfo.State.Value == (int)VipState.Invalid)
        //            {
        //                return Redirect(GetUrl("/Wechat/user/Identify"));
        //            }
        //            else if (model.VipInfo.State.Value == (int)VipState.VIP)
        //            {
        //                return Redirect(GetUrl("/Wechat/user/VipInfo"));
        //            }
        //        }
        //    }
        //    catch (Exception e)
        //    {
        //        LogService.Log("VipOrder 出错了!", e.ToString());
        //    }
        //    return View(model);
        //}
        //[HttpPost]
        //public ActionResult VipOrder(string vipDuration)
        //{
        //    string result = "生成VIP会员充值订单失败";
        //    if (UserInfo != null)
        //    {
        //        UserService userService = new UserService();
        //        try
        //        {
        //            if (UserInfo != null)
        //            {
        //                int duration = -1;
        //                decimal totalAmount = 0;
        //                int.TryParse(vipDuration, out duration);
        //                if (duration < 1 || duration > 5)
        //                {
        //                    throw new ArgumentException("充值VIP时间不正确,请重新选择");
        //                }
        //                totalAmount = 100 * duration;
        //                UserVip vipInfo = userService.GetUserVipInfoByUserId(UserInfo.UserId);
        //                if (vipInfo != null)
        //                {
        //                    if (vipInfo.State == (int)VipState.Normal || vipInfo.State == (int)VipState.Invalid)
        //                    {
        //                        throw new ArgumentException("认证资料还没有通过审核,请先上传认证资料");
        //                    }
        //                    TradeOrder order = null;
        //                    string url = GetUrl("/Wechat/user/VipInfo");
        //                    if (!string.IsNullOrEmpty(vipInfo.OrderId))
        //                    {
        //                        order = orderService.GetOrderByOrderId(vipInfo.OrderId);
        //                    }
        //                    if (order != null && order.UserName == UserInfo.UserName && order.Amount == totalAmount)
        //                    {
        //                        result = string.Format(Constant.PostPayInfoFormatForMobile, order.OrderId, url);
        //                    }
        //                    else
        //                    {
        //                        // 删掉原来的订单
        //                        if (order != null)
        //                        {
        //                            orderService.DeleteOrderById(order.OrderId);
        //                        }
        //                        string orderId = orderService.GenerateNewOrderNumber();
        //                        string subject = "活动在线网 | 用户VIP会员充值";
        //                        string body = "用户" + UserInfo.UserName + "充值VIP会员" + duration + "年";
        //                        int userId = UserInfo.UserId;
        //                        string username = UserInfo.UserName;
        //                        decimal amount = totalAmount;
        //                        int state = (int)OrderState.New;
        //                        string resourceUrl = url;
        //                        bool success = orderService.AddNewOrder(orderId, subject, body, amount, state, username, resourceUrl, (int)OrderType.ToVip, userId) &&
        //                            userService.UpdateUserVipInfo(vipInfo.Id, orderId, vipInfo.IdentifyImg, vipInfo.StartTime, vipInfo.EndTime, duration, totalAmount, VipState.Identified);
        //                        if (success)
        //                        {
        //                            result = string.Format(Constant.PostPayInfoFormatForMobile, orderId, url);
        //                        }
        //                        else
        //                        {
        //                            result = "生成VIP充值支付订单信息失败,请重新尝试";
        //                        }
        //                    }
        //                }
        //            }
        //        }
        //        catch (ArgumentException e)
        //        {
        //            result = e.Message;
        //        }
        //        catch (Exception e)
        //        {
        //            LogService.Log("生成VIP充值支付订单信息", e.ToString());
        //            result = "生成VIP充值支付订单信息,请重新尝试";
        //        }
        //    }
        //    else
        //    {
        //        result = "您还未登录或登录超时,请重新登录";
        //    }
        //    return Content(result);
        //}
        //public ActionResult VipInfo()
        //{
        //    UserViewModel model = new UserViewModel { UserEntity = UserInfo ?? new User() };
        //    UserService service = new UserService();
        //    try
        //    {
        //        model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
        //        if (model.VipInfo != null)
        //        {
        //            if (!model.VipInfo.State.HasValue || model.VipInfo.State.Value != (int)VipState.VIP)
        //            {
        //                return Redirect(GetUrl("/Wechat/user/ToVip"));
        //            }
        //            else
        //            {
        //                if (model.VipInfo.EndTime > DateTime.Now)
        //                {
        //                    model.ErrorMsg = "您的VIP已过期,请重新申请";
        //                    //service.SetUserToVip(
        //                }
        //            }
        //        }
        //    }
        //    catch (Exception e)
        //    {
        //        LogService.Log("VipInfo 出错了!", e.ToString());
        //    }
        //    return View(model);
        //}
        private string GetErrorMessage(UserVip vipInfo)
        {
            string errorMsg = string.Empty;

            if (vipInfo != null)
            {

                if (!string.IsNullOrEmpty(vipInfo.IdentifyImg))
                {
                    if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.Normal)
                    {
                        errorMsg = "认证资料已上传,管理员正在审核中";
                    }
                    else if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.Invalid)
                    {
                        errorMsg = "认证资料审核未通过,请重新上传";
                    }
                    else if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.Identified)
                    {
                        errorMsg = "认证资料已通过审核,您现在是认证会员。还可访问电脑版(www.huodongzaixian.com)升级为VIP会员,享受更多会员特权!";
                    }
                    else if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.VIP)
                    {
                        errorMsg = "认证资料已通过审核,您是VIP会员";
                    }
                    else
                    {
                        errorMsg = "数据错误,请联系网站管理员";
                    }
                }
            }

            return errorMsg;
        }
Esempio n. 2
0
 private UserVip ConvertToUserVipObject(SqlDataReader reader)
 {
     UserVip vipInfo = new UserVip
     {
         Amount = reader["Amount"].DBToDecimal(0),
         CreatedTime = reader["CreatedTime"].DBToDateTime(DateTime.Now),
         Duration = reader["Duration"].DBToInt32(0),
         EndTime = reader["EndTime"].DBToDateTime(),
         Id = reader["Id"].DBToInt32(0),
         IdentifyImg = reader["IdentifyImg"].DBToString(string.Empty),
         LastUpdatedTime = reader["LastUpdatedTime"].DBToDateTime(DateTime.MinValue),
         OrderId = reader["OrderId"].DBToString(string.Empty),
         StartTime = reader["StartTime"].DBToDateTime(DateTime.MinValue),
         State = reader["State"].DBToInt32(0),
         UserId = reader["UserId"].DBToInt32(0)
     };
     return vipInfo;
 }
Esempio n. 3
0
        private string GetErrorMessage(UserVip vipInfo)
        {
            string errorMsg = string.Empty;

            if (vipInfo != null)
            {

                if (!string.IsNullOrEmpty(vipInfo.IdentifyImg))
                {
                    if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.Normal)
                    {
                        errorMsg = "认证资料已上传,管理员正在审核中";
                    }
                    else if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.Invalid)
                    {
                        errorMsg = "认证资料审核未通过,请重新上传";
                    }
                    else if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.Identified)
                    {
                        errorMsg = "认证资料已通过审核,您现在是认证会员,还可以升级为VIP会员。&nbsp;<a href='/m/user/tovip' title='立即升级'>立即升级</a>";
                    }
                    else if (vipInfo.State.Value == (int)Witbird.SHTS.Model.VipState.VIP)
                    {
                        errorMsg = "认证资料已通过审核,您是VIP会员";
                    }
                    else
                    {
                        errorMsg = "数据错误,请联系网站管理员";
                    }
                }
            }

            return errorMsg;
        }
Esempio n. 4
0
        /// <summary>
        /// Updates user vip info
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="vipInfo"></param>
        /// <returns></returns>
        public bool UpdateUserVipInfo(SqlConnection conn, UserVip vipInfo)
        {
            SqlParameter[] sqlParameters = new SqlParameter[]
            {
               new SqlParameter("@Id", vipInfo.Id),
               new SqlParameter("@OrderId", vipInfo.OrderId?? string.Empty),
               new SqlParameter("@IdentifyImg", vipInfo.IdentifyImg?? string.Empty),
               new SqlParameter("@StartTime", vipInfo.StartTime?? DateTime.Now),
               new SqlParameter("@EndTime", vipInfo.EndTime?? DateTime.Now),
               new SqlParameter("@Duration", vipInfo.Duration??0),
               new SqlParameter("@Amount", vipInfo.Amount??0),
               new SqlParameter("@State", vipInfo.State??0),
               new SqlParameter("@LastUpdatedTime", vipInfo.LastUpdatedTime?? DateTime.Now)
            };

            return DBHelper.RunNonQueryProcedure(conn,
                SP_UpdateUserVipInfoByUserId, sqlParameters) > 0;
        }
Esempio n. 5
0
        /// <summary>
        /// Updates user vip bank info
        /// </summary>
        /// <param name="vipInfoId"></param>
        /// <param name="orderId"></param>
        /// <param name="identifyImg"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="duration"></param>
        /// <param name="amount"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public bool UpdateUserVipInfo(int vipInfoId, string orderId, string identifyImg,
            DateTime? startTime, DateTime? endTime, int? duration, decimal? amount, VipState? state)
        {
            var conn = DBHelper.GetSqlConnection();
            bool result = false;

            try
            {
                conn.Open();
                UserVip vipInfo = new UserVip
                {
                    Id = vipInfoId,
                    OrderId = orderId,
                    IdentifyImg = identifyImg,
                    StartTime = startTime,
                    EndTime = endTime,
                    Duration = duration,
                    Amount = amount,
                    State = (int)state,
                    LastUpdatedTime = DateTime.Now
                };

                result = userDao.UpdateUserVipInfo(conn, vipInfo);
            }
            catch (Exception e)
            {
                LogService.Log("更新用户VIP信息失败--" + e.Message, e.ToString());
            }
            finally
            {
                conn.Close();
            }

            return result;
        }