Exemplo n.º 1
0
        void fillTeacherKeyCombo()
        {
            iTeacherTableDB iTeacher = new iTeacherTableDB();
            MySqlCommand    command  = new MySqlCommand("SELECT * FROM `iteacher`");

            comboBoxfkT.DataSource         = iTeacher.getTeachers(command);
            comboBoxfkT.DisplayMember      = "id"; comboBoxfkT.ValueMember = "id";
            comboBoxfkT.SelectedItem       = null;
            this.comboBoxfkT.DropDownStyle = ComboBoxStyle.DropDownList;
        }
Exemplo n.º 2
0
        private void statisticTeacherForm_Load(object sender, EventArgs e)
        {//показываем кол-во учителей
            iTeacherTableDB iTeacher = new iTeacherTableDB();
            double totalTeacher = Convert.ToDouble(iTeacher.totalTeacher());
            double totalMale = Convert.ToDouble(iTeacher.totalMale());
            double totalFemale = Convert.ToDouble(iTeacher.totalFemale());

            double malePercentage = totalMale * 100 / totalTeacher;
            double femalePercentage = totalFemale * 100 / totalTeacher;
            labelTotal.Text = "Общая количество учителей: " + totalTeacher.ToString();
            labelMale.Text = "Мужчины: " + malePercentage.ToString("0.00") + "%";
            labelFemale.Text = "Женщины: " + femalePercentage.ToString("0.00") + "%";
        }
Exemplo n.º 3
0
        private void buttonAddTeacher_Click(object sender, EventArgs e)
        {
            iTeacherTableDB iTeacher   = new iTeacherTableDB();
            string          surname    = textBoxSname.Text;
            string          name       = textBoxName.Text;
            string          patronymic = textBoxPname.Text;
            string          gender     = "Мужчина";

            if (radioButtonFemale.Checked)
            {
                gender = "Женщина";
            }
            DateTime     birthdate  = dateTimePicker1.Value;
            string       address    = textBoxAddress.Text;
            string       mail       = textBoxMail.Text;
            string       mobile     = textBoxMobile.Text;
            string       login      = textBoxLogin.Text;
            string       password   = textBoxPassword.Text;
            MemoryStream teacherPic = new MemoryStream();

            int born_year = dateTimePicker1.Value.Year;
            int this_year = DateTime.Now.Year;

            if ((this_year - born_year) < 22 || (this_year - born_year) > 55)
            {
                MessageBox.Show("Учитель не может преподовать если ему нет 22 и ему больше 55 лет", "Не правильная дата", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (myVerif())
            {
                pictureBoxTeacherImage.Image.Save(teacherPic, pictureBoxTeacherImage.Image.RawFormat);
                if (iTeacher.insertTeacher(surname, name, patronymic, gender, birthdate, address, mail, mobile, login, password, teacherPic))
                {
                    MessageBox.Show("Учитель добавлен в нашу школу", "Успешно!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Извините что-то не так", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Выполните все услновии", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }