Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            ConnOpen journal = new ConnOpen();

            journal.connection.Open();
            string command_journal = "UPDATE dbo.journal SET status = '1' WHERE student_ticket_number = '" + STN + "'";

            using (SqlCommand cmd = new SqlCommand(command_journal, journal.connection))
            {
                cmd.ExecuteNonQuery();
            }
        }
Exemple #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (RadioButton1.Checked == true)
            {
                role = 1;
                url  = "Admin";
            }
            else if (RadioButton2.Checked == true)
            {
                role = 2;
                url  = "Teacher";
            }
            else if (RadioButton3.Checked == true)
            {
                role = 3;
                url  = "Student";
            }
            else if (RadioButton4.Checked == true)
            {
                role = 4;
                url  = "Parent";
            }
            else
            {
                role = 5;
            }
            string   login           = TextBox1.Text;
            string   password        = TextBox2.Text;
            ConnOpen loginConnection = new ConnOpen();

            loginConnection.connection.Open();
            SqlCommand    sqlCom = new SqlCommand("SELECT * FROM dbo.users WHERE role LIKE '%" + role + "' and login LIKE '%" + login + "'and password LIKE '%" + password + "'", loginConnection.connection);
            SqlDataReader dr     = sqlCom.ExecuteReader();

            int id;

            dr.Read();
            if (dr.HasRows == true)
            {
                id = Convert.ToInt32(dr["user_id"]);
                //устанавливаем сессию
                Session["Value"] = id;
                Server.Transfer(url + ".aspx", true);
            }
            else
            {
                Label3.Text = "Не войдете!";
            }
            loginConnection.connection.Close();
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            uId = Convert.ToInt32(Session["Value"]);
            string   sName = "", gText = "";
            ConnOpen teachLoad    = new ConnOpen();
            ConnOpen teachLoadUse = new ConnOpen();

            if (Session["Value"] != null)
            {
                teachLoad.connection.Open();
                SqlCommand    command_groupp = new SqlCommand("SELECT * FROM dbo.groupp", teachLoad.connection);
                SqlDataReader reader_groupp  = command_groupp.ExecuteReader();
                //DropDownList1.Items.Clear();
                //Обнуляем количество итемов
                if (flag == 0)
                {
                    while (reader_groupp.Read())
                    {
                        gText = reader_groupp["groupp_kurs"].ToString() + " " + reader_groupp["groupp_name"].ToString();
                        DropDownList1.Items.Add(new ListItem(gText, reader_groupp["groupp_id"].ToString()));
                        DropDownList5.Items.Add(new ListItem(gText, reader_groupp["groupp_id"].ToString()));
                        Label6.Text += reader_groupp["groupp_id"].ToString();
                    }
                }
                teachLoad.connection.Close();
                //------------------------------------------------------
                teachLoad.connection.Open();
                teachLoadUse.connection.Open();
                SqlCommand    command_student = new SqlCommand("SELECT * FROM dbo.student", teachLoad.connection);
                SqlDataReader reader_student  = command_student.ExecuteReader();
                SqlCommand    command_use;
                SqlDataReader reader_use;
                //Создал команду для таблицы dbo.users
                string F = "", I = "", O = "";
                //DropDownList2.Items.Clear();
                //Обнуляем количество итемов
                if (flag == 0)
                {
                    while (reader_student.Read())
                    {
                        command_use = new SqlCommand("SELECT * FROM dbo.users WHERE user_id LIKE '%" + reader_student["user_id"].ToString() + "'", teachLoadUse.connection);
                        reader_use  = command_use.ExecuteReader();
                        //С таблицы dbo.users достаем строки где user_id равно user_id из таблицы dbo.teacher
                        reader_use.Read();
                        //Читаем таблицу dbo.users
                        F = reader_use["familija"].ToString() + " ";
                        I = reader_use["imja"].ToString() + " ";
                        O = reader_use["otchestvo"].ToString() + " ";
                        DropDownList2.Items.Add(new ListItem(F + I + O, reader_student["student_ticket_number"].ToString()));
                        //Добавляем в DropDownList3 ФИО из таблицы dbo.users
                        reader_use.Close();
                        //Обязательно закрываем reader_use
                    }
                }
                teachLoad.connection.Close();
                teachLoadUse.connection.Close();
                //------------------------------------------------------
                teachLoad.connection.Open();
                SqlCommand    command_subject = new SqlCommand("SELECT * FROM dbo.subject", teachLoad.connection);
                SqlDataReader reader_subject = command_subject.ExecuteReader();
                //DropDownList4.Items.Clear();
                //Обнуляем количество итемов
                if (flag == 0)
                {
                    while (reader_subject.Read())
                    {
                        sName = reader_subject["subject_name"].ToString();
                        DropDownList4.Items.Add(new ListItem(sName, reader_subject["subject_id"].ToString()));
                        DropDownList6.Items.Add(new ListItem(sName, reader_subject["subject_id"].ToString()));
                    }
                }
                teachLoad.connection.Close();
                flag = 1;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string   sName = "", gText = "";
            ConnOpen tLoad    = new ConnOpen();
            ConnOpen tLoadUse = new ConnOpen();

            if (Session["Value"] != null)
            {
                int r = Convert.ToInt32(Session["Value"]);
                Label1.Text = r.ToString();
                if (r != 1)
                {
                    Panel1.Enabled = false;
                }
                else
                {
                    tLoad.connection.Open();
                    SqlCommand    command_subject = new SqlCommand("SELECT * FROM dbo.subject", tLoad.connection);
                    SqlDataReader reader_subject  = command_subject.ExecuteReader();
                    //DropDownList1.Items.Clear();
                    //Обнуляем количество итемов
                    if (flag == 0)
                    {
                        while (reader_subject.Read())
                        {
                            sName = reader_subject["subject_name"].ToString();
                            DropDownList1.Items.Add(new ListItem(sName, reader_subject["subject_id"].ToString()));
                        }
                    }
                    tLoad.connection.Close();
                    //------------------------------------------------------
                    tLoad.connection.Open();
                    tLoadUse.connection.Open();
                    SqlCommand    command_teach = new SqlCommand("SELECT * FROM dbo.teacher", tLoad.connection);
                    SqlDataReader reader_teach  = command_teach.ExecuteReader();
                    //--
                    SqlCommand    command_use;
                    SqlDataReader reader_use;
                    string        F = "", I = "", O = "";
                    //DropDownList2.Items.Clear();
                    //Обнуляем количество итемов
                    if (flag == 0)
                    {
                        while (reader_teach.Read())
                        {
                            command_use = new SqlCommand("SELECT * FROM dbo.users WHERE user_id LIKE '%" + reader_teach["user_id"].ToString() + "'", tLoadUse.connection);
                            reader_use  = command_use.ExecuteReader();
                            //С таблицы dbo.users достаем строки где user_id равно user_id из таблицы dbo.teacher
                            reader_use.Read();
                            //Читаем таблицу dbo.users
                            F = reader_use["familija"].ToString() + " ";
                            I = reader_use["imja"].ToString() + " ";
                            O = reader_use["otchestvo"].ToString() + " ";
                            DropDownList2.Items.Add(new ListItem(F + I + O, reader_teach["teacher_id"].ToString()));
                            //Добавляем в DropDownList3 ФИО из таблицы dbo.users
                            reader_use.Close();
                        }
                    }
                    tLoad.connection.Close();
                    tLoadUse.connection.Close();
                    //------------------------------------------------------
                    tLoad.connection.Open();
                    SqlCommand    command_groupp = new SqlCommand("SELECT * FROM dbo.groupp", tLoad.connection);
                    SqlDataReader reader_groupp  = command_groupp.ExecuteReader();
                    //DropDownList3.Items.Clear();
                    //Обнуляем количество итемов
                    if (flag == 0)
                    {
                        while (reader_groupp.Read())
                        {
                            gText = reader_groupp["groupp_kurs"].ToString() + " " + reader_groupp["groupp_name"].ToString();
                            DropDownList3.Items.Add(new ListItem(gText, reader_groupp["groupp_id"].ToString()));
                        }
                    }
                    tLoad.connection.Close();
                    //------------------------------------------------------
                    tLoad.connection.Open();
                    string    result    = "";
                    string    today     = DateTime.Now.ToShortDateString().ToString();
                    Timetable deyOfWeek = new Timetable();
                    DateTime  monday    = deyOfWeek.getMonday(DateTime.Now);
                    DateTime  sunday    = deyOfWeek.getSunday(DateTime.Now);
                    Label1.Text = sunday.ToString();
                    SqlCommand    command = new SqlCommand("SELECT * FROM dbo.timetable WHERE time BETWEEN '" + monday.ToShortDateString() + "' AND '" + sunday.ToShortDateString() + "' ORDER BY time ASC", tLoad.connection);
                    SqlDataReader reader  = command.ExecuteReader();
                    result += "<table> <tr><td>Дата и время</td><td>Предмет</td> <td>Преподаватель</td><td>Группа</td> </tr>";

                    while (reader.Read())
                    {
                        result += "<tr> <td>" + reader["time"].ToString() + "</td>";
                        result += "<td>" + reader["subject_id"].ToString() + "</td>";
                        result += "<td>" + reader["teacher_id"].ToString() + "</td>";
                        result += "<td>" + reader["groupp_id"].ToString() + "</td>";
                        result += "</tr>";
                    }
                    result     += "</ table >";
                    Label1.Text = result;
                    reader.Close();
                    flag = 1;
                }
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ConnOpen parentLoad  = new ConnOpen();
            ConnOpen journalLoad = new ConnOpen();

            if (Session["Value"] != null)
            {
                parentLoad.connection.Open();
                int id = Convert.ToInt32(Session["Value"]);
                uId         = Convert.ToInt32(Session["Value"]);
                Label1.Text = id.ToString();
                SqlCommand    sqlCom = new SqlCommand("SELECT * FROM dbo.users WHERE user_id LIKE '%" + id + "'", parentLoad.connection);
                SqlDataReader dr     = sqlCom.ExecuteReader();
                dr.Read();
                FIO         = dr["familija"].ToString() + " " + dr["imja"].ToString() + " " + dr["otchestvo"].ToString();
                Label1.Text = "Здравствуйте " + FIO + " Вы родитель ученика ";
                parentLoad.connection.Close();
                parentLoad.connection.Open();
                SqlCommand    sqlComId = new SqlCommand("SELECT * FROM dbo.parent WHERE user_id LIKE '%" + id + "'", parentLoad.connection);
                SqlDataReader drId     = sqlComId.ExecuteReader();
                drId.Read();
                STN = drId["student_ticket_number"].ToString();
                parentLoad.connection.Close();
                parentLoad.connection.Open();
                SqlCommand    sqlComSTN = new SqlCommand("SELECT * FROM dbo.student WHERE student_ticket_number LIKE '%" + STN + "'", parentLoad.connection);
                SqlDataReader drSTN     = sqlComSTN.ExecuteReader();
                drSTN.Read();
                sUser_id = drSTN["user_id"].ToString();
                parentLoad.connection.Close();
                parentLoad.connection.Open();
                SqlCommand    sqlComAll = new SqlCommand("SELECT * FROM dbo.users WHERE user_id LIKE '%" + sUser_id + "'", parentLoad.connection);
                SqlDataReader drAll     = sqlComAll.ExecuteReader();
                drAll.Read();
                sFIO         = drAll["familija"].ToString() + " " + drAll["imja"].ToString() + " " + drAll["otchestvo"].ToString();
                Label1.Text += sFIO;
                parentLoad.connection.Close();
                //-----------------
                journalLoad.connection.Open();
                SqlCommand    command = new SqlCommand("SELECT * FROM dbo.journal WHERE student_ticket_number LIKE '%" + STN + "' AND (status LIKE '0' OR status LIKE 'NULL')", journalLoad.connection);
                SqlDataReader reader = command.ExecuteReader();
                string        result = "", grade = "";
                result += "<table> <tr><td>id</td><td>Предмет</td><td>Преподаватель</td> <td>Оценка</td><td>Время выставления оценки</td><td>Время проведение работ</td><td>Комментарий к оценке</td> </tr>";
                while (reader.Read())
                {
                    if (reader["grade"].ToString() == "0")
                    {
                        grade = "Отсутствовал";
                    }
                    else
                    {
                        grade = reader["grade"].ToString();
                    }
                    result += "<tr> <td>" + reader["journal_id"].ToString() + "</td>";
                    result += "<td>" + reader["subject_id"].ToString() + "</td>";
                    result += " <td>" + reader["teacher_user_id"].ToString() + "</td>";
                    result += " <td>" + grade + "</td>";
                    result += " <td>" + reader["date_a"].ToString() + "</td>";
                    result += " <td>" + reader["date_b"].ToString() + "</td>";
                    result += " <td>" + reader["note"].ToString() + "</td>";
                    result += "</tr>";
                }
                result     += "</ table >";
                Label2.Text = "Оценки ученика " + sFIO + ":" + result;
                reader.Close();
                journalLoad.connection.Close();
            }
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ConnOpen studLoad    = new ConnOpen();
            ConnOpen studLoadUse = new ConnOpen();

            if (Session["Value"] != null)
            {
                studLoad.connection.Open();
                int id = Convert.ToInt32(Session["Value"]);
                uId         = Convert.ToInt32(Session["Value"]);
                Label1.Text = id.ToString();
                SqlCommand    sqlCom = new SqlCommand("SELECT * FROM dbo.users WHERE user_id LIKE '%" + id + "'", studLoad.connection);
                SqlDataReader dr     = sqlCom.ExecuteReader();
                dr.Read();
                FIO         = dr["familija"].ToString() + " " + dr["imja"].ToString() + " " + dr["otchestvo"].ToString();
                Label1.Text = "Здравствуйте " + FIO;
                studLoad.connection.Close();
                //----------
                studLoad.connection.Open();
                studLoadUse.connection.Open();
                string        result      = "";
                SqlCommand    command_use = new SqlCommand("SELECT * FROM dbo.student WHERE user_id LIKE '%" + id.ToString() + "'", studLoadUse.connection);
                string        studId      = "";
                SqlDataReader reader_use  = command_use.ExecuteReader();
                string        grade       = "";
                string        groupp_id   = "";
                while (reader_use.Read())
                {
                    studId    = reader_use["student_ticket_number"].ToString();
                    groupp_id = reader_use["groupp_id"].ToString();
                }
                studLoadUse.connection.Close();
                SqlCommand    command = new SqlCommand("SELECT * FROM dbo.journal WHERE student_ticket_number LIKE '%" + studId + "'", studLoad.connection);
                SqlDataReader reader  = command.ExecuteReader();
                result += "<table> <tr><td>Предмет</td><td>Преподаватель</td> <td>Оценка</td><td>Время выставления оценки</td><td>Время проведение работ</td><td>Комментарий к оценке</td> </tr>";
                while (reader.Read())
                {
                    if (reader["grade"].ToString() == "0")
                    {
                        grade = "Отсутствовал";
                    }
                    else
                    {
                        grade = reader["grade"].ToString();
                    }
                    result += "<tr> <td>" + reader["subject_id"].ToString() + "</td>";
                    result += " <td>" + reader["teacher_user_id"].ToString() + "</td>";
                    result += " <td>" + grade + "</td>";
                    result += " <td>" + reader["date_a"].ToString() + "</td>";
                    result += " <td>" + reader["date_b"].ToString() + "</td>";
                    result += " <td>" + reader["note"].ToString() + "</td>";
                    result += "</tr>";
                }
                result     += "</ table >";
                Label2.Text = "Оценки ученика:" + result;
                reader.Close();
                studLoad.connection.Close();
                //----------
                studLoad.connection.Open();
                string        result_hw  = "";
                string        today      = DateTime.Now.ToShortDateString();
                SqlCommand    hw_command = new SqlCommand("SELECT * FROM dbo.homework WHERE groupp_id LIKE '%" + groupp_id + "' AND time > '" + today + "'  ORDER BY time ASC", studLoad.connection);
                SqlDataReader hw_reader  = hw_command.ExecuteReader();
                result_hw += "<table> <tr><td>Предмет</td><td>Преподаватель</td> <td>Домашнее задание</td><td>Время занятия</td></tr>";
                while (hw_reader.Read())
                {
                    result_hw += " <td>" + hw_reader["subject_id"].ToString() + "</td>";
                    result_hw += " <td>" + hw_reader["teacher_user_id"].ToString() + "</td>";
                    result_hw += " <td>" + hw_reader["homework_text"].ToString() + "</td>";
                    result_hw += " <td>" + hw_reader["time"].ToString() + "</td>";
                    result_hw += "</tr>";
                }
                result_hw  += "</ table >";
                Label3.Text = "Домашнее задание, для вашей группы: " + result_hw;
                studLoad.connection.Close();
            }
        }