コード例 #1
0
 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;
 }
コード例 #2
0
        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;
            }

        }
コード例 #3
0
 public StudentsGroupsManagementWindow()
 {
     InitializeComponent();
     InitFaculties();
     cur = new studentsgroup();
     SubjectList = (DBCollection)Resources["SubjectList"];
     Title = "Добавить группу";
 }
コード例 #4
0
 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();
 }
コード例 #5
0
ファイル: WorkPanelJournal.xaml.cs プロジェクト: Deiwos3/IMS
 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);
 }
コード例 #6
0
 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);
     }
 }
コード例 #7
0
ファイル: EditSchedule.xaml.cs プロジェクト: Deiwos3/IMS
        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();

        }
コード例 #8
0
ファイル: DBModel.cs プロジェクト: Deiwos3/IMS
 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);
     }
 }
コード例 #9
0
ファイル: DatabaseModel.Designer.cs プロジェクト: Deiwos3/IMS
 /// <summary>
 /// Deprecated Method for adding a new object to the studentsgroups EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTostudentsgroups(studentsgroup studentsgroup)
 {
     base.AddObject("studentsgroups", studentsgroup);
 }
コード例 #10
0
ファイル: DatabaseModel.Designer.cs プロジェクト: Deiwos3/IMS
 /// <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;
 }
コード例 #11
0
ファイル: DBModel.cs プロジェクト: Deiwos3/IMS
 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);
     }
 }
コード例 #12
0
ファイル: DBModel.cs プロジェクト: Deiwos3/IMS
 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);
     }
 }
コード例 #13
0
ファイル: DBModel.cs プロジェクト: Deiwos3/IMS
 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);
     }
 }
コード例 #14
0
ファイル: DBModel.cs プロジェクト: Deiwos3/IMS
 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);
     }
 }
コード例 #15
0
ファイル: DBModel.cs プロジェクト: Deiwos3/IMS
 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);
     } 
 }
コード例 #16
0
ファイル: JournalTable.xaml.cs プロジェクト: Deiwos3/IMS
        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;

        }
コード例 #17
0
ファイル: ChooseGroupWindow.xaml.cs プロジェクト: Deiwos3/IMS
 public void AddChoosedGroup(studentsgroup g)
 {
     isEdit = true;
     ChoosedGroups.Add(g);
     CopyChoosedGroups();
 }
コード例 #18
0
ファイル: EditSchedule.xaml.cs プロジェクト: Deiwos3/IMS
 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();
 }