Ejemplo n.º 1
0
        private void SearchBoxKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (searchBox.SelectedValue == null)
                {
                    return;
                }

                var keyword = ((string)searchBox.SelectedValue).Split('@')[0];
                var id      = int.Parse(((string)searchBox.SelectedValue).Split('@')[1]);

                switch (keyword)
                {
                case "student":
                    var studentDetailsForm = new StudentProperties(this, id, StudentDetailsMode.Edit, ApiEndpoint);
                    studentDetailsForm.Show();
                    Height = 85;
                    Width  = 670;
                    break;

                case "studentGroup":
                    var groupStudents = sRepo
                                        .groupAll(id)
                                        .Select(sig => new Student(sig))
                                        .OrderBy(s => s.expelled)
                                        .ThenBy(s => s.f)
                                        .ThenBy(s => s.i)
                                        .ToList();
                    viewGrid.DataSource = groupStudents;
                    FormatGroupView();
                    Height = 540;
                    Width  = 1090;
                    break;
                }

                Left = (Screen.PrimaryScreen.Bounds.Width - Width) / 2;
                Top  = (Screen.PrimaryScreen.Bounds.Height - Height) / 2;
            }

            if (e.KeyCode == Keys.Escape)
            {
                Close();
            }
        }
Ejemplo n.º 2
0
        private void EditToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (viewGrid.SelectedCells.Count == 0)
            {
                return;
            }

            var studentId = (int)viewGrid.Rows[viewGrid.SelectedCells[0].RowIndex].Cells["id"].Value;
            var groupName = searchBox.Text;

            var studentDetailsForm = new StudentProperties(this, studentId, StudentDetailsMode.Edit, ApiEndpoint);
            var result             = studentDetailsForm.ShowDialog();

            searchBox.Text = groupName;
            if (result == DialogResult.OK)
            {
                SearchBoxKeyDown(this, new KeyEventArgs(Keys.Enter));
            }
        }
Ejemplo n.º 3
0
        private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var studentDetailsForm = new StudentProperties(this, 0, StudentDetailsMode.New, ApiEndpoint);

            studentDetailsForm.Show();
        }