示例#1
0
        public void Update(OtherDuihuanInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"UPDATE OtherDuihuan SET userid = @userid, truename = @truename, mobile = @mobile, note = @note, integral = @integral, adminid = @adminid, addtime = @addtime
                            where id=@id";

                conn.Execute(sql, entity);
            }
        }
示例#2
0
        public int Add(OtherDuihuanInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"INSERT INTO OtherDuihuan(userid,truename,mobile,note,integral,adminid,addtime) VALUES(@userid,@truename,@mobile,@note,@integral,@adminid,@addtime);
                            select SCOPE_IDENTITY()";

                return(conn.Query <int>(sql, entity).Single());
            }
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int id = RequestHelper.GetQueryString <int>("ID");
         if (id != int.MinValue)
         {
             //CheckAdminPower("ReadUser", PowerCheckType.Single);
             OtherDuihuan  = OtherDuihuanBLL.Read(id);
             userid.Text   = OtherDuihuan.userid.ToString();
             name.Text     = OtherDuihuan.truename;
             mobile.Text   = OtherDuihuan.mobile;
             integral.Text = OtherDuihuan.integral;
             note.Text     = OtherDuihuan.note;
         }
     }
 }
示例#4
0
 public static void Update(OtherDuihuanInfo entity)
 {
     dal.Update(entity);
 }
示例#5
0
 public static int Add(OtherDuihuanInfo entity)
 {
     return(dal.Add(entity));
 }
示例#6
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(userid.Text))
            {
                ScriptHelper.Alert("会员ID不能为空");
                return;
            }

            OtherDuihuanInfo model = new OtherDuihuanInfo();

            model.id = RequestHelper.GetQueryString <int>("ID");
            if (model.id > 0)
            {
                //model = OtherDuihuanBLL.Read(model.id);
                //model.truename = name.Text;
                //model.mobile = mobile.Text;
                //model.note = note.Text;
                //model.integral = integral.Text;
                //model.adminid = Cookies.Admin.GetAdminID(true);
                //model.addtime = RequestHelper.DateNow;

                //OtherDuihuanBLL.Update(model);

                //AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), "修改兑换记录", model.id);
            }
            else
            {
                UserInfo usermodel = UserBLL.Read(Convert.ToInt32(userid.Text));
                if (usermodel.Id > 0)
                {
                    if (string.IsNullOrEmpty(integral.Text) || Convert.ToInt32(integral.Text) <= 0)
                    {
                        ScriptHelper.Alert("请填写兑换积分");
                        return;
                    }

                    if (usermodel.PointLeft < Convert.ToInt32(integral.Text))
                    {
                        ScriptHelper.Alert("会员可用积分不足");
                        return;
                    }

                    model.userid   = usermodel.Id;
                    model.truename = name.Text;
                    model.mobile   = mobile.Text;
                    model.note     = note.Text;
                    model.integral = integral.Text;
                    model.adminid  = Cookies.Admin.GetAdminID(true);
                    model.addtime  = RequestHelper.DateNow;

                    //CheckAdminPower("UpdateUserMessage", PowerCheckType.Single);
                    int _id = OtherDuihuanBLL.Add(model);
                    if (_id > 0)
                    {
                        //会员积分扣除
                        usermodel.PointLeft -= Convert.ToInt32(integral.Text);
                        UserBLL.Update(usermodel);

                        AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), "添加兑换记录", _id);
                    }
                }
                else
                {
                    ScriptHelper.Alert("会员ID不存在或已删除");
                    return;
                }
            }

            ScriptHelper.Alert(ShopLanguage.ReadLanguage("OperateOK"), RequestHelper.RawUrl);
        }