private void FrmTambahJadwalPraktikan_Load(object sender, EventArgs e)
        {
            var service = new IadmClient( );

            var periode = service.viewPeriode().FirstOrDefault(
                x =>
                service.ServerTime() >= x.awalSemester &&
                service.ServerTime() <= x.akhirSemester);

            var data = new jadwal_umum( )
            {
                id_periode = periode.id_periode
            };

            gridControl1.DataSource = service.ViewJadwalUmum(data).Select(x => new {
                HARI  = x.hari,
                SHIFT = x.fk_jadwalUmum_Shift.id_shift,
                WAKTU =
                    string.Format("{0:HH:mm} - {1:HH:mm}",
                                  x.fk_jadwalUmum_Shift.mulai,
                                  x.fk_jadwalUmum_Shift.selesai),
                PRAKTIKUM = x.fk_jadwalUmum_matakuliah.mata_kuliah,
                KELAS     = x.fk_jadwalUmum_kelas.Kelas
            });

            // add checkbox and enable multi select rows
            gridView1.OptionsSelection.MultiSelect     = true;
            gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
            // disable focused row and move column
            for (var i = 0; i < gridView1.Columns.Count; i++)
            {
                gridView1.Columns[i].OptionsColumn.AllowFocus = false;
                gridView1.Columns[i].OptionsColumn.AllowMove  = false;
            }
        }
Exemplo n.º 2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            var service = new IadmClient();
            var periode = service.viewPeriode().ToList()
                          .FirstOrDefault(x => x.awalSemester <service.ServerTime() &&
                                                               x.akhirSemester> service.ServerTime());
            var praktikum = comboBoxEdit4.SelectedItem.ToString();
            var shift     = comboBoxEdit3.SelectedItem.ToString();
            var periodeID = new jadwal_umum()
            {
                id_periode = periode.id_periode
            };
            var jadwal = service.ViewJadwalUmum(periodeID).ToList()
                         .FirstOrDefault(x => x.fk_jadwalUmum_Shift.id_shift == shift &&
                                         x.fk_jadwalUmum_matakuliah.mata_kuliah == praktikum &&
                                         x.hari == comboBoxEdit2.SelectedItem.ToString());

            bool errorMessage = false;

            try
            {
                List <jadwalStaff> j = new List <jadwalStaff>();
                var data             = new jadwalStaff()
                {
                    staff = new Staff()
                    {
                        id_staff = comboBoxEdit1.SelectedItem.ToString()
                    },
                    jadwal_umum = new jadwal_umum()
                    {
                        id_jadwal_umum = jadwal.id_jadwal_umum
                    }
                };
                j.Add(data);
                service.AddJadwalStaffAsisten(j.ToArray());
                service.Close();
            }
            catch (Exception)
            {
                errorMessage = true;
                XtraMessageBox.Show("Tidak ada praktikum " + praktikum + " shift " + shift + " hari " + comboBoxEdit2.SelectedItem.ToString());
            }

            if (errorMessage == false)
            {
                Close();
            }
        }
        private void TambahJadwalPraktikan(object sender, EventArgs e)
        {
            var service = new IadmClient( );
            var jadwal  = new List <jadwalPraktikan>( );
            var values  = gridView1.GetSelectedRows( );
            var periode = service.viewPeriode( ).FirstOrDefault(
                x =>
                service.ServerTime() >= x.awalSemester &&
                service.ServerTime() <= x.akhirSemester);
            var data = new jadwal_umum( )
            {
                id_periode = periode.id_periode
            };

            var listjadwal = new List <jadwalPraktikan>( );

            for (var i = 0; i < values.Count( ); i++)
            {
                var shift  = gridView1.GetRowCellValue(values[i], gridView1.Columns[1]).ToString( );
                var hari   = gridView1.GetRowCellValue(values[i], gridView1.Columns[0]).ToString( );
                var matkul = gridView1.GetRowCellValue(values[i], gridView1.Columns[3]).ToString( );
                var id     = service.ViewJadwalUmum(data).FirstOrDefault(x =>
                                                                         (x.fk_jadwalUmum_Shift.id_shift == shift && x.hari == hari) &&
                                                                         x.fk_jadwalUmum_matakuliah.mata_kuliah == matkul);


                var jadwalpraktikan = new jadwalPraktikan( )
                {
                    nrp            = simpleLabelItem1.Text,
                    id_jadwal_umum = new jadwal_umum( )
                    {
                        id_jadwal_umum = id.id_jadwal_umum
                    }
                };
                listjadwal.Add(jadwalpraktikan);
            }
            try { service.AddJadwalPraktikan(listjadwal.ToArray( )); } catch (Exception) { XtraMessageBox.Show("Tidak ada jadwal"); }
            Close( );
        }
Exemplo n.º 4
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            var service = new IadmClient( );
            var periode = service.viewPeriode( ).FirstOrDefault(x => service.ServerTime() >= x.awalSemester &&
                                                                service.ServerTime() <= x.akhirSemester);
            var data = new jadwalPraktikan( )
            {
                nrp            = nrppraktikan,
                id_jadwal_umum = new jadwal_umum( )
                {
                    id_periode = periode.id_periode
                }
            };

            try
            {
                service.DeleteJadwalPraktikan(data);
            }
            catch (Exception)
            {
                XtraMessageBox.Show("Error");
            }
            Close( );
        }