Пример #1
0
        /// <summary>
        /// Mcally 2019年2月24日12:24:34
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            this.btnUp.IsEnabled = true;
            //读取当前的页数
            int page = int.Parse(this.tbkCurrentsize.Text);

            int total = 0;

            page++;
            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;
                MMessageBox.ShowSuccessAlert("已经是最后一页了 ^_^ ");
                return;
            }
            this.dataGrid1.DataContext = dt;
            this.tbkCurrentsize.Text   = page.ToString();
            this.tbkTotal.Text         = total.ToString();
        }
Пример #2
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("系统服务忙,请联系管理员 ^_^ ");
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 分页加载
        /// Mcally 2019年2月24日10:13:402
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Go_Click(object sender, RoutedEventArgs e)
        {
            string page = this.tbxPageNum.Text;

            //是否输入为空值
            if (string.IsNullOrWhiteSpace(page))
            {
                //MMessageBox.ShowAlert(
                //                     "Success!",
                //                     Orientation.Horizontal,
                //                     null,
                //                     "#3ca9fe",
                //                     false);
                //  MMessageBox.ShowSuccessAlert();
                MMessageBox.ShowSuccessAlert("请先输入页数 ^_^ ");
                return;
            }
            //是否为数值
            if (!Regex.Match(page, @"^[0-9]*$").Success)
            {
                MMessageBox.ShowSuccessAlert("页数请输入数字 ^_^ ");
                return;
            }
            int total = 0;

            this.btnNext.IsEnabled = true;
            this.btnUp.IsEnabled   = true;
            DataTable dt = LoginService.getAllUserDataTable(ref total, int.Parse(page), rows);

            if (dt == null || dt.Rows.Count == 0)
            {
                this.btnNext.IsEnabled = false;
                MMessageBox.ShowSuccessAlert("无数据。。 ^_^ ");
                return;
            }
            if (dt.Rows.Count < rows)
            {
                this.btnNext.IsEnabled = false;
            }
            this.dataGrid1.DataContext = dt;
            this.tbkTotal.Text         = total.ToString();
            this.tbkCurrentsize.Text   = page;
        }