示例#1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (CheckInput() && !CheckModelChanged())
            {
                DZB model = new DZB()
                {
                    BKISBN = ISBN,

                    DZID      = dzid,
                    DZNAME    = txtName.Text,
                    DZYEAR    = int.Parse(txtYear.Text),
                    DZDUTY    = txtDuty.Text,
                    DZADDRESS = txtAddress.Text
                };
                if (BLLDB.DZB.Update(model) == true)
                {
                    MessageBox.Show("更新成功");
                    BindData("");
                    ClearAll();
                }
                else
                {
                    MessageBox.Show("更新失败");
                }
            }
        }
示例#2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (CheckInput() && ISBN != null)
     {
         string msg   = MakeIdentifying();
         DZB    model = new DZB()
         {
             DZID      = msg,
             DZADDRESS = txtAddress.Text,
             DZDUTY    = txtDuty.Text,
             DZNAME    = txtName.Text,
             DZYEAR    = int.Parse(txtYear.Text),
             BKISBN    = ISBN
         };
         if (BLLDB.DZB.Add(model) == true)
         {
             MessageBox.Show("添加纪录成功");
             BindData("");
             ClearAll();
         }
         else
         {
             MessageBox.Show("添加纪录失败");
         }
     }
 }
示例#3
0
        public bool CheckDZID(string num)
        {
            DZB model = this.GetModel(num);

            if (model == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#4
0
 public bool CheckModelChanged()
 {
     if (dgvData.SelectedRows.Count == 1)
     {
         DZB model = (DZB)dgvData.SelectedRows[0].DataBoundItem;
         return(model.DZADDRESS == txtAddress.Text &&
                model.DZDUTY == txtDuty.Text &&
                model.DZNAME == txtName.Text &&
                model.DZYEAR == int.Parse(txtYear.Text));
     }
     else
     {
         return(false);
     }
 }
示例#5
0
 private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvData.SelectedRows.Count == 1)
     {
         DZB model = (DZB)dgvData.SelectedRows[0].DataBoundItem;
         txtName.Text      = model.DZNAME;
         txtDuty.Text      = model.DZDUTY;
         txtYear.Text      = model.DZYEAR.ToString();
         txtAddress.Text   = model.DZADDRESS;
         ISBN              = model.BKISBN;
         dzid              = model.DZID;
         btnAdd.Enabled    = true;
         btnDelete.Enabled = true;
         btnModify.Enabled = true;
     }
 }
示例#6
0
 private void borrow_Click(object sender, EventArgs e)
 {
     if (CheckInput() && ISBN != null)
     {
         string msg   = MakeIdentifying();
         DZB    model = new DZB()
         {
             DZID      = msg,
             DZADDRESS = cbxAddress.Text,
             DZDUTY    = cbxWork.Text,
             DZNAME    = txtName.Text,
             DZYEAR    = int.Parse(cbxYear.Text),
             BKISBN    = ISBN
         };
         if (BLLDB.DZB.Add(model) == true)
         {
             MessageBox.Show("借书成功");
         }
         else
         {
             MessageBox.Show("借书失败");
         }
     }
 }