Ejemplo n.º 1
0
        private void dgRoom_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Roombll room = new Roombll();

            int columnIndex = dgRoom.CurrentCell.ColumnIndex;
            int roomid      = int.Parse(dgRoom.CurrentRow.Cells["id"].Value.ToString());

            room.Id = roomid;
            if (dgRoom.CurrentRow.Cells[columnIndex].Value.ToString() == "Edit")
            {
                DataTable dts = room.datagridloads();
                txtLocation.Text = dts.Rows[0][1].ToString();
                txtCapacity.Text = dts.Rows[0][2].ToString();
                txtTech.Text     = dts.Rows[0][3].ToString();

                btnAdd.Text = "Update";
            }
            else if (dgRoom.CurrentRow.Cells[columnIndex].Value.ToString() == "Delete")
            {
                DialogResult confirmResult = MessageBox.Show("Are you sure to delete this item??", "Confirm Delete?", MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    room.Delete1();
                    DataTable dt = room.datagridloads();
                    dgRoom.DataSource = dt;
                }
            }
        }
Ejemplo n.º 2
0
        private void Room_Load(object sender, EventArgs e)
        {
            Roombll   room = new Roombll();
            DataTable dt   = room.datagridloads();

            dgRoom.DataSource = dt;
        }