Ejemplo n.º 1
0
        private void Delete_btn_Click(object sender, RoutedEventArgs e)
        {
            MMessageBox.Reault reault = MMessageBox.ShouBox(
                "是否要删除?",
                "警 告",
                MMessageBox.ButtonType.YesNo,
                MMessageBox.IconType.warring,
                Orientation.Horizontal,
                "是",
                "否"
                );

            if (reault == MMessageBox.Reault.Yes)
            {
                // MMessageBox.ShowSuccessAlert("你点了 是");
                string LoginID    = ((Button)sender).Tag.ToString();
                int    idex       = this.dataGrid1.SelectedIndex;
                string Account    = Convert.ToString((((DataView)this.dataGrid1.ItemsSource).Table).Rows[idex]["Account"]);
                string LoginIDtwo = Convert.ToString((((DataView)this.dataGrid1.ItemsSource).Table).Rows[idex]["LoginID"]);
                if (LoginID == LoginIDtwo)
                {
                    if (LoginService.Delete(LoginIDtwo, Account, "10000003"))
                    {
                        MMessageBox.ShowSuccessAlert("删除成功 ^_^ ");
                        //读取当前的页数
                        int       page  = int.Parse(this.tbkCurrentsize.Text);
                        int       total = 0;
                        DataTable dt    = LoginService.getAllUserDataTable(ref total, page, rows);
                        if (dt.Rows.Count < rows)
                        {
                            this.btnNext.IsEnabled = false;
                        }
                        if (dt == null || dt.Rows.Count == 0)
                        {
                            this.btnNext.IsEnabled = false;

                            return;
                        }
                        this.dataGrid1.DataContext = dt;
                        this.tbkCurrentsize.Text   = page.ToString();
                        this.tbkTotal.Text         = total.ToString();
                    }
                    else
                    {
                        MMessageBox.ShowSuccessAlert("删除失败,请联系管理员 ^_^ ");
                    }
                }
                else
                {
                    MMessageBox.ShowSuccessAlert("系统服务忙,请联系管理员 ^_^ ");
                }
            }
        }