示例#1
0
        private void button_SuaQuyDinh_Click(object sender, EventArgs e)
        {
            QuyDinhDTO temp = new QuyDinhDTO();

            DialogResult dlr = MessageBox.Show("Bạn có muốn sử quy dinh không?", "Xác nhận!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dlr == DialogResult.Yes)
            {
                temp.TuoiToiThieu         = Convert.ToInt32(this.numericUpDown_TuoiToiThieu.Value);
                temp.TuoiToiDa            = Convert.ToInt32(this.numericUpDown_TuoiToiDa.Value);
                temp.SoNgayMuonToiDa      = Convert.ToInt32(this.numericUpDown_NgayMuonToiDa.Value);
                temp.SoSachMuonToiDa      = Convert.ToInt32(this.numericUpDown_SachMuonToiDa.Value);
                temp.KhoangCachNamXuatBan = Convert.ToInt32(this.numericUpDown_NamXuatBan.Value);
                bool kq = qdBUS.sua(temp);
                if (kq == false)
                {
                    MessageBox.Show("Sửa quy định thất bại.");
                }
                else
                {
                    listQD = qdBUS.select();

                    this.numericUpDown_TuoiToiThieu.Value  = listQD[0].TuoiToiThieu;
                    this.numericUpDown_TuoiToiDa.Value     = listQD[0].TuoiToiDa;
                    this.numericUpDown_NgayMuonToiDa.Value = listQD[0].SoNgayMuonToiDa;
                    this.numericUpDown_SachMuonToiDa.Value = listQD[0].SoSachMuonToiDa;
                    this.numericUpDown_NamXuatBan.Value    = listQD[0].KhoangCachNamXuatBan;
                    MessageBox.Show("Sửa quy dịnh thành công");
                }
            }
            else
            {
                MessageBox.Show("Không sửa.");
            }
        }