コード例 #1
0
        private void btnSaveWeeklyControl_Click(object sender, EventArgs e)
        {
            WeeklyControl weeklyControl = new WeeklyControl();

            weeklyControl.WeekName = txtWeeklyControlName.Text;

            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                CheckState checkState = checkedListBox1.GetItemCheckState(i);
                var        student    = checkedListBox1.Items[i];
                var        subItem    = new WeeklyControlSubItem();

                subItem.Student       = (Student)student;
                subItem.WeeklyControl = weeklyControl;


                if (checkState == CheckState.Checked)
                {
                    subItem.IsControl = true;
                }
                else
                {
                    subItem.IsControl = false;
                }
                weeklySubItemRepository.AddWeeklyControlSubItem(subItem);
            }

            MessageBox.Show("Kaydedildi");
        }
コード例 #2
0
        private void listBoxWeek_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            selectedWeek = (WeeklyControl)listBoxWeek.SelectedItem;
            var addWeeklycontrolsubitem = new AddWeeklyControlSubItem();

            addWeeklycontrolsubitem.OpenWithWeeklyControl(selectedWeek);
        }
コード例 #3
0
        private void btnSaveWeek_Click(object sender, EventArgs e)
        {
            var weekName = txtWeekName.Text;

            if (string.IsNullOrWhiteSpace(weekName))
            {
                MessageBox.Show("Hafta Adını boş bırakmayınız");
            }
            else
            {
                if (!isUpdate)
                {
                    control          = new WeeklyControl();
                    control.WeekName = weekName;
                    control.Lessson  = lesson;
                    weeklyControlRepository.AddWeeklyControl(control);
                    MessageBox.Show("Kaydedildi");
                }
                else
                {
                    if (control != null)
                    {
                        control.WeekName = weekName;
                        weeklyControlRepository.UpdateWeeklyControl(control);
                        MessageBox.Show("Güncellendi");
                    }
                }
            }
        }
コード例 #4
0
 public void OpenInEdit(WeeklyControl weeklyControl)
 {
     this.control          = weeklyControl;
     this.isUpdate         = true;
     txtWeekName.Text      = control.WeekName;
     this.btnSaveWeek.Text = "Güncelle";
     this.ShowDialog();
 }
コード例 #5
0
        public void UpdateWeeklyControl(WeeklyControl weeklyControl)
        {
            var setWeek = GetById(weeklyControl.Id);

            if (setWeek != null)
            {
                setWeek.WeekName = weeklyControl.WeekName;
                context.SaveChanges();
            }
        }
コード例 #6
0
 public void OpenWithWeeklyControl(WeeklyControl control)
 {
 }
コード例 #7
0
 public void AddWeeklyControl(WeeklyControl weeklyControl)
 {
     context.WeeklyControls.Add(weeklyControl);
     context.Entry(weeklyControl.Lessson).State = EntityState.Unchanged;
     context.SaveChanges();
 }