private List <string> SetDailySchedule(string day)
 {
     if (EmployerSession.GetClassNumber() != null || BoxClasses.SelectedIndex != -1)
     {
         List <string> dailySchedule = new List <string>();
         string        cn            = EmployerSession.GetClassNumber();
         if (cn == "")
         {
             cn = (string)BoxClasses.SelectedItem;
         }
         else
         {
             cn = EmployerSession.GetClassNumber();
         }
         SqlConnection connection = new SqlConnection("Server=localhost\\SQLEXPRESS;Database=master;Trusted_Connection=True;");
         SqlCommand    command    = new SqlCommand("USE SchoolBase SELECT [Дата], [Предмет] FROM SchoolSchedule WHERE [Дата] BETWEEN '" + day + " 0:00' AND '" + day + " 23:59' AND [Класс] = '" + cn + "' ORDER BY [Дата]", connection);
         connection.Open();
         SqlDataReader reader = command.ExecuteReader();
         while (reader.Read())
         {
             dailySchedule.Add(reader.GetDateTime(0).ToString("HH:mm") + " " + reader.GetString(1));
         }
         connection.Close();
         return(dailySchedule);
     }
     return(null);
 }
Example #2
0
        public UserEmployerGrades()
        {
            InitializeComponent();

            studentIdList      = new List <int>();
            DeleteGradeEnabled = EmployerSession.IsPrincipal();
            AddStudentEnabled  = EmployerSession.IsPrincipal();

            string commandText = "USE SchoolBase SELECT [Идентификатор], [Имя учащегося], [Фамилия учащегося] FROM dbo.SchoolStudents";

            if (EmployerSession.GetClassNumber() != "")
            {
                commandText += " WHERE [Класс] = '" + EmployerSession.GetClassNumber() + "'";
            }
            SqlConnection connection = new SqlConnection("Server=localhost\\SQLEXPRESS;Database=master;Trusted_Connection=True;");
            SqlCommand    command    = new SqlCommand(commandText, connection);

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                studentIdList.Add(reader.GetInt32(0));
                ListStudents.Items.Add(reader.GetInt32(0) + " | " +
                                       reader.GetString(1) + " | " +
                                       reader.GetString(2));
            }
            connection.Close();
        }
Example #3
0
 private void DeleteGradeClick(object sender, RoutedEventArgs e)
 {
     if (EmployerSession.IsPrincipal())
     {
         int index = ListStudents.SelectedIndex;
         if (index != -1)
         {
             ((Border)Parent).Child = new UserEmployerGradesOperator(studentIdList[index]);
         }
     }
 }
        private void AuthorizeClick(object sender, RoutedEventArgs e)
        {
            string tal = TextAuthorizationLogin.Text;
            string tap = TextAuthorizationPassword.Text;

            if (tal != "" && tap != "")
            {
                SqlConnection connection = new SqlConnection("Server=localhost\\SQLEXPRESS;Database=master;Trusted_Connection=True;");
                SqlCommand    command    = new SqlCommand("USE SchoolBase SELECT [Идентификатор], [Логин], [Пароль] FROM dbo.SchoolEmployees WHERE [Логин] = '" + tal + "' AND [Пароль] = '" + tap + "'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    if (reader.GetString(1) == tal && reader.GetString(2) == tap && EmployerSession.SetEmployer(reader.GetInt32(0)))
                    {
                        ((Border)Parent).Child = new UserEmployerMainMenu();
                        break;
                    }
                }
                connection.Close();
            }
        }
        public UserEmployerSchedule()
        {
            InitializeComponent();

            ScheduleListMonday             = new List <string>();
            ScheduleListTuesday            = new List <string>();
            ScheduleListWednesday          = new List <string>();
            ScheduleListThursday           = new List <string>();
            ScheduleListFriday             = new List <string>();
            ScheduleListSaturday           = new List <string>();
            IsEnabledScheduleOperator      = EmployerSession.IsPrincipal();
            GridScheduleOperatorVisibility = Visibility.Hidden;
            BorderClasses.Visibility       = EmployerSession.IsPrincipal() ? Visibility.Visible : Visibility.Hidden;

            BoxClasses.Items.Add("Выберите класс");
            BoxLessons.Items.Add("Выберите предмет");
            BoxClasses.SelectedIndex = 0;
            BoxLessons.SelectedIndex = 0;

            XmlDocument doc = new XmlDocument();

            doc.Load("E://Univers//Other//Work//C#//SomeFiles//1//WpfAppSchool//Lessons.xml");
            XmlElement xe = doc.DocumentElement;

            foreach (XmlNode node in xe.ChildNodes)
            {
                string ns = node.InnerText.Trim(new char[] { '\r', '\n', ' ' });
                BoxLessons.Items.Add(ns);
            }

            doc.Load("E://Univers//Other//Work//C#//SomeFiles//1//WpfAppSchool//ClassNumbers.xml");
            xe = doc.DocumentElement;
            foreach (XmlNode node in xe.ChildNodes)
            {
                string ns = node.InnerText.Trim(new char[] { '\r', '\n', ' ' });
                BoxClasses.Items.Add(ns);
            }
        }
 private void ActivateScheduler(object sender, RoutedEventArgs e)
 {
     GridScheduleOperatorVisibility = EmployerSession.IsPrincipal() ? Visibility.Visible : Visibility.Hidden;
 }
Example #7
0
 private void AddStudentClick(object sender, RoutedEventArgs e)
 {
     if (EmployerSession.IsPrincipal())
     {
     }
 }
 public UserEmployerMainMenu()
 {
     InitializeComponent();
     IsEnabledRegulator = EmployerSession.IsPrincipal();
 }