Exemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (gvReaders.SelectedRows.Count > 0)
            {
                ReaderDTO reader = new ReaderDTO();
                reader.MaNV     = (string)gvReaders.SelectedRows[0].Cells["madocgia"].Value;
                reader.HoTen    = (string)gvReaders.SelectedRows[0].Cells["hoten"].Value;
                reader.DiaChi   = (string)gvReaders.SelectedRows[0].Cells["diachi"].Value;
                reader.DOB      = (DateTime)gvReaders.SelectedRows[0].Cells["dob"].Value;
                reader.SDT      = (string)gvReaders.SelectedRows[0].Cells["sdt"].Value;
                reader.CMND     = (string)gvReaders.SelectedRows[0].Cells["cmnd"].Value;
                reader.Email    = (string)gvReaders.SelectedRows[0].Cells["email"].Value;
                reader.NLT      = (DateTime)gvReaders.SelectedRows[0].Cells["ngaylapthe"].Value;
                reader.NVLapThe = (string)gvReaders.SelectedRows[0].Cells["nvlapthe"].Value;

                reader.UserName = (string)gvReaders.SelectedRows[0].Cells["username"].Value;
                reader.Password = (string)gvReaders.SelectedRows[0].Cells["password"].Value;

                var updateFrm = new AddReaderForm();
                updateFrm.librabrianid  = librarianid;
                updateFrm.update        = true;
                updateFrm.reader        = reader;
                updateFrm.UpdateReader += UpdateFrm_UpdateReader;

                updateFrm.ShowDialog();
            }
            else
            {
                MessageBox.Show("[!] Select a row to update\n" +
                                "[*] No rows has been selected yet or," +
                                "[*] you selected a cell only");
            }
        }
Exemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var readerForm = new AddReaderForm();

            readerForm.librabrianid = librarianid;
            readerForm.AddReader   += ReaderForm_AddReader;
            readerForm.ShowDialog();
        }