コード例 #1
0
        private void reservationsbtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            ReservationControl reservation = new ReservationControl(null, null);

            reservation.Show();
        }
コード例 #2
0
        private void customerdatagrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == customerdatagrid.Columns["Delete"].Index)
            {
                DialogResult dialogResult = MessageBox.Show($"Delete the {this.customerdatagrid.Rows[e.RowIndex].Cells[1].Value + " " + this.customerdatagrid.Rows[e.RowIndex].Cells[2].Value}?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Yes)
                {
                    if (customerRepository.DeleteCustomer(Convert.ToInt32(this.customerdatagrid.Rows[e.RowIndex].Cells[0].Value)))
                    {
                        MessageBox.Show("User Deleted", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("User not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    customerdatagrid.DataSource = customerRepository.GetAllCustomers();
                    clearbtn_Click(sender, e);
                }
            }

            if (e.ColumnIndex == customerdatagrid.Columns["Add_Reservation"].Index)
            {
                DialogResult dialogResult = MessageBox.Show($"Add reservation  the {this.customerdatagrid.Rows[e.RowIndex].Cells[1].Value + " " + this.customerdatagrid.Rows[e.RowIndex].Cells[2].Value}?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Yes)
                {
                    this.Hide();
                    ReservationControl main = new ReservationControl(this.customerdatagrid.Rows[e.RowIndex].Cells[4].Value.ToString(), null);
                    main.Show();
                }
            }
        }
コード例 #3
0
        private void roomdatagrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == roomdatagrid.Columns["Delete"].Index)
            {
                DialogResult dialogResult = MessageBox.Show($"Delete the {this.roomdatagrid.Rows[e.RowIndex].Cells[1].Value}?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Yes)
                {
                    try
                    {
                        roomRepository.DeleteRoom(Convert.ToInt32(this.roomdatagrid.Rows[e.RowIndex].Cells[0].Value));
                        MessageBox.Show("Room Deleted", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        roomdatagrid.DataSource = roomRepository.GetAllRooms();
                        roommainimg.Image       = null;
                        clearbtn_Click_1(sender, e);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }

            if (e.ColumnIndex == roomdatagrid.Columns["Add_Reservation"].Index)
            {
                DialogResult dialogResult = MessageBox.Show($"Add reservation the {this.roomdatagrid.Rows[e.RowIndex].Cells[1].Value}?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Yes)
                {
                    if (roomRepository.CheckRoomStatus(Convert.ToInt32(this.roomdatagrid.Rows[e.RowIndex].Cells[0].Value)))
                    {
                        this.Hide();
                        ReservationControl main = new ReservationControl(null, (int?)this.roomdatagrid.Rows[e.RowIndex].Cells[0].Value);
                        main.Show();
                    }
                    else
                    {
                        MessageBox.Show("Room Status uyğun deyil", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }