protected void btnSubmit_Click(object sender, EventArgs e) { SysMemberDataBus bus = new SysMemberDataBus(); SysMemberData smd = new SysMemberData(); BindKit.FillModelFromContainer(this.frm, smd); try { if (!string.IsNullOrEmpty(this.Id.Value)) { int id; int.TryParse(this.Id.Value, out id); bus.Update(smd, " IsDel = 0 and UserId=" + id); this.Alert("修改用户信息成功!"); } } catch (Exception ex) { this.Alert("修改用户信息失败!原因:" + ex.ToString()); return;; } }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { var model = _userBus.CreateModel(); BindKit.FillModelFromContainer(this.editor, model); //保存用户信息 if (this.Id.Value == "") { //if (_userBus.MemberExist(this.Account.Text)) { // this.promptControl.ShowError("用户账号已存在,请重新输入!"); // return; //} int phonecount = _dataBus.RecordCount(" IsDel = 0 and Mobile = '" + this.Mobile.Text + "'"); if (phonecount > 0) { this.promptControl.ShowError("会员电话号码已存在,请重新输入!"); return; } //获取最大排序 model.UserSn = Guid.NewGuid().ToString().ToLower(); model.IsEnabled = 1; model.IsDel = 0; model.Creator = this.CurrentUserName; model.CreateDate = DateTime.Now; model.Password = "******"; model.Name = this.Account.Text; model.Id = _userBus.InsertIdentity(model); } else { _userBus.Update(model, null); } var data = _dataBus.QueryModel("UserID='" + model.Id + "'"); if (data == null) { data = _dataBus.CreateModel(); BindKit.FillModelFromContainer(this.editor, data); data.UserId = model.Id; data.UserAccount = model.Account; data.IsDel = 0; data.Nickname = this.Account.Text; data.Memo = DateTime.Now.ToString(); data.Interest = this.Partner.SelectedValue; _dataBus.Insert(data); } else { BindKit.FillModelFromContainer(this.editor, data); data.UserAccount = model.Account; data.Interest = this.Partner.SelectedValue; _dataBus.Update(data, "UserID='" + data.UserId + "'"); } this.Id.Value = model.Id.ToString(); this.promptControl.ShowSuccess("保存成功!"); } }