protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;

            Staff staff = new Staff();

            staff.Staffinfo_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);

            StaffProvider provider = new StaffProvider();

            if (provider.Delete(staff))
            {
                this.Alert("删除成功!!!");
                staff.User_id      = user_id;
                staff.Role_id      = role_id;
                staff.Role_Manage  = user_manage;
                staff.Staffinfo_id = 0;

                if (this.txt_Position.Text != "")
                {
                    staff.Staffinfo_Name = "%" + this.txt_Position.Text + "%";
                }
                this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                this.BindSource(staff);
            }
        }
Beispiel #2
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;

            Staff staff = new Staff();

            staff.Staffinfo_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);

            StaffProvider provider = new StaffProvider();

            if (provider.Delete(staff))
            {
                this.Alert("删除成功!!!");

                if (this.txt_Position.Text == "")
                {
                    this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                    this.BindSource(null);
                }
                else
                {
                    this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                    this.BindSource("%" + this.txt_Position.Text + "%");
                }
            }
        }
Beispiel #3
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;

            Users user = new Users();

            user.User_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);

            if (user.User_id == 1)
            {
                this.Alert("管理员账号不能删除!!!");
                return;
            }

            UserProvider provider = new UserProvider();

            if (provider.Delete(user))
            {
                StaffProvider provider1 = new StaffProvider();
                Staff         staff     = new Staff();
                staff.User_id = user.User_id;
                if (provider1.Delete(staff))
                {
                    this.Alert("删除成功!!!");

                    if (this.txt_Name.Text == "")
                    {
                        this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                        this.BindSource(null);
                    }
                    else
                    {
                        this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                        this.BindSource("%" + this.txt_Name.Text + "%");
                    }
                }
            }
        }