예제 #1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            var db      = new dbprovider();
            var room_id = db.SqlExec($"SELECT uid FROM rooms WHERE room_number = {guests_to_add[0].roomN}")[0][0];

            for (int i = 0; i < guests_to_add.Count(); i++)
            {
                db.SqlExec($"INSERT INTO guests(name, surname, patronymic, used_room_id, date_of_arrival, date_of_leaving) VALUES('{guests_to_add[i].name}', '{guests_to_add[i].surname}', '{guests_to_add[i].patronymic}', {room_id}, GETDATE(), GETDATE())");
            }

            var res = MessageBox.Show("Заддные успешно занесены", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Information);

            if (res == DialogResult.OK)
            {
                this.Close();
            }
        }