1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BE;
namespace WindowsFormsApplication1
{
public partial class AddRoomForm : Form
{
BL.IBL bl;
public AddRoomForm(BL.IBL bl)
{
InitializeComponent();
this.bl = bl;
AR_typeroom_comboBox.DataSource = Enum.GetValues(typeof(BE.Room.Room_Type));
}
private Room room()
{
return new Room
{
code_Room = int.Parse(AR_coderoom_textBox.Text),
Bed_num = int.Parse(AR_numberbed_comboBox.Text),
Type = (Room.Room_Type)AR_typeroom_comboBox.SelectedValue,
Price_r = int.Parse(AR_priceroom_textBox.Text),
Balcony = AR_balcony_checkBox.Checked,
Blackglass = AR_blackglass_checkBox.Checked,
Keydoor = AR_keydoor_checkBox.Checked,
Minibar = AR_Minibar_checkBox.Checked,
Safe = AR_Minibar_checkBox.Checked,
Sea_view = AR_Minibar_checkBox.Checked
};
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult response_room_exit = MessageBox.Show("Are you sure to close this page ?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (response_room_exit == DialogResult.Yes)
{
Close();
}
}
private void AddRoom_button_Click(object sender, EventArgs e)
{
try
{
bl.add_room(room());
MessageBox.Show("Room Added", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
}
catch
{
MessageBox.Show("Misses Information", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void AR_resetroom_button_Click(object sender, EventArgs e)
{
AR_coderoom_textBox.ResetText();
AR_numberbed_comboBox.ResetText();
AR_typeroom_comboBox.ResetText();
AR_balcony_checkBox.Checked = false;
AR_blackglass_checkBox.Checked = false;
AR_keydoor_checkBox.Checked = false;
AR_Minibar_checkBox.Checked = false;
AR_Safe_checkBox.Checked = false;
AR_seaview_checkBox.Checked = false;
}
}
} |
Partager