Exemplo n.º 1
0
 protected void list_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         if (this.list.DataKeys.Count > e.RowIndex)
         {
             string id = this.list.DataKeys[e.RowIndex]["Id"].ToString();
             _bus.Update(new SysMemberInfo()
             {
                 IsDel = 1
             }, "Id=" + id);
             new SysMemberDataBus().Update(new SysMemberData()
             {
                 IsDel = 1
             }, "UserId=" + id);
         }
         BindData();
     }
 }
Exemplo n.º 2
0
 protected void list_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     if (!this.CurrentUserInfo.Account.Contains("dmin"))
     {
         this.Alert("您的权限不足,不能删除用户!如需删除,请联系管理员。");
         return;
     }
     if (e.RowIndex > -1)
     {
         if (this.list.DataKeys.Count > e.RowIndex)
         {
             string id = this.list.DataKeys[e.RowIndex]["UserAccount"].ToString();
             _bus.Update(new SysMemberInfo()
             {
                 IsDel = 1
             }, "Account='" + id + "'");
             new SysMemberDataBus().Update(new SysMemberData()
             {
                 IsDel = 1
             }, "UserAccount='" + id + "'");
         }
         BindData();
     }
 }
Exemplo n.º 3
0
    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("保存成功!");
        }
    }