Exemple #1
0
 public GroupPeriodView(CustomStudentGroupAttribute attr)
 {
     CustomStudentGroupAttributeId = attr.CustomStudentGroupAttributeId;
     var valueParts = attr.Value.Split('@');
     StudentGroup = attr.StudentGroup.Name;
     Name = valueParts[0];
     Start = valueParts[1];
     End = valueParts[2];
 }
Exemple #2
0
        private void add_Click(object sender, EventArgs e)
        {
            var newPeriod = new CustomStudentGroupAttribute
            {
                StudentGroup = _repo.StudentGroups.GetStudentGroup((int)Group.SelectedValue),
                Key = "StudentGroupPeriod",
                Value = PeriodName.Text + "@" + startOfPeriod.Value.ToString("dd.MM.yyyy") + "@" + endOfPeriod.Value.ToString("dd.MM.yyyy") +
                    "@" + (noLessonsPeriod.Checked ? "+" : "-")
            };

            _repo.CustomStudentGroupAttributes
                .AddCustomStudentGroupAttribute(newPeriod);

            RefreshView();
        }
        private void add_Click(object sender, EventArgs e)
        {
            var groupItems = _repo
                .CustomStudentGroupAttributes
                .GetFiltredCustomStudentGroupAttributes(csga => csga.StudentGroup.StudentGroupId == (int)group.SelectedValue);

            if (groupItems.Count != 0)
            {
                MessageBox.Show("Эта группа уже есть.", "Ошибка", MessageBoxButtons.OK);

                return;
            }

            var newBuildingAttribute = new CustomStudentGroupAttribute
            {
                StudentGroup = (StudentGroup)group.SelectedItem,
                Key = "Building",
                Value = ((int)building.SelectedValue).ToString(CultureInfo.InvariantCulture)
            };
            _repo
                .CustomStudentGroupAttributes
                .AddOrUpdateCustomStudentGroupAttribute(newBuildingAttribute);

            var newAuditoriumAttrbute = new CustomStudentGroupAttribute
            {
                StudentGroup = (StudentGroup)group.SelectedItem,
                Key = "Auditorium",
                Value = ((int)auditorium.SelectedValue).ToString(CultureInfo.InvariantCulture)
            };
            _repo
                .CustomStudentGroupAttributes
                .AddOrUpdateCustomStudentGroupAttribute(newAuditoriumAttrbute);

            var newShiftAttrbute = new CustomStudentGroupAttribute
            {
                StudentGroup = (StudentGroup)group.SelectedItem,
                Key = "Shift",
                Value = ((int)shift.SelectedValue).ToString(CultureInfo.InvariantCulture)
            };
            _repo
                .CustomStudentGroupAttributes
                .AddOrUpdateCustomStudentGroupAttribute(newShiftAttrbute);

            RefreshView();
        }
        private void update_Click(object sender, EventArgs e)
        {
            if (itemsListView.SelectedCells.Count > 0)
            {
                var newBuildingAttribute = new CustomStudentGroupAttribute
                {
                    StudentGroup = (StudentGroup)group.SelectedItem,
                    Key = "Building",
                    Value = ((int)building.SelectedValue).ToString(CultureInfo.InvariantCulture)
                };
                _repo
                    .CustomStudentGroupAttributes
                    .AddOrUpdateCustomStudentGroupAttribute(newBuildingAttribute);

                var newAuditoriumAttrbute = new CustomStudentGroupAttribute
                {
                    StudentGroup = (StudentGroup)group.SelectedItem,
                    Key = "Auditorium",
                    Value = ((int)auditorium.SelectedValue).ToString(CultureInfo.InvariantCulture)
                };
                _repo
                    .CustomStudentGroupAttributes
                    .AddOrUpdateCustomStudentGroupAttribute(newAuditoriumAttrbute);

                var newShiftAttrbute = new CustomStudentGroupAttribute
                {
                    StudentGroup = (StudentGroup)group.SelectedItem,
                    Key = "Shift",
                    Value = ((int)shift.SelectedValue).ToString(CultureInfo.InvariantCulture)
                };
                _repo
                    .CustomStudentGroupAttributes
                    .AddOrUpdateCustomStudentGroupAttribute(newShiftAttrbute);

                RefreshView();
            }
        }