Exemple #1
0
        private async void listTeachers(TeacherQueryParameters filters)
        {
            try
            {
                var apiPath = RestService.For <ApiService>(Routes.baseUrl);
                if (filters == null)
                {
                    var dataResponse = await apiPath.GetTeachersAsync();

                    teachers = JsonConvert.DeserializeObject <TeachersApiResponse[]>(dataResponse.ToString());
                }
                else
                {
                    var dataResponse = await apiPath.GetTeachersFilteredAsync(filters);

                    teachers = JsonConvert.DeserializeObject <TeachersApiResponse[]>(dataResponse.ToString());
                }

                loadingText.Visible    = false;
                loadingCircle1.Visible = false;

                if (teachers.Length == 0)
                {
                    Label noTeachers = new Label();
                    noTeachers.Name     = "noTeachers";
                    noTeachers.Text     = "Não há professores cadastrados!";
                    noTeachers.Font     = new Font(Styles.defaultFont.FontFamily, Convert.ToInt32(Styles.defaultFont.SizeInPoints));
                    noTeachers.AutoSize = true;
                    noTeachers.Location = new Point(20, 20);
                    centralPanel.Controls.Add(noTeachers);
                }
                else
                {
                    int i;
                    for (i = 0; i < teachers.Length; i++)
                    {
                        TeachersApiResponse teachersData = teachers[i];

                        Teachers serie = new Teachers(teachersData.Nome, teachersData.Telefone, teachersData.Email, teachersData.RG, teachersData.Foto, i);
                        centralPanel.Controls.Add(serie.getSeriePanel());
                    }
                    Panel panel = new Panel();
                    panel.Size     = new Size(1, 20);
                    panel.Location = new Point(20, (20 + Styles.seriesSize.Height) * (i));
                    centralPanel.Controls.Add(panel);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Um erro occoreu: " + ex.ToString());
            }
        }
Exemple #2
0
 private void comboBox02_Professor_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox02_Professor.SelectedItem.Equals(""))
     {
         filterSelectedTeacher = null;
         return;
     }
     foreach (TeachersApiResponse teacher in teachers)
     {
         if (teacher.Nome == comboBox02_Professor.SelectedItem.ToString())
         {
             filterSelectedTeacher = teacher;
         }
     }
 }
Exemple #3
0
        public Form5(Form1 parentForm)
        {
            InitializeComponent();

            this.ControlBox = false; //Ocultar barra superior
            this.BackColor  = Styles.darkGray;
            this.ForeColor  = Styles.white;
            this.parentForm = parentForm;

            filterSelectedSerie   = null;
            filterSelectedTeacher = null;

            siglaSerieList = new List <string>();
            idSerieList    = new List <int>();

            siglaTeacherList = new List <string>();
            rgTeacherList    = new List <string>();
        }