Ejemplo n.º 1
0
        private void pictureBox9_Click(object sender, EventArgs e) //Добавить группу
        {
            DataTable dt = new DataTable();

            db = new UseDataBase();
            string TeacherId;
            string Temp;

            if (metroTextBox6.Text != "" & comboBox7.Text != "") //Добавить
            {
                dt = new DataTable();
                dt = db.SQLQuery("Select idGroup from Groups");
                if (dt.Rows.Count == 0)
                {
                    Temp = "0";
                }
                else
                {
                    Temp = dt.Rows[dt.Rows.Count - 1][0].ToString();
                }
                Groupid = Convert.ToInt32(Temp);
                Groupid++;
                dt        = db.SQLQuery("Select idTeacher from Teachers where FIO='" + comboBox7.Text + "'");
                TeacherId = dt.Rows[0][0].ToString();
                dataGridView2.DataSource = db.SQLQuery("Insert INTO Groups Values (" + Groupid + ",'" + metroTextBox6.Text + "','" + TeacherId + "')");
                dataGridView2.DataSource = db.SQLQuery("Select * from Groups");
                pictureBox9.BackColor    = Color.Green;
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Ejemplo n.º 2
0
        private void DBEditForm_Load(object sender, EventArgs e)
        {
            db = new UseDataBase();

            //1 - Студенты
            //2 - Группы
            //3 - Родители
            //4 - Преподаватели
            //5 - пользователи

            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView3.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView4.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView5.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            dataGridView1.DataSource = db.SQLQuery("Select * from Students");
            dataGridView2.DataSource = db.SQLQuery("Select * from Groups");
            dataGridView3.DataSource = db.SQLQuery("Select * from Parents");
            dataGridView4.DataSource = db.SQLQuery("Select * from Teachers");
            dataGridView5.DataSource = db.SQLQuery("Select * from Users");

            comboBox1.Text = comboBox1.Items[0].ToString();
            comboBox2.Text = comboBox2.Items[0].ToString();
            comboBox3.Text = comboBox3.Items[0].ToString();
            comboBox4.Text = comboBox4.Items[0].ToString();
            comboBox5.Text = comboBox5.Items[0].ToString();

            comboBox6.DataSource    = db.SQLQuery("Select name from Groups");
            comboBox6.DisplayMember = "name";
            //comboBox6.ValueMember = "idGroup";

            comboBox7.DataSource    = db.SQLQuery("Select FIO from Teachers");
            comboBox7.DisplayMember = "FIO";
        }
Ejemplo n.º 3
0
        public void WordMarks(string filename, string currDir, string mark1, string mark2, string mark3, string mark4, string mark5, string group, string parent)
        {
            db  = new UseDataBase();
            app = new Word.Application();
            doc = app.Documents.Add(currDir);
            doc.Activate();
            wBookmarks = doc.Bookmarks;
            dt         = new DataTable();
            dt         = db.SQLQuery("SELECT Teachers.FIO FROM Teachers INNER JOIN Groups ON Groups.idTeacher = Teachers.idTeacher where Groups.Name = '" + mark5 + "'");
            string teacherFio = dt.Rows[0][0].ToString();

            data = new string[5] {
                mark1, mark2, mark3, mark4, teacherFio
            };
            foreach (Microsoft.Office.Interop.Word.Bookmark mark in wBookmarks)
            {
                wRange      = mark.Range;
                wRange.Text = data[i];
                i++;
            }
            i         = 0;
            filename += "_" + group + "_" + parent;
            doc.SaveAs(FileName: (Environment.CurrentDirectory + @"\report\" + filename));
            string path = Environment.CurrentDirectory + @"\report\" + filename + ".docx";

            doc.Close();
            doc = null;
            app.Quit();

            dt = db.SQLQuery("SELECT DISTINCT Parents.Email FROM Parents, Groups INNER JOIN ParentsSudents ON ParentsSudents.idParent = Parents.idParent INNER JOIN Students ON Students.idGroup = Groups.idGroup AND ParentsSudents.idStudent = Students.idStudent WHERE Groups.Name = '" + group + "' and Parents.FIO = '" + parent + "'");
            string ParentEmail = dt.Rows[0][0].ToString();

            mail = new SendAnEmail();
            mail.MultiMessage(ParentEmail, "Уведомление от РКРИПТ", "", @path);
        }
Ejemplo n.º 4
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            db = new UseDataBase();
            string GroupIndex;
            string Temp;

            if (metroTextBox1.Text != "" & metroTextBox2.Text != "")
            {
                if (dataGridView1.Rows.Count == 0)
                {
                    Temp = "0";
                }
                else
                {
                    Temp = dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[0].Value.ToString();//код
                }
                studNum = Convert.ToInt32(Temp);
                studNum++;
                dt         = db.SQLQuery("select idGroup from Groups where name='" + comboBox6.Text + "'");
                GroupIndex = dt.Rows[0][0].ToString();
                dataGridView1.DataSource = db.SQLQuery("Insert INTO Students Values (" + studNum + ",'" + metroTextBox1.Text + "'," + metroTextBox2.Text + ",'" + metroTextBox3.Text + "'," + GroupIndex + ")");
                dataGridView1.DataSource = db.SQLQuery("Select idStudent,FIO,TelNum,Adres,idGroup from Students");
                pictureBox2.BackColor    = Color.Green;
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Ejemplo n.º 5
0
        private void pictureBox15_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            db = new UseDataBase();

            string Temp;

            if (metroTextBox5.Text != "" & metroTextBox7.Text != "") //Добавить
            {
                dt = new DataTable();
                dt = db.SQLQuery("Select id from Users");
                TeacherIndex++;
                if (dt.Rows.Count == 0)
                {
                    Temp = "0";
                }
                else
                {
                    Temp = dt.Rows[dt.Rows.Count - 1][0].ToString();
                }
                Userid = Convert.ToInt32(Temp);
                Userid++;
                dataGridView4.DataSource = db.SQLQuery("Insert INTO Teachers Values (" + TeacherIndex + ",'" + metroTextBox5.Text + "'," + metroTextBox11.Text + ",'" + metroTextBox7.Text + "')");
                db.SQLQuery("Insert into Users Values (" + Userid + ", '" + metroTextBox7.Text + "','" + metroTextBox10.Text + "','" + metroTextBox5.Text + "')");
                dataGridView4.DataSource = db.SQLQuery("Select * from Teachers");
                pictureBox15.BackColor   = Color.Green;
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Ejemplo n.º 6
0
        private void PasswordRecovery_Click(object sender, EventArgs e)
        {
            db = new UseDataBase();
            DataTable dt = new DataTable();

            //При нажатии на кнопку сработает проверка:
            // 1. Введён ли e-mail.
            // 2. Есть ли такой e-mail в БД
            // Затем отправить пароль на почту и вывести msgBox
            db = new UseDataBase();
            dt = db.SQLQuery("Select login,password from Users where login='******'");
            try
            {
                if (metroTextBox1.Text == dt.Rows[0][0].ToString())
                {
                    SendAnEmail mail = new SendAnEmail();
                    mail.SendOneEmail(metroTextBox1.Text, "Восстановление пароля", "Пароль от Вашей учётной записи:\n" + dt.Rows[0][1].ToString());
                }
                if (metroTextBox1.Text == "")
                {
                    MessageBox.Show("Заполните поле \"Электронная почта\"");
                }
            }
            catch
            {
                if (metroTextBox1.Text == "")
                {
                    MessageBox.Show("Заполните поле \"Электронная почта\"");
                }
                else
                {
                    MessageBox.Show("Указанный логин не существует");
                }
            }
        }
Ejemplo n.º 7
0
        private void pictureBox12_Click(object sender, EventArgs e) //Добавить
        {
            DataTable dt = new DataTable();

            db = new UseDataBase();
            string Temp;

            if (metroTextBox9.Text != "" & comboBox4.Text != "")
            {
                dt = new DataTable();
                dt = db.SQLQuery("Select idParent from Parents");
                if (dt.Rows.Count == 0)
                {
                    Temp = "0";
                }
                else
                {
                    Temp = dt.Rows[dt.Rows.Count - 1][0].ToString();
                }
                Parentid = Convert.ToInt32(Temp);
                Parentid++;
                dataGridView3.DataSource = db.SQLQuery("Insert INTO Parents Values (" + Parentid + ",'" + metroTextBox9.Text + "','" + metroTextBox8.Text + "','" + metroTextBox4.Text + "')");
                dataGridView3.DataSource = db.SQLQuery("Select * from Parents");
                pictureBox12.BackColor   = Color.Green;
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Ejemplo n.º 8
0
        private void MainFormOpen_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            db = new UseDataBase();
            dt = db.SQLQuery("Select login,password from Users where login='******'");
            try
            {
                if (metroTextBox1.Text == dt.Rows[0][0].ToString())
                {
                    if (metroTextBox2.Text == dt.Rows[0][1].ToString())
                    {
                        DataTable tempTable = new DataTable();
                        tempTable = db.SQLQuery("Select login,username from Users where login='******'");
                        MainForm mf = new MainForm();
                        UserMail = tempTable.Rows[0][1].ToString();
                        login    = tempTable.Rows[0][0].ToString();
                        mf.UserNameLabel.Text = UserMail;
                        mf.MailLabel.Text     = login;
                        mf.Show();
                        this.Hide();
                    }
                    if (metroTextBox2.Text != dt.Rows[0][1].ToString())
                    {
                        MessageBox.Show("Пароль не введён, либо введён некорректно", "Ошибка авторизации", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch { MessageBox.Show("Неправильный логин и/или пароль", "Ошибка авторизации", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
        }
Ejemplo n.º 9
0
        private void metroComboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            db = new UseDataBase();
            //По ID группы находим всех студентов этой группы, а по их ID находим родителей и заполняем комбобокс1.
            string query = "SELECT DISTINCT Parents.Email FROM Groups, Parents INNER JOIN Students ON Students.idGroup = Groups.idGroup INNER JOIN ParentsSudents ON ParentsSudents.idParent = Parents.idParent AND ParentsSudents.idStudent = Students.idStudent where Groups.Name like '" + metroComboBox3.Text + "'";

            metroComboBox1.DataSource    = db.SQLQuery(query);
            metroComboBox1.DisplayMember = "Email";
            metroComboBox1.ValueMember   = "Email";
        }
Ejemplo n.º 10
0
        private void pictureBox16_Click(object sender, EventArgs e) //Удалить пользователя
        {
            DialogResult result = MessageBox.Show("Вы уверены что хотите удалить запись: \"" + metroTextBox15.Text + "\" из БД?", "Сообщение", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (result == DialogResult.Yes)
            {
                db = new UseDataBase();
                db.SQLQuery("Delete from Users where id='" + metroTextBox25.Text + "'");
                dataGridView5.DataSource = db.SQLQuery("Select * from Users");
                pictureBox16.BackColor   = Color.Crimson;
            }
        }
Ejemplo n.º 11
0
        private void metroComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            db = new UseDataBase();
            DataTable dt = new DataTable();

            dt = db.SQLQuery("SELECT distinct Parents.FIO FROM Parents INNER JOIN ParentsSudents ON ParentsSudents.idParent = Parents.idParent INNER JOIN Students ON ParentsSudents.idStudent = Students.idStudent INNER JOIN Groups ON Students.idGroup = Groups.idGroup WHERE Groups.Name='" + metroComboBox1.Text + "'");
            checkedListBox1.Items.Clear();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                checkedListBox1.Items.Add(dt.Rows[i][0].ToString(), true);
            }
        }
Ejemplo n.º 12
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         db = new UseDataBase();
         string    idGroup;
         DataTable dt = new DataTable();
         dt      = db.SQLQuery("Select idGroup from Groups where name ='" + comboBox1.Text + "'");
         idGroup = dt.Rows[0][0].ToString();
         dataGridView1.DataSource = db.SQLQuery("Select * from Students where idGroup='" + idGroup + "'");
     }
     catch { }
 }
Ejemplo n.º 13
0
 private void dataGridView4_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     db = new UseDataBase();
     try
     {
         TeacherIndex        = int.Parse(dataGridView4.Rows[dataGridView4.RowCount - 1].Cells[0].Value.ToString()); //код
         metroTextBox22.Text = dataGridView4.Rows[e.RowIndex].Cells[0].Value.ToString();                            //Код
         metroTextBox5.Text  = dataGridView4.Rows[e.RowIndex].Cells[1].Value.ToString();                            //ФИО
         metroTextBox11.Text = dataGridView4.Rows[e.RowIndex].Cells[2].Value.ToString();                            //Телефон
         metroTextBox7.Text  = dataGridView4.Rows[e.RowIndex].Cells[3].Value.ToString();                            //Почта
     }
     catch { }
 }
Ejemplo n.º 14
0
 private void metroButton11_Click(object sender, EventArgs e)
 {
     try
     {
         db = new UseDataBase();
         SelectStudentForm ssf = new SelectStudentForm();
         ssf.ShowDialog();
         selectedStudentID  = ssf.selectedStudentID;
         selectedStudentFIO = ssf.selectedStudentFIO;
         listBox1.Items.Add(selectedStudentFIO);
         db.SQLQuery("Insert Into ParentsSudents Values('" + metroTextBox24.Text + "','" + selectedStudentID + "')");
     }
     catch { }
 }
Ejemplo n.º 15
0
 private void pictureBox17_Click(object sender, EventArgs e) //Изменить пользователя
 {
     db = new UseDataBase();
     if (metroTextBox15.Text != "" & metroTextBox14.Text != "" & metroTextBox13.Text != "" & comboBox8.Text != "")
     {
         db.SQLQuery("Update Users Set Login='******', Password='******', UserName='******', Role='" + comboBox8.Text + "'  where id='" + metroTextBox25.Text + "'");
         dataGridView5.DataSource = db.SQLQuery("Select * from Users");
         pictureBox17.BackColor   = Color.NavajoWhite;
     }
     else
     {
         MessageBox.Show("Заполните все поля");
     }
 }
Ejemplo n.º 16
0
 private void pictureBox14_Click(object sender, EventArgs e)//Обновить
 {
     db = new UseDataBase();
     if (metroTextBox5.Text != "" & metroTextBox7.Text != "")
     {
         db.SQLQuery("Update Teachers Set FIO='" + metroTextBox5.Text + "',TelNum=" + metroTextBox11.Text + ", Email='" + metroTextBox7.Text + "' where idTeacher='" + metroTextBox22.Text + "'");
         dataGridView4.DataSource = db.SQLQuery("Select * from Teachers");
         pictureBox14.BackColor   = Color.NavajoWhite;
     }
     else
     {
         MessageBox.Show("Заполните все поля");
     }
 }
Ejemplo n.º 17
0
 private void pictureBox18_Click(object sender, EventArgs e) //Добавить пользователя
 {
     db = new UseDataBase();
     if (metroTextBox15.Text != "" & metroTextBox14.Text != "" & metroTextBox13.Text != "" & comboBox8.Text != "")
     {
         Userid++;
         dataGridView5.DataSource = db.SQLQuery("Insert INTO Users Values (" + Userid + ",'" + metroTextBox14.Text + "','" + metroTextBox13.Text + "','" + metroTextBox15.Text + "','" + comboBox8.Text + "')");
         dataGridView5.DataSource = db.SQLQuery("Select * from Users");
         pictureBox18.BackColor   = Color.Green;
     }
     else
     {
         MessageBox.Show("Заполните все поля");
     }
 }
Ejemplo n.º 18
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            db = new UseDataBase();
            DataTable dt = new DataTable();

            try
            {
                Groupid             = int.Parse(dataGridView2.Rows[dataGridView2.RowCount - 1].Cells[0].Value.ToString()); //код
                metroTextBox23.Text = dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString();                            //Код
                metroTextBox6.Text  = dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString();                            //Наименование
                dt             = db.SQLQuery("Select FIO from Teachers where idTeacher='" + dataGridView2.Rows[e.RowIndex].Cells[2].Value.ToString() + "'");
                comboBox7.Text = dt.Rows[0][0].ToString();                                                                 //Преподаватель
            }
            catch { }
        }
Ejemplo n.º 19
0
        private void SingleMessageForm_Load(object sender, EventArgs e)
        {
            db = new UseDataBase();
            metroComboBox3.DataSource    = db.SQLQuery("Select * from groups");
            metroComboBox3.DisplayMember = "NAME";
            //metroComboBox3.ValueMember = "idGroup";


            //По ID группы находим всех студентов этой группы, а по их ID находим родителей и заполняем комбобокс1.
            string query = "SELECT DISTINCT Parents.Email FROM Groups, Parents INNER JOIN Students ON Students.idGroup = Groups.idGroup INNER JOIN ParentsSudents ON ParentsSudents.idParent = Parents.idParent AND ParentsSudents.idStudent = Students.idStudent";

            metroComboBox1.DataSource    = db.SQLQuery(query);
            metroComboBox1.DisplayMember = "Email";
            //metroComboBox1.ValueMember = "Email";
            metroTextBox3.Text = "";
        }
Ejemplo n.º 20
0
        private void pictureBox11_Click(object sender, EventArgs e) //Изменить
        {
            db = new UseDataBase();
            DataTable dt = new DataTable();

            if (metroTextBox9.Text != "" & comboBox4.Text != "")
            {
                db.SQLQuery("Update Parents Set FIO='" + metroTextBox9.Text + "',TelNum='" + metroTextBox8.Text + "',Email='" + metroTextBox4.Text + "'  where idParent='" + metroTextBox24.Text + "'");
                dataGridView3.DataSource = db.SQLQuery("Select * from Parents");
                pictureBox11.BackColor   = Color.NavajoWhite;
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Ejemplo n.º 21
0
        private void metroButton12_Click(object sender, EventArgs e)
        {
            string indexToDel;

            db = new UseDataBase();
            DataTable dt = new DataTable();

            try
            {
                dt         = db.SQLQuery("Select idStudent from ParentsSudents where idParent='" + metroTextBox24.Text + "'");
                indexToDel = dt.Rows[listBox1.SelectedIndex][0].ToString();
                db.SQLQuery("Delete from ParentsSudents where idStudent='" + indexToDel + "' and idParent='" + metroTextBox24.Text + "'");
                listBox1.Items.Remove(listBox1.SelectedItem);
            }
            catch { }
        }
Ejemplo n.º 22
0
        private void metroButton2_Click(object sender, EventArgs e)
        {
            db = new UseDataBase();
            string    idGroup;
            DataTable dt = new DataTable();

            if (isChecked == false)
            {
                dataGridView1.DataSource = db.SQLQuery("Select * from Students where FIO='" + metroTextBox1.Text + "'");
            }
            else
            {
                dt      = db.SQLQuery("Select idGroup from Groups where name ='" + comboBox1.Text + "'");
                idGroup = dt.Rows[0][0].ToString();
                dataGridView1.DataSource = db.SQLQuery("Select * from Students where FIO='" + metroTextBox1.Text + "' and idGroup='" + idGroup + "'");
            }
        }
Ejemplo n.º 23
0
        private void dataGridView5_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            db = new UseDataBase();
            DataTable dt   = new DataTable();
            DataTable Temp = new DataTable();

            try
            {
                Userid = int.Parse(dataGridView5.Rows[dataGridView5.RowCount - 1].Cells[0].Value.ToString()); //код
                metroTextBox25.Text = dataGridView5.Rows[e.RowIndex].Cells[0].Value.ToString();               //Код
                metroTextBox15.Text = dataGridView5.Rows[e.RowIndex].Cells[3].Value.ToString();               //Имя пользователя
                metroTextBox14.Text = dataGridView5.Rows[e.RowIndex].Cells[1].Value.ToString();               //Логин
                metroTextBox13.Text = dataGridView5.Rows[e.RowIndex].Cells[2].Value.ToString();               //Пароль
                comboBox8.Text      = dataGridView5.Rows[e.RowIndex].Cells[4].Value.ToString();               //Роль
            }
            catch { }
        }
Ejemplo n.º 24
0
        private void pictureBox6_Click(object sender, EventArgs e) //Изменить группу
        {
            db = new UseDataBase();
            DataTable dt = new DataTable();
            string    TeacherId;

            if (metroTextBox6.Text != "" & comboBox7.Text != "")
            {
                dt        = db.SQLQuery("Select idTeacher from Teachers where FIO='" + comboBox7.Text + "'");
                TeacherId = dt.Rows[dt.Rows.Count - 1][0].ToString();
                db.SQLQuery("Update Groups Set Name='" + metroTextBox6.Text + "',idTeacher='" + TeacherId + "'  where idGroup='" + metroTextBox23.Text + "'");
                dataGridView2.DataSource = db.SQLQuery("Select * from Groups");
                pictureBox14.BackColor   = Color.NavajoWhite;
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Ejemplo n.º 25
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            db = new UseDataBase();
            string    GroupIndex;
            DataTable dt = new DataTable();

            if (metroTextBox1.Text != "" & metroTextBox2.Text != "")
            {
                dt         = db.SQLQuery("select idGroup from Groups where name='" + comboBox6.Text + "'");
                GroupIndex = dt.Rows[0][0].ToString();
                db.SQLQuery("Update Students Set FIO='" + metroTextBox1.Text + "',TelNum=" + metroTextBox2.Text + ",Adres='" + metroTextBox3.Text + "',idGroup=" + GroupIndex + " where idStudent='" + metroTextBox21.Text + "'");
                dataGridView1.DataSource = db.SQLQuery("Select * from Students");
                pictureBox3.BackColor    = Color.NavajoWhite;
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Ejemplo n.º 26
0
        } //Users

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            db = new UseDataBase();
            try
            {
                studNum = int.Parse(dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[0].Value.ToString()); //код
                //MessageBox.Show(studNum.ToString());
                metroTextBox21.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();                //код
                metroTextBox1.Text  = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();                //ФИО
                metroTextBox2.Text  = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();                //Телефон
                metroTextBox3.Text  = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();                //Адрес
                DataTable dt = new DataTable();
                dt = db.SQLQuery("Select Name from Groups where idGroup=" + dataGridView1.Rows[e.RowIndex].Cells[4].Value);
                string GroupIndex = dt.Rows[0][0].ToString();
                //comboBox6.Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
                comboBox6.Text = GroupIndex;//Группа
            }
            catch { }
        }
Ejemplo n.º 27
0
 private void metroToggle1_CheckedChanged(object sender, EventArgs e)
 {
     db = new UseDataBase();
     if (isChecked == false)
     {
         isChecked             = true;
         comboBox1.Enabled     = true;
         comboBox1.DataSource  = db.SQLQuery("Select name from Groups");
         comboBox1.ValueMember = "name";
         string    idGroup;
         DataTable dt = new DataTable();
         dt      = db.SQLQuery("Select idGroup from Groups where name ='" + comboBox1.Text + "'");
         idGroup = dt.Rows[0][0].ToString();
         dataGridView1.DataSource = db.SQLQuery("Select * from Students where idGroup='" + idGroup + "'");
     }
     else
     {
         isChecked                = false;
         comboBox1.Enabled        = false;
         comboBox1.Text           = "Все";
         dataGridView1.DataSource = db.SQLQuery("Select * from Students");
     }
 }
Ejemplo n.º 28
0
        private void dataGridView3_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            db = new UseDataBase();
            DataTable dt   = new DataTable();
            DataTable Temp = new DataTable();

            try
            {
                Parentid            = int.Parse(dataGridView3.Rows[dataGridView3.RowCount - 1].Cells[0].Value.ToString()); //код
                metroTextBox24.Text = dataGridView3.Rows[e.RowIndex].Cells[0].Value.ToString();                            //Код
                metroTextBox9.Text  = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString();                            //ФИО
                metroTextBox8.Text  = dataGridView3.Rows[e.RowIndex].Cells[2].Value.ToString();                            //Телефон
                metroTextBox4.Text  = dataGridView3.Rows[e.RowIndex].Cells[3].Value.ToString();                            //Почта
                listBox1.Items.Clear();
                dt = db.SQLQuery("SELECT Students.idStudent FROM Parents INNER JOIN ParentsSudents ON ParentsSudents.idParent = Parents.idParent INNER JOIN Students ON ParentsSudents.idStudent = Students.idStudent WHERE Parents.idParent='" + metroTextBox24.Text + "'");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Temp = db.SQLQuery("Select FIO from Students where idStudent='" + dt.Rows[i][0].ToString() + "'");
                    listBox1.Items.Add(Temp.Rows[0][0].ToString());
                }
            }
            catch { }
        }
Ejemplo n.º 29
0
 private void MultiMessageForm_Load(object sender, EventArgs e)
 {
     db = new UseDataBase();
     metroComboBox1.DataSource    = db.SQLQuery("Select * from groups");
     metroComboBox1.DisplayMember = "NAME";
 }
Ejemplo n.º 30
0
 private void metroButton3_Click(object sender, EventArgs e)
 {
     db = new UseDataBase();
     dataGridView1.DataSource = db.SQLQuery("Select * from Students");
 }