Esempio n. 1
0
 public AddEditClassroom(Classroom classroomtoedit)
 {
     InitializeComponent();
     textBox1.Text = classroomtoedit.Classroomname;
     checkBox1.Checked = classroomtoedit.Projectoravailable;
     editing = true;
     button1.Text = "Update classroom";
     this.Text = "Update classroom";
     currentClassroom = classroomtoedit;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //starting point of the application
            //we will load the menu of the application
            //here
            rooms = new List<Classroom>();

            Computer PC1 = new Computer("L113-", "OK", 5);
            Computer PC2 = new Computer("L11", "OK", 2);
            Computer PC3 = new Computer("L1", "NOT OK", 3);
            Computer PC4 = new Computer("L113-8", "NOT OK", 3);
            Laptop PC5 = new Laptop("L113-9", "NOT OK", 3);

            List<Computer> computers = new List<Computer>();

            computers.Add(PC1);
            computers.Add(PC2);
            computers.Add(PC3);
            computers.Add(PC4);
            computers.Add(PC5);

            //myClassroom = L113
            Classroom myClassroom = new Classroom("L113", true,computers);

            List<Computer> computers2 = new List<Computer>();

            computers2.Add(new Computer("L114-1", "OK", 1));
            computers2.Add(new Computer("L114-2", "OK", 5));

            //myClassroom2 = L114
            Classroom myClassroom2 = new Classroom("L114", true, computers2);

            //max classrooms = 4

            //first 2 classrooms
               rooms.Add(myClassroom);
            rooms.Add(myClassroom2);

            String menu =
                "1.) List all classrooms in system \t\n" +
                "2.) Add new classroom \t\n" +
                "3.) Add new computer to classroom \t\n" +
                "4.) List all computers in classroom \t\n" +
                "5.) Update computer status by computer name \t\n" +
                "6.) List all computers ordered by fault \t\n" +
                "7.) GUI \t\n" +
                "8.) Quit \t\n";

            Menu(menu);

            Console.ReadLine();
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!editing) {
                string classroomname = textBox1.Text;
                bool projector = checkBox1.Checked;
                Classroom newClassroom = new Classroom(classroomname, projector, new List<Computer>());
                MainProgram.rooms.Add(newClassroom);
            }
            else
            {
                currentClassroom.Classroomname = textBox1.Text;
                currentClassroom.Projectoravailable = checkBox1.Checked;
            }

            ClassroomsForm owner = (ClassroomsForm)this.Owner;
            owner.updateGrid();
            this.Close();
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!editing)
            {
                string    classroomname = textBox1.Text;
                bool      projector     = checkBox1.Checked;
                Classroom newClassroom  = new Classroom(classroomname, projector, new List <Computer>());
                MainProgram.rooms.Add(newClassroom);
            }
            else
            {
                currentClassroom.Classroomname      = textBox1.Text;
                currentClassroom.Projectoravailable = checkBox1.Checked;
            }

            ClassroomsForm owner = (ClassroomsForm)this.Owner;

            owner.updateGrid();
            this.Close();
        }
Esempio n. 5
0
        static void opt2()
        {
            int roomscounter = 0;

            foreach (Classroom c in rooms)
            {
                if (c != null)
                {
                    roomscounter++;
                }
            }

            Console.WriteLine("Enter new classroom name: ");
            string classroomname = Convert.ToString(Console.ReadLine());

            Console.WriteLine("Does the classroom have a projector? ");
            bool projector = yesno();
            //create a new classroom with an empty array of computers
            Classroom newClassroom = new Classroom(classroomname, projector, new List <Computer>());



            rooms.Add(newClassroom);
        }
Esempio n. 6
0
 public ClassroomChooser(Laptop computerToMove, Classroom sourceClassroom)
 {
     InitializeComponent();
     comp        = computerToMove;
     sourceCroom = sourceClassroom;
 }
Esempio n. 7
0
 public void move(Classroom c1, Classroom c2)
 {
     c1.Computersinclassroom.Remove(this);
     c2.Computersinclassroom.Add(this);
 }
Esempio n. 8
0
 public ManageComputersForm(Classroom classroomtoedit)
 {
     InitializeComponent();
     classroom = classroomtoedit;
 }
Esempio n. 9
0
 public ClassroomChooser(Laptop computerToMove,Classroom sourceClassroom)
 {
     InitializeComponent();
     comp = computerToMove;
     sourceCroom = sourceClassroom;
 }
Esempio n. 10
0
 public Classroom copyMe()
 {
     Classroom outputC = new Classroom(this.Classroomname, this.Projectoravailable, this.Computersinclassroom);
     return outputC;
 }
Esempio n. 11
0
        public static Classroom copyClassroom(Classroom c1)
        {
            Classroom copy = new Classroom(c1.Classroomname, c1.Projectoravailable, c1.Computersinclassroom);

            return(copy);
        }
Esempio n. 12
0
 public static Classroom copyClassroom(Classroom c1)
 {
     Classroom copy = new Classroom(c1.Classroomname, c1.Projectoravailable, c1.Computersinclassroom);
     return copy;
 }
Esempio n. 13
0
        static void opt2()
        {
            int roomscounter = 0;

            foreach (Classroom c in rooms)
            {
                if (c!=null)
                {
                    roomscounter++;
                }
            }

            Console.WriteLine("Enter new classroom name: ");
            string classroomname = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Does the classroom have a projector? ");
            bool projector = yesno();
            //create a new classroom with an empty array of computers
            Classroom newClassroom = new Classroom(classroomname, projector,new List<Computer>());

            rooms.Add(newClassroom);
        }
Esempio n. 14
0
 public ManageComputersForm(Classroom classroomtoedit)
 {
     InitializeComponent();
     classroom = classroomtoedit;
 }
Esempio n. 15
0
 public void move(Classroom c1, Classroom c2)
 {
     c1.Computersinclassroom.Remove(this);
     c2.Computersinclassroom.Add(this);
 }
Esempio n. 16
0
        public Classroom copyMe()
        {
            Classroom outputC = new Classroom(this.Classroomname, this.Projectoravailable, this.Computersinclassroom);

            return(outputC);
        }