protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestTool.RequestInt("id", 0);
            if (id == 0)
            {
                if (!EX_Admin.Power("user_point_add", "添加会员积分"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("user_point_edit", "编辑会员积分"))
                {
                    WindowNoPower();
                }
            }
            int user_id = RequestTool.RequestInt("user_id", 0);

            model = B_Lebi_User_Point.GetModel(id);
            if (model == null)
            {
                model = new Lebi_User_Point();
                model.Type_id_PointStatus = 171;
                Point = "";
            }
            else
            {
                //user_id = model.User_id;
                Point = model.Point.ToString();
                mode  = "user";
            }
            Lebi_User user = B_Lebi_User.GetModel(user_id);

            if (user == null)
            {
                User_Name = RequestTool.RequestString("User_Name");
                user      = B_Lebi_User.GetModel("UserName=lbsql{'" + User_Name + "'}");
            }
            if (user != null)
            {
                mode      = "user";
                User_Name = user.UserName;
            }
            user_ids = RequestTool.RequestString("ids");
            if (user_ids != "")
            {
                users = B_Lebi_User.GetList("id in (lbsql{" + user_ids + "})", "id desc");
                mode  = "users";
            }
            su = new SearchUser(CurrentAdmin, CurrentLanguage.Code);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 积分转换
        /// </summary>
        public void PointToMoney()
        {
            string t = RequestTool.RequestSafeString("t");

            if (!CurrentUserLevel.PointToMoney.Contains(t))
            {
                Response.Write("{\"msg\":\"" + Tag("非法提交") + "\"}");
                return;
            }
            string[] arr = t.Split(':');
            if (arr.Length != 2)
            {
                Response.Write("{\"msg\":\"" + Tag("非法提交") + "\"}");
                return;
            }
            if (Convert.ToDecimal(arr[0]) > Convert.ToDecimal(CurrentUser.Point))
            {
                Response.Write("{\"msg\":\"" + Tag("积分不足") + "\"}");
                return;
            }
            Lebi_User_Money model = new Lebi_User_Money();

            model.Money = Convert.ToDecimal(arr[1]);
            model.Type_id_MoneyStatus = 181;
            model.Type_id_MoneyType   = 194;
            model.Remark        = "积分兑换";
            model.Time_Update   = DateTime.Now;
            model.User_id       = CurrentUser.id;
            model.User_RealName = CurrentUser.RealName;
            model.User_UserName = CurrentUser.UserName;
            B_Lebi_User_Money.Add(model);

            Lebi_User_Point pmodel = new Lebi_User_Point();

            pmodel.Point = 0 - Convert.ToDecimal(arr[0]);
            pmodel.Type_id_PointStatus = 171;
            pmodel.Remark        = "积分兑换";
            pmodel.Time_Update   = DateTime.Now;
            pmodel.User_id       = CurrentUser.id;
            pmodel.User_RealName = CurrentUser.RealName;
            pmodel.User_UserName = CurrentUser.UserName;
            B_Lebi_User_Point.Add(pmodel);

            CurrentUser.Point = CurrentUser.Point - Convert.ToDecimal(arr[0]);
            CurrentUser.Money = CurrentUser.Money + Convert.ToDecimal(arr[1]);
            B_Lebi_User.Update(CurrentUser);
            //发送短信
            //Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id);
            SMS.SendSMS_balance(CurrentUser);
            Response.Write("{\"msg\":\"OK\"}");
        }
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);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 编辑会员积分
        /// </summary>
        public void UserPoint_Edit()
        {
            int        id = RequestTool.RequestInt("id", 0);
            SearchUser su = new SearchUser(CurrentAdmin, CurrentLanguage.Code);

            if (id > 0)
            {
                if (!EX_Admin.Power("user_point_edit", "编辑会员积分"))
                {
                    AjaxNoPower();
                    return;
                }
                Lebi_User_Point model = B_Lebi_User_Point.GetModel(id);
                Lebi_User       user  = B_Lebi_User.GetModel(model.User_id);
                Log.Add("编辑会员积分", "User_Point", id.ToString(), CurrentAdmin, user.UserName);
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("会员账号不存在") + "\"}");
                    return;
                }
                model.Point = RequestTool.RequestDecimal("Point", 0);
                model.Type_id_PointStatus = RequestTool.RequestInt("Type_id_PointStatus", 0);
                model.Admin_UserName      = CurrentAdmin.UserName;
                model.Admin_id            = CurrentAdmin.id;
                model.Remark      = RequestTool.RequestString("Remark");
                model.Time_Update = DateTime.Now;
                B_Lebi_User_Point.Update(model);
                Point.UpdateUserPoint(user);
            }
            else
            {
                if (!EX_Admin.Power("user_point_add", "添加会员积分"))
                {
                    AjaxNoPower();
                    return;
                }
                string Mode          = RequestTool.RequestString("mode");
                string User_Name_To  = RequestTool.RequestString("User_Name_To");
                string UserLevel_ids = RequestTool.RequestString("UserLevel_ids");
                string User_ids      = RequestTool.RequestString("User_ids");
                string UserName_ids  = RequestTool.RequestString("UserName_ids");

                if (Mode == "user")
                {
                    Lebi_User user = B_Lebi_User.GetModel("UserName = lbsql{'" + User_Name_To + "'}");
                    if (user == null)
                    {
                        Response.Write("{\"msg\":\"" + Tag("会员账号不存在") + "\"}");
                        return;
                    }
                    Lebi_User_Point model = new Lebi_User_Point();
                    Log.Add("添加会员积分", "User_Point", id.ToString(), CurrentAdmin, User_Name_To + " ->" + RequestTool.RequestDecimal("Point", 0));
                    model.Point = RequestTool.RequestDecimal("Point", 0);
                    model.Type_id_PointStatus = RequestTool.RequestInt("Type_id_PointStatus", 0);
                    model.Admin_UserName      = CurrentAdmin.UserName;
                    model.Admin_id            = CurrentAdmin.id;
                    model.Remark        = RequestTool.RequestString("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);
                    Point.UpdateUserPoint(user);
                }
                else
                {
                    string where = "";
                    int i = 0;
                    if (User_ids == "")
                    {
                        where = "1=1 " + su.SQL;
                        Log.Add("添加会员积分", "User_Point", "", CurrentAdmin, su.Description + " ->" + RequestTool.RequestDecimal("Point", 0));
                    }
                    else
                    {
                        where = "id in (" + User_ids + ")";
                        Log.Add("添加会员积分", "User_Point", "", CurrentAdmin, UserName_ids + " ->" + RequestTool.RequestDecimal("Point", 0));
                    }
                    List <Lebi_User> modellist = B_Lebi_User.GetList(where, "");
                    foreach (Lebi_User user in modellist)
                    {
                        Lebi_User_Point model = new Lebi_User_Point();
                        model.Point = RequestTool.RequestDecimal("Point", 0);
                        model.Type_id_PointStatus = RequestTool.RequestInt("Type_id_PointStatus", 0);
                        model.Admin_UserName      = CurrentAdmin.UserName;
                        model.Admin_id            = CurrentAdmin.id;
                        model.Remark        = RequestTool.RequestString("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);
                        Point.UpdateUserPoint(user);
                    }
                }
            }
            string result = "{\"msg\":\"OK\"}";

            Response.Write(result);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_User_Point model)
 {
     D_Lebi_User_Point.Instance.Update(model);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_User_Point model)
 {
     return(D_Lebi_User_Point.Instance.Add(model));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_User_Point SafeBindForm(Lebi_User_Point model)
 {
     return(D_Lebi_User_Point.Instance.SafeBindForm(model));
 }