⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmamercedel.cs

📁 数据库课程设计
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Bussiness;
namespace UI
{
    public partial class frmAmercedel : Form
    {
        //构造函数里初始化frmBorrowInfo的对象
        SelectInfo objSelectInfo = new SelectInfo();
        public frmAmercedel()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        /// <summary>
        /// 验证字符串是否为空
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public bool IsNull(string input)
        {
            if (input == "")
            {
                return true;
            }
            return false;
        }

        /// <summary>
        /// 此方法用于检测输入的字符串是否全为数字
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public bool IsDigit(string input)
        {
            int count = 0;
            foreach (char ch in input)
            {
                if (char.IsDigit(ch))
                {
                    count++;
                }
            }
            if (input.Length == count)

                return true;
            return false;
        }
        public void YanZheng()
        {
            if (IsNull(txtReaderID.Text.Trim()))
            {
                MessageBox.Show("读者卡号不能为空");
                txtReaderID.Focus();
                return;
            }
            else if (IsDigit(txtReaderID.Text.Trim()) || txtReaderID.Text.Trim().IndexOf('R') != 0)
            {
                MessageBox.Show("读者卡号必须以R开头后跟数字");
                txtReaderID.Focus();
                return;
            }
            else if (txtReaderID.Text.Length != 5)
            {
                MessageBox.Show("读者卡号必须为五位");
                txtReaderID.Focus();
                return;
            }

            else if (IsNull(txtID.Text.Trim()))
            {
                MessageBox.Show("读者姓名不能为空");
                txtID.Focus();
                return;
            }
         
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {

                //先给罚款表添加纪录
                if (this.radLose.Checked)
                {
                        DialogResult dir = MessageBox.Show("确定要删除吗","确定",MessageBoxButtons.YesNo);
                        if (dir.Equals(DialogResult.Yes))
                        {

                            //删除丢失信息
                            objSelectInfo.delBookLose(this.txtID.Text.ToString(), this.txtReaderID.Text.ToString());
                            MessageBox.Show("删除成功!");
                        }
                }
                else if (this.radMagazineLose.Checked)
                {
                        DialogResult dir = MessageBox.Show("确定要删除吗","确定",MessageBoxButtons.YesNo);
                        if (dir.Equals(DialogResult.Yes))
                        {

                            //删除丢失信息
                            objSelectInfo.delMagazineLoseA(this.txtID.Text.ToString(), this.txtReaderID.Text.ToString());
                            MessageBox.Show("删除成功!");
                        }
                }
                else if (this.radMangle.Checked)
                {
                        DialogResult dir = MessageBox.Show("确定要删除吗","确定",MessageBoxButtons.YesNo);
                        if (dir.Equals(DialogResult.Yes))
                        {
                            //插入书籍丢失信息
                            objSelectInfo.delBookAmerce(this.txtID.Text.ToString(), this.txtReaderID.Text.ToString());

                            MessageBox.Show("删除成功");
                        }
                }
                else if (this.radioButton1.Checked)
                {

                        DialogResult dir = MessageBox.Show("确定要删除吗","确定",MessageBoxButtons.YesNo);
                        if (dir.Equals(DialogResult.Yes))
                        {
                            //插入期刊丢失信息
                            objSelectInfo.delMagazineAmerce(this.txtID.Text.ToString(), this.txtReaderID.Text.ToString());

                            MessageBox.Show("删除成功");
                        }
                }
                else
                {
                    MessageBox.Show("请选择罚款原因");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -