protected void SubmitButton_Click(object sender, EventArgs e) { bool flag = false; string msg = string.Empty; if (this.IsValid) { if (WMUsers.IsExitis(null, UserName.Text)) { msg = "用户名已存在"; } else { WMUsers user = new WMUsers(); user.Id = General.UniqueString(user.Id); user.UserName = UserName.Text; user.Password = UserPassword.Text; user.RoleId = UserRole.SelectedValue.ToInt32(); user.NickName = NickName.Text; user.Mobile = UserMobile.Text; user.BankCard = UserBankCard.Text; user.StatusId = UserState.SelectedValue.ToInt32(); if (UserImageUpload.HasFile) { string fileName = string.Format("/share/upload/user/{0}/face.jpg", user.Id); Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload("~" + fileName, 0, 0); if (upload.Upload(UserImageUpload.PostedFile.InputStream)) { user.Image = fileName; UserImage.ImageUrl = upload.FileName; } else { msg = upload.ErrorMessage; Helper.MessageBox(flag, msg); return; } } flag = user.Add(); if (flag) { //后台手动添加用户积分 int integarl = UserInte.Text.ToInt32(); if (integarl > 0) { WMUserIntegrals inte = new WMUserIntegrals(); inte.UserId = user.Id; inte.Integral = integarl; inte.SourceId = 452; inte.Add(); } } } } Helper.MessageBox(flag, msg); }
protected void SubmitButton_Click(object sender, EventArgs e) { bool flag = false; string msg = string.Empty; if (this.IsValid) { WMUsers user = WMUsers.Get(UserId); user.RoleId = UserRole.SelectedValue.ToInt32(); user.NickName = NickName.Text; user.Mobile = UserMobile.Text; user.BankCard = UserBankCard.Text; user.StatusId = UserState.SelectedValue.ToInt32(); if (UserImageUpload.HasFile) { string fileName = string.Format("~/share/upload/user/{0}/face.jpg", user.Id); Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload(fileName, 0, 0); if (upload.Upload(UserImageUpload.PostedFile.InputStream)) { user.Image = fileName; } else { msg = upload.ErrorMessage; Helper.MessageBox(flag, msg); return; } } flag = user.Update(); } Helper.MessageBox(flag); }
protected void ListBind() { int pageCount = 0; List <WMUsers> list = WMUsers.GetList(out pageCount, UserRoleId, UserStateId, UserKey, Pager.CurrentPageIndex - 1, Pager.PageSize); ListConatner.DataSource = list; ListConatner.DataBind(); Pager.RecordCount = pageCount; }
protected void UserBind() { //用户编辑 -- 用户类型项绑定 RoleBind(); //用户编辑 -- 用户状态项绑定 StateBind(); //积分明细 -- 积分来源项绑定 SourceBind(); WMUsers user = WMUsers.Get(UserId); if (user != null) { UserRoleId = user.RoleId; //用户基本信息编辑 UserImage.ImageUrl = user.Image; NickName.Text = user.NickName; UserMobile.Text = user.Mobile; UserBankCard.Text = user.BankCard; UserRole.SelectedValue = user.RoleId.ToString(); UserState.SelectedValue = user.StatusId.ToString(); UserAddDate.Text = user.AddDate.ToString("yyyy-MM-dd HH:mm"); //积分明细 Integarl.Text = string.Format("当前积分:{0}", user.Integral); IntegralBind(); //配送信息 ReceiptBind(); //用户收藏 SaveBind(); if (UserRoleId == 102) { //用户分享 ShareBind(); //用户分红 BonusBind(); //浏览点击 ClickBind(); } } }
protected void ListConatner_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Delete") { string userId = e.CommandArgument.ToString(); bool flag = WMUsers.Delete(userId); if (flag) { Bind(); } Helper.MessageBox(flag); } }