Ejemplo n.º 1
0
        private void exitBtn_Click(object sender, EventArgs e)
        {
            string teacher = tbxTeacher.Text;
            string grade   = tbxGrade.Text;
            string room    = tbxRoom.Text;
            string date    = tbxDate.Text;

            Info info = new Info(teacher, grade, room, date);

            if ((fs = SeatDB.WriteSeats(fs, dt, info)) != null)
            {
                SeatDB.FileClose(fs);
            }
            else
            {
                MessageBox.Show("file Write failed");
            }
            this.Close();
        }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            //  build the grid view
            dt = new DataTable();

            createLayout();



            if ((fs = SeatDB.FileOpen()) != null)
            {
                Info info = SeatDB.ReadSeats(fs, dt);
                tbxTeacher.Text = info.Teacher;
                tbxGrade.Text   = info.Grade;
                tbxRoom.Text    = info.Room;
                tbxDate.Text    = info.Date;
            }
        }
Ejemplo n.º 3
0
        public search(FileStream fs, DataTable dt, string searchItem)
        {
            InitializeComponent();



            seats = SeatDB.ReadSeatList(fs, dt);

            SeatDB.QuickSort(seats, 0, seats.Count - 1);

            int    position = SeatDB.BinarySearch(seats, searchItem);
            string Item     = "";

            if (position != -1)
            {
                Item = seats[position].Name;
            }

            lbxList.Items.Add("Student" + "\t" + "Across" + "\t" + "Down");

            foreach (seat s in seats)

            {
                if (s.Name != "" && s.Name != "Front Desk")

                {
                    if (s.Name.CompareTo(Item) == 0)
                    {
                        lbxList.Items.Add(s.Name + "\t" + s.Row + "\t" + s.Col);
                        lbxList.SelectedItem = (s.Name + "\t" + s.Row + "\t" + s.Col);
                        txbSearch.Text       = s.Name;
                    }
                    else
                    {
                        lbxList.Items.Add(s.Name + "\t" + s.Row + "\t" + s.Col);
                    }
                }
            }
        }