private void InitializeDataSets() { double pointsUsed = 0d; try { //cbGroup List <Group> groups = DataService.SelectGroupsByTeacherId(Session.GetCurrentSession().ID); DataSetInitializer.ComboBoxDataSetInitializer <Group>(ref cbGroups, groups, "id", "name"); //cbDiscipline List <Discipline> disciplines = DataService.SelectDisciplinesByTeacherIdAndGroupId(Session.GetCurrentSession().ID, (uint)cbGroups.SelectedValue); DataSetInitializer.ComboBoxDataSetInitializer <Discipline>(ref cbDiscipline, disciplines, "id", "full_name"); //dgvStudents dataset mainDataGridViewFactory.CreateStudentCPsDataGridView(ref dgvStudents, (uint)cbGroups.SelectedValue, (uint)cbDiscipline.SelectedValue, out isReexamCommited); //insert certification if (dgvStudents.Columns.Count != 0) { mainDataGridViewFactory.InsertCertifications(ref dgvStudents, (uint)cbGroups.SelectedValue, (uint)cbDiscipline.SelectedValue, out certificationIndexes); } pointsUsed = DataService.GetSumOfPointsUsed((uint)cbGroups.SelectedValue, (uint)cbDiscipline.SelectedValue); } catch (Exception ex) { logger.Error(ex); //MessageBox.Show("Произошла ошибка при инициализации набора данных.", "Произошла ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } //tsslTeacherName tsslTeacherName.Text = Session.GetCurrentSession().UserName; BlockCreation(pointsUsed); }
private void PrintListOfGroupDiscipline() { try { List <Discipline> disciplines = DataService.SelectDisciplinesByTeacherIdAndGroupId(Session.GetCurrentSession().ID, ((Group)lbGroups.SelectedItem).id); DataSetInitializer.lbDataSetInitialize <Discipline>(ref lbDisciplines, disciplines, "id", "full_name"); } catch (Exception ex) { logger.Error(ex); } }
private void DSRefresh() { try { List <ControlPointTemplate> templates = DataService.SelectUserControlPointsTemplate(disciplineID, Session.GetCurrentSession().ID); DataSetInitializer.clbDataSetInitialize <ControlPointTemplate>(ref clbTemplates, templates, "id", "GetFormatedString"); } catch (Exception ex) { logger.Error(ex); } }
private void DataSetsInitializer(uint groupID, uint disciplineID) { try { List <StudentCertification> certifications = DataService.SelectStudentsCertifications(groupID, disciplineID).GroupBy(d => d.date).Select(c => c.First()).ToList(); DataSetInitializer.lbDataSetInitialize <StudentCertification>(ref lbListOfCerts, certifications, "date", "date"); } catch (Exception ex) { logger.Error(ex); } }
private void txtDisciplinesFilter_TextChanged(object sender, EventArgs e) { DataSetInitializer.lbDataSetInitialize <Discipline>(ref lbGroups, originDisciplinesList, "id", "full_name"); List <Discipline> tempDisciplines = (List <Discipline>)lbDisciplines.DataSource; if (string.IsNullOrWhiteSpace(txtDisciplinesFilter.Text)) { return; } tempDisciplines = tempDisciplines.Where(x => x.name.ToLower().StartsWith(txtDisciplinesFilter.Text.ToLower())).ToList(); DataSetInitializer.lbDataSetInitialize <Discipline>(ref lbGroups, tempDisciplines, "id", "full_name"); }
private void InitializeDataSets() { try { List <Group> teacherGroups = originGroupsList = DataService.SelectGroupsByTeacherId(Session.GetCurrentSession().ID); DataSetInitializer.lbDataSetInitialize <Group>(ref lbGroups, teacherGroups, "id", "name"); List <Discipline> disciplines = originDisciplinesList = DataService.SelectDisciplinesByTeacherIdAndGroupId(Session.GetCurrentSession().ID, ((Group)lbGroups.SelectedItem).id); DataSetInitializer.lbDataSetInitialize <Discipline>(ref lbDisciplines, disciplines, "id", "full_name"); } catch (Exception ex) { logger.Error(ex); } }
private void InitializeDataSets() { Clear(); try { List <UserInfo> teacherInfos = DataService.SelectAllUsers(); SetHeadersAllias(); DataSetInitializer.dgvDataSetInitializer <UserInfo>(ref dgvTeachers, teacherInfos, allias, new int[] { 0, 3 }, new string[] { "Name" }); } catch (Exception ex) { logger.Error(ex); } }
private void InitializeDataSets() { List <ParserEntity> cpyParsedData = parsedDataList; var @switch = new Dictionary <Type, Action> { { typeof(ParsedDiscipline), () => DataSetInitializer.dgvDataSetInitializer <ParsedDiscipline>(ref dgvPreviewData, cpyParsedData.OfType <ParsedDiscipline>().ToList()) }, { typeof(ParsedStudent), () => DataSetInitializer.dgvDataSetInitializer <ParsedStudent>(ref dgvPreviewData, cpyParsedData.OfType <ParsedStudent>().ToList()) }, { typeof(ParsedTeacher), () => DataSetInitializer.dgvDataSetInitializer <ParsedTeacher>(ref dgvPreviewData, cpyParsedData.OfType <ParsedTeacher>().ToList()) }, }; dgvPreviewData.AutoGenerateColumns = true; @switch[cpyParsedData[0].GetTypeOfData()](); }
private void IntializeDataSets(uint disciplineID) { try { sumOfUsedPoints = DataService.GetSumOfPointsUsed(groupID, disciplineID); pointsLeft -= sumOfUsedPoints; List <ControlPointTemplate> templates = DataService.SelectUserControlPointsTemplate(disciplineID, Session.GetCurrentSession().ID); DataSetInitializer.clbDataSetInitialize <ControlPointTemplate>(ref clbTemplates, templates, "id", "GetFormatedString"); } catch (Exception ex) { logger.Error(ex); } }
private void InitializeDataSets() { try { List <DisciplineInfo> disciplines = DataService.SelectAllDisciplinesInfo(); originDisciplineList = disciplines; SetHeadersAllias(); DataSetInitializer.dgvDataSetInitializer <DisciplineInfo>(ref dgvDisciplines, disciplines, allias, new int[] { 0, 3 }, new string[] { "name" }); } catch (Exception ex) { logger.Error(ex); } }
private void InitializeDataSets() { try { List <GroupInfo> groupsInfo = DataService.SelectAllGroupsInfo(); originGroupList = groupsInfo; SetHeadersAllias(); DataSetInitializer.dgvDataSetInitializer <GroupInfo>(ref dgvGroups, groupsInfo, allias, new int[] { 0 }, new string[] { "name" }); } catch (Exception ex) { logger.Error(ex); } }
private void btnAddFilter_Click(object sender, EventArgs e) { List<StudentInfo> tempListStudents = (List<StudentInfo>)dgvStudents.DataSource; if (originStudentsList == null) originStudentsList = (List<StudentInfo>)dgvStudents.DataSource; if (((GroupInfo)cbGroupFilter.SelectedItem).name != null) tempListStudents = tempListStudents.Where(x => x.group_name == ((GroupInfo)cbGroupFilter.SelectedItem).name).ToList(); if (!string.IsNullOrWhiteSpace(txtStudentName.Text)) tempListStudents = tempListStudents.Where(x => x.name.StartsWith(txtStudentName.Text)).ToList(); DataSetInitializer.dgvDataSetInitializer<StudentInfo>(ref dgvStudents, tempListStudents, allias, new int[] { 0, 3 }, new string[] { "name" }); }
private void btnAddFilter_Click(object sender, EventArgs e) { List <DisciplineInfo> tempList = (List <DisciplineInfo>)dgvDisciplines.DataSource; if (!string.IsNullOrWhiteSpace(txtNameFilter.Text)) { tempList = tempList.Where(x => x.name.StartsWith(txtNameFilter.Text)).ToList(); } if (!string.IsNullOrWhiteSpace(txtSemesterFilter.Text)) { tempList = tempList.Where(x => x.semestr == int.Parse(txtSemesterFilter.Text)).ToList(); } DataSetInitializer.dgvDataSetInitializer <DisciplineInfo>(ref dgvDisciplines, tempList, allias, new int[] { 0, 3 }, new string[] { "name" }); }
private void txtGroupsFilter_TextChanged(object sender, EventArgs e) { DataSetInitializer.clbDataSetInitialize <GroupInfo>(ref clbGroups, clbGroupsDataSource, "id", "name"); CheckAlreadyAttachedGroups(clbGroupsDataSource); List <GroupInfo> groups = new List <GroupInfo>(); foreach (GroupInfo item in clbGroups.Items) { if (item.name.Contains(txtGroupsFilter.Text)) { groups.Add(item); } } DataSetInitializer.clbDataSetInitialize <GroupInfo>(ref clbGroups, groups, "id", "name"); CheckAlreadyAttachedGroups(groups); }
private void RemoveGroup() { try { if (DataService.DeleteGroupBindingsTransact(lbDisciplines.Items.Cast <Discipline>().ToList(), Session.GetCurrentSession().ID, ((Group)lbGroups.SelectedItem).id)) { List <Group> tempList = lbGroups.Items.Cast <Group>().ToList(); tempList.RemoveAt(lbGroups.SelectedIndex); DataSetInitializer.lbDataSetInitialize <Group>(ref lbGroups, tempList, "id", "name"); } } catch (Exception ex) { logger.Error(ex); } }
private void dataSetInitializer(uint groupID, uint disciplineID) { try { List <StudentControlPoint> controlPoints = DataService.SelectStudentControPointsGroupDisc(groupID, disciplineID, MainLib.Session.Session.GetCurrentSession().ID) .GroupBy(g => g.id_of_controlPoint) .Select(s => s.First()) .ToList(); GenerateControlPointEntityspseudonyms(ref controlPoints); DataSetInitializer.ComboBoxDataSetInitializer <StudentControlPoint>(ref cbPrevCP, controlPoints, "id_of_controlPoint", "pseudonym"); } catch (Exception ex) { logger.Error(ex); } }
private void InitializeDataSets() { try { clbGroupsDataSource = DataService.SelectAllGroupsInfo(); DataSetInitializer.clbDataSetInitialize <GroupInfo>(ref clbGroups, clbGroupsDataSource, "id", "name"); CheckAlreadyAttachedGroups(clbGroupsDataSource); List <DisciplineInfo> disciplinesInfo = DataService.SelectAllDisciplinesInfo(); DataSetInitializer.ComboBoxDataSetInitializer <DisciplineInfo>(ref cbDisciplines, disciplinesInfo, "id", "disciplineFullName"); } catch (Exception ex) { statusLabel.Text = "Возникла необработанная ошибка."; logger.Error(ex); } }
private void btnAddFilter_Click(object sender, EventArgs e) { if (originListOfUsers == null) { originListOfUsers = (List <UserInfo>) this.dgvTeachers.DataSource; } if (isFiltered) { dgvTeachers.DataSource = originListOfUsers; isFiltered = false; } List <UserInfo> tempList = ((List <UserInfo>) this.dgvTeachers.DataSource).Where(x => x.Name.StartsWith(txtStudentName.Text)).ToList(); DataSetInitializer.dgvDataSetInitializer <UserInfo>(ref dgvTeachers, tempList, allias, new int[] { 0, 3 }, new string[] { "Name", "isAdmin" }); isFiltered = true; }
private void btnAddFilter_Click(object sender, EventArgs e) { List <GroupInfo> tempList = (List <GroupInfo>)dgvGroups.DataSource; if (!string.IsNullOrWhiteSpace(txtNameFilter.Text)) { if (!chkbIsContains.Checked) { tempList = tempList.Where(x => x.name.StartsWith(txtNameFilter.Text)).ToList(); } else { tempList = tempList.Where(x => x.name.Contains(txtNameFilter.Text)).ToList(); } } if (!string.IsNullOrWhiteSpace(txtCourseFilter.Text)) { tempList = tempList.Where(x => x.course == int.Parse(txtCourseFilter.Text)).ToList(); } DataSetInitializer.dgvDataSetInitializer <GroupInfo>(ref dgvGroups, tempList, allias, new int[] { 0 }, new string[] { "name" }); }
private void InitializeDataSets(object selectedDisciplineValue) { try { List <Discipline> disciplines = DataService.SelectDisciplinesByTeacherIdAndGroupId(Session.GetCurrentSession().ID, groupId); DataSetInitializer.ComboBoxDataSetInitializer <Discipline>(ref cbDiscipline, disciplines, "id", "full_name"); cbDiscipline.SelectedValue = selectedDisciplineValue; if (currentType == FormType.cp_creation) { sumOfUsedPoints = DataService.GetSumOfPointsUsed(groupId, (uint)selectedDisciplineValue); tsslPointsLeft.Text = string.Format("{0} {1} баллов", tsslPointsLeft.Text, sumOfUsedPoints.ToString()); } } catch (Exception ex) { logger.Error(ex); MessageBox.Show("Произошла ошибка при инициализации набора данных.", "Произошла ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } //if (selectedDiscipline != null) // cbDiscipline.SelectedItem = selectedDiscipline; }
private void InitializeDataSets() { try { List<StudentInfo> students = DataService.SelectAllStudentsInfo(); SetHeadersAllias(); DataSetInitializer.dgvDataSetInitializer<StudentInfo>(ref dgvStudents, students, allias, new int[] { 0, 3 }, new string[] { "name" }); if (!isDSInitialized) { List<GroupInfo> groups = DataService.SelectAllGroupsInfo(); DataSetInitializer.ComboBoxDataSetInitializer<GroupInfo>(ref cbGroup, groups, "id", "name"); DataSetInitializer.ComboBoxDataSetInitializer<GroupInfo>(ref cbGroupFrom, new List<GroupInfo>(groups), "id", "name"); DataSetInitializer.ComboBoxDataSetInitializer<GroupInfo>(ref cbGroupTo, new List<GroupInfo>(groups), "id", "name"); groups.Insert(0, new GroupInfo() { }); DataSetInitializer.ComboBoxDataSetInitializer<GroupInfo>(ref cbGroupFilter, new List<GroupInfo>(groups), "id", "name"); isDSInitialized = true; } } catch (Exception ex) { logger.Error(ex); } }
private void btnResetFilter_Click(object sender, EventArgs e) { DataSetInitializer.dgvDataSetInitializer <GroupInfo>(ref dgvGroups, originGroupList, allias, new int[] { 0 }, new string[] { "name" }); }
private void btnResetFilter_Click(object sender, EventArgs e) { DataSetInitializer.dgvDataSetInitializer <UserInfo>(ref dgvTeachers, originListOfUsers, allias, new int[] { 0, 3 }, new string[] { "Name" }); }
private void btnResetFilter_Click(object sender, EventArgs e) { DataSetInitializer.dgvDataSetInitializer<StudentInfo>(ref dgvStudents, originStudentsList, allias, new int[] { 0, 3 }, new string[] { "name" }); }