//--------------------------------------- INITIALIZATION ---------------------------------- public BrowseStudentData() { InitializeComponent(); dataBase = new DataBase(); list_results = new List <string>(); list_id = new List <int>(); student = new ToolsClass.Tools.StudentData(); //set default values for structures student.toDefault(); /* When user double click on an item all the informations about that student (grab with he corresponding student id in the table) * are stored in the struct student */ photoHandler.setDefaultValues(); //set timer (used later) timer = new Timer(); timer.Interval = TIME_TIMER; timer.Tick += Timer_Tick; //event timer tick pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; //fit image to pictureBox pictureBox.Load(photoHandler.getDefaultPhotoPath()); //set default image defaulft_textBoxes_color = monday_textBox.BackColor; defaulft_textBoxes_font = monday_textBox.Font; tab_textBox = tab_textBox = new TextBox[] { sunday_textBox, monday_textBox, tuesday_textBox, wednesday_textBox, thursday_textBox, friday_textBox, saturday_textBox }; this.ActiveControl = search_textBox; }
private void setStudentData(int table_id_student) { /*Change the value of all field for user using the informations stored a the structure*/ student = dataBase.getStudentByIndex(table_id_student);//get informations about student in a structure last_name_textBox.Text = student.lastName; first_name_textBox.Text = student.firstName; division_textBox.Text = student.division; sex_textBox.Text = student.getSexToString(); rfid_id_textBox.Text = student.idRFID; exit_regime_textBox.Text = student.labelRegime; for (int i = 0; i < student.halfBoardDays.Length; i++) { /*All day of the working week is represented by a textbox * When student eat at a specific day we set the color to a custom green * else we set the color to the default color and use a lin through the text * All the related textBoxes are stored in an array to acces to it with index of the corresponding day * (start at 0 for sunday) */ if (tab_textBox[i] != null) { if (student.halfBoardDays[i] == 1)//student must eat at school at lunch time { tab_textBox[i].BackColor = Color.FromArgb(255, 166, 77); tab_textBox[i].Font = defaulft_textBoxes_font;//default font without the line through } else//student is external { tab_textBox[i].BackColor = defaulft_textBoxes_color; tab_textBox[i].Font = new Font(tab_textBox[i].Font, FontStyle.Strikeout);//the line through } } } pictureBox.Image.Dispose(); pictureBox.Load(photoHandler.getActualPhotoPath(student.lastName, student.firstName, student.division)); rfid_id_textBox.Focus(); rfid_id_textBox.SelectAll(); }