예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex >= 0 && textBox1.Text != "")
     {
         if (Search_number(Int32.Parse(numericUpDown1.Value.ToString())))
         {
             MessageBox.Show("Комната с таким номером\nуже существует!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             New_room = new Room_Cl();
             New_room.Number = System.Int32.Parse(numericUpDown1.Value.ToString());
             New_room.Type = comboBox1.Text;
             New_room.Places = System.Int32.Parse(numericUpDown2.Value.ToString());
             New_room.Cost = System.Int32.Parse(textBox1.Text);
             MessageBox.Show("Новая комната\nуспешно добавлена", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.DialogResult = DialogResult.OK;
         }
     }
     else
     {
         MessageBox.Show("Заполните все поля!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
파일: Ecip.cs 프로젝트: ralfzeit/Patterns13
        private void Load_rooms()
        {
            if (File.Exists("Rooms_Base.bin"))
            {
                FileStream fs = new FileStream("Rooms_Base.bin", FileMode.Open);
                BinaryReader br = new BinaryReader(fs);

                Rooms.Clear();

                int kol = br.ReadInt32();
                for (int i = 0; i < kol; i++)
                {
                    Room_Cl New_room = new Room_Cl();
                    New_room.Number = br.ReadInt32();
                    New_room.Type = br.ReadString();
                    New_room.Places = br.ReadInt32();
                    New_room.Cost = br.ReadInt32();
                    Rooms.Add(New_room);
                    comboBox1.Items.Add(Rooms[i].Number);
                }
                comboBox1.SelectedIndex = -1;
                br.Close();
                fs.Close();
            }
        }
예제 #3
0
        private void Load_rooms()
        {
            if (File.Exists("Rooms_Base.bin"))
            {
                FileStream fs = new FileStream("Rooms_Base.bin", FileMode.Open);
                BinaryReader br = new BinaryReader(fs);

                Rooms.Clear();
                dataGridView1.ClearSelection();
                dataGridView1.Rows.Clear();

                int kol = br.ReadInt32();
                dataGridView1.RowCount = kol;
                for (int i = 0; i < kol; i++)
                {
                    Room_Cl New_room = new Room_Cl();
                    New_room.Number = br.ReadInt32();
                    New_room.Type = br.ReadString();
                    New_room.Places = br.ReadInt32();
                    New_room.Cost = br.ReadInt32();
                    Rooms.Add(New_room);
                    dataGridView1.Rows[i].Cells[0].Value = Rooms[i].Number;
                    dataGridView1.Rows[i].Cells[1].Value = Rooms[i].Type;
                    dataGridView1.Rows[i].Cells[2].Value = Rooms[i].Places;
                    dataGridView1.Rows[i].Cells[3].Value = Rooms[i].Cost;
                }
                dataGridView1.ClearSelection();
                br.Close();
                fs.Close();
            }
        }
예제 #4
0
 public Edit_Room(Room_Cl Room)
 {
     InitializeComponent();
     New_room = Room;
 }
예제 #5
0
        private void Load_rooms()
        {
            if (File.Exists("Rooms_Base.bin"))
            {
                FileStream fs = new FileStream("Rooms_Base.bin", FileMode.Open);
                BinaryReader br = new BinaryReader(fs);

                Rooms.Clear();
                dataGridView1.Rows.Clear();

                int kol = br.ReadInt32();
                for (int i = 0; i < kol; i++)
                {
                    Room_Cl New_room = new Room_Cl();
                    New_room.Number = br.ReadInt32();
                    New_room.Type = br.ReadString();
                    New_room.Places = br.ReadInt32();
                    New_room.Cost = br.ReadInt32();
                    Rooms.Add(New_room);
                    comboBox1.Items.Add(New_room.Number);
                }
                br.Close();
                fs.Close();
                if (comboBox1.Items.Count > 0)
                {
                    comboBox1.SelectedIndex = 0;
                    button3.Enabled = true;
                }
            }
        }