Ejemplo n.º 1
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            if (CurrentUser.id == 0)
            {
                Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
            }
            LoadTheme(themecode, siteid, languagecode, pcode);
            path     = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_UserPointToMoney", "") + "\"><span>" + Tag("积分转换") + "</span></a>";
            key      = Rstring("key");
            dateFrom = Rstring("dateFrom");
            dateTo   = Rstring("dateTo");
            where    = "User_id=" + CurrentUser.id + "";
            if (key != "")
            {
                where += " and (Remark like lbsql{'%" + key + "%'})";
            }
            if (dateFrom != "" && dateTo != "")
            {
                where += " and (datediff(d,Time_Add,'" + dateFrom + "')<=0 and datediff(d,Time_Add,'" + dateTo + "')>=0)";
            }
            user_points = B_Lebi_User_Point.GetList(where, "id desc", PageSize, pageindex);
            int recordCount = B_Lebi_User_Point.Counts(where);

            PageString = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&key=" + key + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo + "", pageindex, PageSize, recordCount, CurrentLanguage);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新会员积分
        /// </summary>
        /// <param name="user"></param>
        public static void UpdateUserPoint(Lebi_User user)
        {
            string  point = B_Lebi_User_Point.GetValue("sum(Point)", "User_id=" + user.id + " and Type_id_PointStatus=171");
            decimal Point = 0;

            Decimal.TryParse(point, out Point);
            Lebi_UserLevel userlev = B_Lebi_UserLevel.GetModel(user.UserLevel_id);

            if (userlev == null)
            {
                userlev = new Lebi_UserLevel();
            }
            List <Lebi_UserLevel> ls = B_Lebi_UserLevel.GetList("Grade > " + userlev.Grade + "", "Grade desc");

            //Lebi_UserLevel newlev=new Lebi_UserLevel();
            if (ls.Count > 0)
            {
                foreach (Lebi_UserLevel l in ls)
                {
                    if (Point >= l.Lpoint)
                    {
                        user.UserLevel_id = l.id;
                        //newlev = l;
                        break;
                    }
                }
            }
            //if (userlev.Grade < newlev.Grade)
            //{
            user.Point = Point;
            B_Lebi_User.Update(user);
            //}
        }
Ejemplo n.º 3
0
        public static void AddPoint(Lebi_User user, decimal point, int type, Lebi_Order order, Lebi_Administrator admin, string remark, string PayNo)
        {
            bool            addflag = false;
            Lebi_User_Point model   = new Lebi_User_Point();

            if (string.IsNullOrEmpty(PayNo))
            {
                Random ran = new Random();
                PayNo = Order.CreateOrderCode() + System.DateTime.Now.Millisecond + ran.Next(100000, 999999);
            }
            model = B_Lebi_User_Point.GetModel("Order_PayNo = lbsql{'" + PayNo + "'}");
            if (model == null)
            {
                model   = new Lebi_User_Point();
                addflag = true;
            }
            if (admin != null)
            {
                model.Admin_id       = admin.id;
                model.Admin_UserName = admin.UserName;
            }
            if (order != null)
            {
                model.Order_id   = order.id;
                model.Order_Code = order.Code;
            }
            model.Order_PayNo         = PayNo;
            model.Type_id_PointStatus = 171;
            model.Point         = point;
            model.Remark        = remark;
            model.Time_Update   = DateTime.Now;
            model.User_id       = user.id;
            model.User_RealName = user.RealName;
            model.User_UserName = user.UserName;
            if (addflag)
            {
                B_Lebi_User_Point.Add(model);
            }
            else
            {
                B_Lebi_User_Point.Update(model);
            }
            UpdateUserPoint(user);
        }
Ejemplo n.º 4
0
        public static void AddPoint(Lebi_User user, decimal point, int type, Lebi_Administrator admin, string remark)
        {
            Lebi_User_Point model = new Lebi_User_Point();

            if (admin != null)
            {
                model.Admin_id       = admin.id;
                model.Admin_UserName = admin.UserName;
            }

            model.Type_id_PointStatus = 171;
            model.Point         = point;
            model.Remark        = remark;
            model.Time_Update   = DateTime.Now;
            model.User_id       = user.id;
            model.User_RealName = user.RealName;
            model.User_UserName = user.UserName;
            B_Lebi_User_Point.Add(model);
            UpdateUserPoint(user);
        }