示例#1
0
        //从列表中删除人员
        private void delete_btn_Click(object sender, EventArgs e)
        {
            var             flag = false;
            List <UserInfo> list = new List <UserInfo>();

            list.AddRange(Userinfolist.Select(x => new UserInfo(x)));
            foreach (DataGridViewRow row in users_dataGridView.SelectedRows)
            {
                var deleteUser = row.DataBoundItem as UserInfo;
                var jresult    = BaiduUtils.delUser(deleteUser.group_id, deleteUser.user_id);
                if (jresult.Equals("SUCCESS"))
                {
                    flag = true;
                    list.Remove(deleteUser);
                    MessageBox.Show("删除成功:" + jresult.ToString());
                }
                else
                {
                    MessageBox.Show("删除失败:" + jresult.ToString());
                }
            }

            if (flag)
            {
                users_dataGridView.DataSource = list;
            }
        }
示例#2
0
        private void delete_btn_Click(object sender, EventArgs e)
        {
            var flag = false;
            List <FaceSearch> list = new List <FaceSearch>();

            list.AddRange(Userinfolist.Select(x => new FaceSearch(x)));
            foreach (DataGridViewRow row in users_dataGridView.SelectedRows)
            {
                var deleteUser = row.DataBoundItem as FaceSearch;

                var jresult = FaceDectectHelper.DeleteUser(deleteUser.group_id, deleteUser.user_id);
                if (jresult["error_code"].ToString() == "0")
                {
                    flag = true;
                    list.Remove(deleteUser);
                }
            }

            if (flag)
            {
                users_dataGridView.DataSource = list;
            }
        }