public StudentsGroupsManagementWindow(studentsgroup s) { InitializeComponent(); cur = s; Title = "Изменить группу"; NameTextBox.Text = s.Name; CourseTextBox.Text = s.Course.ToString(); DateInPicker.SelectedDate = s.DateIn; DateOutPicker.SelectedDate = s.DateOut; InitFaculties(); int idx = FacultiesComboBox.Items.IndexOf(s.department.faculty.Name); if (idx >= 0) FacultiesComboBox.SelectedIndex = idx; idx = DepartmentsComboBox.Items.IndexOf(s.department.Name); if (idx >= 0) DepartmentsComboBox.SelectedIndex = idx; SubjectList = (DBCollection)Resources["SubjectList"]; try { List<dynamic> lst = DBModel.Instance.GetSubjectsByGroupDynamic(cur.Name); foreach (var i in lst) SubjectList.Add(i); } catch (DBException ex) { Message.Show(ex.Message, MessageTypes.Error); } IsEdit = true; }
public void SetData(studentsgroup group) { this.isSet = true; this.StudentsGroup = group; ComboBox cb = (ComboBox)this.Template.FindName("cb_subject", this); if (cb == null) { return; } DateTime now = DateTime.Now; this.initDate = new DateTime(now.Year, now.Month, 1); this.SelectedDate = this.initDate; cb.Items.Clear(); foreach (ref_subject_group rsg in group.ref_subject_group) { cb.Items.Add(rsg.subject.FullName); } if (cb.Items.Count > 0) { cb.SelectedIndex = 0; } }
public StudentsGroupsManagementWindow() { InitializeComponent(); InitFaculties(); cur = new studentsgroup(); SubjectList = (DBCollection)Resources["SubjectList"]; Title = "Добавить группу"; }
public void ShowDefault(studentsgroup gr , List<lesson> fW,List<lesson> sW,DateTime fD) { fD = fD.AddDays(7); this.firstWeek = fW; this.secondWeek = sW; this.firstDay = fD; this.group = gr; this.lGroup.Content = this.group.Name; //this.wpStart.SetDisplayData(fD); //this.wpEnd.SetDisplayData(fD); this.wpStart.SetDateRange(fD); this.wpEnd.SetDateRange(fD); this.ShowDialog(); }
void GroupChosen(studentsgroup group) { this.firstGrid.Visibility = Visibility.Hidden; this.secondGrid.Visibility = Visibility.Visible; this.journal = new JournalTable { IsEditable = this.isEditable }; this.journal.OnClose += this.Handler_JournalClose; this.secondGrid.Children.Add(this.journal); this.journal.SetJournal(group); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if (!Check()) return; string sgName = NameTextBox.Text; string dName = DepartmentsComboBox.SelectedItem.ToString(); int course = Convert.ToInt32(CourseTextBox.Text); DateTime DateIn = DateInPicker.SelectedDate.Value; DateTime DateOut = DateOutPicker.SelectedDate.Value; try { if (IsEdit) { if (!DetectChanges()) { Close(); return; } DBController.Instance.EditStudentGroup(cur.Name, sgName, dName, DateIn, DateOut, course); cur = DBModel.Instance.FindStudentGroup(sgName); UpdateSubjects(); Message.Show("Изменения успешно внесены", MessageTypes.Information); Close(); } else { DBController.Instance.AddStudentGroup(sgName, dName, DateIn, DateOut, course); cur = DBModel.Instance.FindStudentGroup(sgName); UpdateSubjects(); Message.Show("Группа добавлена", MessageTypes.Information); Close(); } } catch (DBException ex) { Message.Show(ex.Message, MessageTypes.Error); } }
public void ShowWithScheduleDay(ScheduleDay day, studentsgroup group, DateTime fd) { this.currentGroup = group; this.lGroup.Content = group.Name; this.firstDay = fd; this.cbWeek.SelectedIndex = day.Date.Date >= fd.Date.AddDays(7) ? 1 : 0; this.cbDay.SelectedIndex = (int)day.Date.DayOfWeek - 1; this.ShowDialog(); }
public void EditStudentGroup(studentsgroup s, string newName, department d, DateTime dateIn, DateTime dateOut, int course) { CheckConnection(); try { lock (locker) { s.Name = newName; s.DepartmentId = d.Id; s.DateIn = dateIn; s.DateOut = dateOut; s.Course = course; db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
/// <summary> /// Deprecated Method for adding a new object to the studentsgroups EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTostudentsgroups(studentsgroup studentsgroup) { base.AddObject("studentsgroups", studentsgroup); }
/// <summary> /// Create a new studentsgroup object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="course">Initial value of the Course property.</param> /// <param name="departmentId">Initial value of the DepartmentId property.</param> /// <param name="dateIn">Initial value of the DateIn property.</param> /// <param name="dateOut">Initial value of the DateOut property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static studentsgroup Createstudentsgroup(global::System.Int64 id, global::System.String name, global::System.Int32 course, global::System.Int64 departmentId, global::System.DateTime dateIn, global::System.DateTime dateOut, global::System.Boolean isDeleted) { studentsgroup studentsgroup = new studentsgroup(); studentsgroup.Id = id; studentsgroup.Name = name; studentsgroup.Course = course; studentsgroup.DepartmentId = departmentId; studentsgroup.DateIn = dateIn; studentsgroup.DateOut = dateOut; studentsgroup.IsDeleted = isDeleted; return studentsgroup; }
public void DeleteStudentGroups(studentsgroup s) { CheckConnection(); try { lock (locker) { s.IsDeleted = true; foreach (var i in s.students) DeleteStudent(i); foreach (var i in s.ref_subject_group) db.ref_subject_group.DeleteObject(i); db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public void EditStudent(student std, studentsgroup sg, person p, DateTime dateIn, DateTime? dateOut = null) { CheckConnection(); try { lock (locker) { EditPerson(std.person, p.First_Name, p.Last_Name, p.Middle_Name, p.Birthday, p.H_Phone, p.M_Phone, p.Address, p.Email, p.SomeInformation, p.Photo); std.GroupId = sg.Id; std.DateIn = dateIn; std.DateOut = dateOut; db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public student AddStudent(user usr, studentsgroup sg, person p, DateTime dateIn, DateTime? dateOut = null) { CheckConnection(); try { lock (locker) { EditPerson(usr.person, p.First_Name, p.Last_Name, p.Middle_Name, p.Birthday, p.H_Phone, p.M_Phone, p.Address, p.Email, p.SomeInformation, p.Photo); student std = student.Createstudent(0, usr.person.Id, sg.Id, dateIn); std.DateOut = dateOut; db.students.AddObject(std); db.SaveChanges(); return std; } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public ref_subject_group FindSubjectOfGroup(studentsgroup gr, subject s) { CheckConnection(); try { lock (locker) { return db.ref_subject_group.FirstOrDefault(i => i.GroupId == gr.Id && i.SubjectId == s.Id); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public void AddSubjectToGroup(studentsgroup gr, subject s) { CheckConnection(); try { lock (locker) { ref_subject_group r = ref_subject_group.Createref_subject_group(0, gr.Id, s.Id); db.ref_subject_group.AddObject(r); db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public void SetJournal(studentsgroup gr) { this.RemoveJournal(); this.grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); int cnt = gr.students.Count; for (int i = 0; i < cnt + 1; i++) { this.grid1.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); } this.tableHeader = new JournalTableHeader(); this.tableHeader.OnSelectedSubjectChanged += this.Handler_SelectedSubjectChanged; this.tableHeader.OnSelectedMonthChanged += this.Handler_SelectedMonthChanged; Grid.SetColumn(this.tableHeader, 0); Grid.SetRow(this.tableHeader, 0); this.grid1.Children.Add(this.tableHeader); this.tableHeader.SetData(gr); var coll = from s in gr.students orderby s.person.Last_Name select s; int num = 0; foreach (var st in coll) { JournalRowHeader rh = new JournalRowHeader(); rh.SetData(st); this.rowHeaders.Add(rh); Grid.SetColumn(rh, 0); Grid.SetRow(rh, ++num); this.grid1.Children.Add(rh); } this.tbTopic.IsReadOnly = !this.IsEditable; this.tbTask.IsReadOnly = !this.IsEditable; this.btnTask.IsEnabled = this.IsEditable; this.btnTopic.IsEnabled = this.IsEditable; }
public void AddChoosedGroup(studentsgroup g) { isEdit = true; ChoosedGroups.Add(g); CopyChoosedGroups(); }
public void ShowDefault(IMS.Database.studentsgroup gr, DateTime fd) { this.currentGroup = gr; this.lGroup.Content = gr.Name; this.firstDay = fd; this.cbWeek.SelectedIndex = 0; this.cbDay.SelectedIndex = 0; this.ShowDialog(); }