コード例 #1
0
 private void CbxClass_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CbxClass.SelectedItem != null)
     {
         using (SampleDataContext db = new SampleDataContext())
         {
             schedule = db.HeaderSchedules.Where(s => s.ClassName == CbxClass.SelectedItem.ToString()).FirstOrDefault();
             kelas    = db.Classes.Where(c => c.ClassName == CbxClass.SelectedItem.ToString()).FirstOrDefault();
             CbxSubject.Items.Clear();
             GetSubject();
         }
         if (schedule.Finalize == 1)
         {
             va.DisableAllControls();
             CbxClass.Enabled    = true;
             CbxDay.Enabled      = true;
             DGVSchedule.Enabled = true;
         }
         else if (schedule.Finalize == 0)
         {
             va.EnableAllControls();
             BtnSave.Visible    = false;
             BtnCancel.Visible  = false;
             CbxShift.Enabled   = false;
             CbxTeacher.Enabled = false;
             CbxSubject.Enabled = false;
         }
     }
 }
コード例 #2
0
 private void BtnFinalize_Click(object sender, EventArgs e)
 {
     using (SampleDataContext db = new SampleDataContext())
     {
         HeaderSchedule schedule = db.HeaderSchedules.Where(hs => hs.ScheduleId == this.schedule.ScheduleId).FirstOrDefault();
         if (GlobalUse.GetChoiceMessage("Are you sure you want to finalize?") == true)
         {
             schedule.Finalize = 1;
             db.SubmitChanges();
             if (schedule.Finalize == 1)
             {
                 BtnFinalize.Enabled = false;
             }
             else if (schedule.Finalize == 0)
             {
                 BtnFinalize.Enabled = true;
             }
         }
     }
 }
コード例 #3
0
        private void CbxClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (CbxClass.SelectedItem != null)
            {
                using (SampleDataContext db = new SampleDataContext())
                {
                    schedule = db.HeaderSchedules.Where(s => s.ClassName == CbxClass.SelectedItem.ToString()).FirstOrDefault();
                    kelas    = db.Classes.Where(c => c.ClassName == CbxClass.SelectedItem.ToString()).FirstOrDefault();
                }

                RefreshDGV();
                if (schedule.Finalize == 1)
                {
                    BtnFinalize.Enabled = false;
                }
                else if (schedule.Finalize == 0)
                {
                    BtnFinalize.Enabled = true;
                }
            }
        }