private void BindData() { string whereString = "IsDel=0"; string key = this.txtKeywords.Text.FormatSqlParm(); if (!string.IsNullOrEmpty(key)) { whereString += string.Format(" and (Account LIKE '%{0}%' or Name LIKE '%{0}%')", key); } if (!string.IsNullOrEmpty(this.ddlStatus.SelectedValue) && this.ddlStatus.SelectedValue != "全部") { whereString += string.Format(" and Status='{0}'", this.ddlStatus.SelectedValue); } else { whereString += " and (Status='已注册-未充值' or Status='已注册-已充值')"; } int count = _bus.RecordCount(whereString); this.NPager1.PageSize = 15; this.NPager1.RecordCount = count; DataTable dt = _bus.GetMemberList(this.NPager1.CurrentPage, this.NPager1.PageSize, whereString); this.list.DataSource = dt.DefaultView; this.list.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { SysMemberInfo model = null; var dt = _userBus.GetMemberList(1, 1, string.Format("Account='{0}' or Mobile='{1}'", this.Account.Text, this.Mobile.Text)); if (dt.Rows.Count > 0) { this.Id.Value = dt.Rows[0]["Id"].ToString(); BindData(); model = _userBus.QueryModel("Id=" + this.Id.Value); } else { model = new SysMemberInfo(); BindKit.FillModelFromContainer(this.editor, model); //获取最大排序 model.UserSn = Guid.NewGuid().ToString().ToLower(); model.IsEnabled = 1; model.IsDel = 0; model.Creator = this.CurrentUserName; model.CreateDate = DateTime.Now; //新增数据 model.Id = _userBus.InsertIdentity(model); } //保存用户信息 var data = _dataBus.QueryModel("UserAccount='" + model.Account + "'"); if (data == null) { data = _dataBus.CreateModel(); BindKit.FillModelFromContainer(this.editor, data); data.UserId = model.Id; data.UserAccount = model.Account; data.IsDel = 0; _dataBus.Insert(data); } this.Id.Value = model.Id.ToString(); this.promptControl.ShowSuccess("执行成功!"); BindLog(); } }
protected void btnExport_Click(object sender, EventArgs e) { string whereString = "IsDel=0"; string key = this.txtKeywords.Text.FormatSqlParm(); if (!string.IsNullOrEmpty(key)) { whereString += string.Format(" and (UserAccount LIKE '%{0}%' or Nickname LIKE '%{0}%')", key); } if (!string.IsNullOrEmpty(this.txtPhone.Text)) { whereString += string.Format(" and Mobile LIKE '%{0}%'", this.txtPhone.Text); } DataTable dt = _bus.GetMemberList(1, int.MaxValue, whereString, "CreateDate DESC"); this.Export(dt); }