private void simpleButton1_Click(object sender, EventArgs e) { try { if (textEdit1.Text.Length != 4) { XtraMessageBox.Show("Format Tahun Salah !"); } else { var service = new IadmClient( ); var data = new angkatan( ) { KodeAngkatan = textEdit1.Text.Substring(2, 2), TahunAngkatan = textEdit1.Text.Substring(0, 4) }; service.TambahAngaktan(data); listBoxControl1.Items.Add(textEdit1.Text); service.Close(); } } catch (Exception) { XtraMessageBox.Show("Format Tahun Salah !"); } }
private void simpleButton1_Click(object sender, EventArgs e) { var error = false; try { var service = new IadmClient(); var data = new Users() { username = id, password = textEdit1.Text }; service.EditPassword(data); service.Close(); } catch (Exception) { error = true; XtraMessageBox.Show("ada kesalahan"); } if (error == false) { Close(); } }
public static void CariPraktikan(ComboBoxEdit comboBoxEdit1, ComboBoxEdit comboBoxEdit2, GridControl gridcontrol, GridView gridview) { try { var service = new IadmClient(); comboBoxEdit1.SelectedIndex = 0; comboBoxEdit2.SelectedIndex = 0; var nmAngkatan = comboBoxEdit1.SelectedItem.ToString(); var nmJurusan = comboBoxEdit2.SelectedItem.ToString(); var angkatan = service.GetAngkatan().FirstOrDefault(q => q.TahunAngkatan == nmAngkatan); var jurusan = service.GetJurusan().FirstOrDefault(q => q.NamaJurusan == nmJurusan); praktikan data = new praktikan() { angkatan = new angkatan() { KodeAngkatan = angkatan?.KodeAngkatan }, jurusan = new jurusan() { KodeJurusan = jurusan?.KodeJurusan } }; gridcontrol.DataSource = service.GetPraktikan(data) .Select( x => new { x.Foto, x.NRP, x.Nama, KodeAngkatan = x.angkatan.KodeAngkatan, KodeJurusan = x.jurusan.KodeJurusan }) .ToList(); gridview.RowHeight = 60; gridview.Columns["Foto"].Width = 70; gridview.Columns["NRP"].Width = 150; gridview.Columns["NRP"].Caption = @"NO MAHASISWA"; gridview.Columns["Foto"].Caption = @"FOTO"; gridview.Columns["Nama"].Caption = @"NAMA"; gridview.Columns["KodeAngkatan"].Caption = @"ANGKATAN"; gridview.Columns["KodeJurusan"].Caption = @"JURUSAN"; for (int i = 0; i < gridview.Columns.Count; i++) { gridview.Columns[i].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; } service.Close(); } catch (Exception) { //XtraMessageBox.Show(err.ToString()); //XtraMessageBox.Show("data pencarian tidak lengkap"); throw; } }
private void GetTahunAngkatan() { listBoxControl1.Items.Clear(); var service = new IadmClient(); var angkatan = service.GetAngkatan().Select(x => x.TahunAngkatan).ToList(); listBoxControl1.Items.AddRange(angkatan.ToArray()); service.Close(); }
private void simpleButton2_Click(object sender, EventArgs e) { var service = new IadmClient(); var data = new angkatan() { TahunAngkatan = listBoxControl1.SelectedItem.ToString() }; service.HapusAngkatan(data); service.Close(); GetTahunAngkatan(); }
public static void AddPeriode(ComboBoxEdit comboBoxEdits) { comboBoxEdits.Properties.Items.Clear(); var service = new IadmClient(); comboBoxEdits.Properties.Items.AddRange(service.viewPeriode().Select(x => x.semester + " " + x.awalSemester.ToString("yyyy") + "/" + x.akhirSemester.ToString("yyyy")) .ToList()); comboBoxEdits.SelectedIndex = 0; service.Close(); }
private void simpleButton3_Click(object sender, EventArgs e) { var sheet = listBoxControl1.SelectedItem.ToString().Replace("'", Empty); var data = ExcelToDataTable(_dialog.FileName, sheet); var praktikan = new praktikan[data.Rows.Count]; var jur = Empty; var angk = Empty; for (var i = 0; i < data.Rows.Count; i++) { var nrpmhs = data.Rows[i][0].ToString(); var biodata = new praktikan() { NRP = data.Rows[i][0].ToString(), Nama = data.Rows[i][1].ToString(), jurusan = new jurusan() { KodeJurusan = Concat(nrpmhs[0], nrpmhs[1], nrpmhs[2]) }, angkatan = new angkatan() { KodeAngkatan = Concat(nrpmhs[3], nrpmhs[4]) }, Foto = ImageToByteArray(pictureEdit1.Image) }; praktikan[i] = biodata; jur = Concat(nrpmhs[0], nrpmhs[1], nrpmhs[2]); angk = Concat(nrpmhs[3], nrpmhs[4]); } try { var service = new IadmClient(); var jurusan = service.GetJurusan().FirstOrDefault(q => q.KodeJurusan == jur); var angkatan = service.GetAngkatan().FirstOrDefault(q => q.KodeAngkatan == angk); var j = jurusan?.KodeJurusan; var a = angkatan?.KodeAngkatan; if (j == jur && a == angk) { service.InsertMultiplePraktikan(praktikan); } service.Close(); Close(); } catch (Exception error) { XtraMessageBox.Show(error.ToString()); XtraMessageBox.Show("Gagal import data mahasiswa."); } }
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(); } }
public static void ComboBoxEditAdd(string option, ComboBoxEdit comboBoxEdit) { var service = new IadmClient(); comboBoxEdit.Properties.Items.Clear(); if (option == "Jurusan") { var jurusan = service.GetJurusan(); for (var i = 0; i < jurusan.Count(); i++) // Add Jurusan { comboBoxEdit.Properties.Items.Add(jurusan[i].NamaJurusan); } } if (option == "Angkatan") { var angkatan = service.GetAngkatan(); for (var i = 0; i < angkatan.Count(); i++) // Add Angkatan { comboBoxEdit.Properties.Items.Add(angkatan[i].TahunAngkatan); } } if (option == "Periode") { var periode = service.viewPeriode() .Select( z => new { start = z.awalSemester.ToString("yyyy"), finish = z.akhirSemester.ToString("yyyy") }) .Distinct() .ToList(); for (int i = 0; i < periode.Count(); i++) { comboBoxEdit.Properties.Items.Add($"{periode[i].start:yyyy}/{periode[i].finish:yyyy}"); } } if (option == "Semester") { var semester = service.viewPeriode().Select(z => z.semester).Distinct().ToList(); for (var i = 0; i < semester.Count(); i++) { comboBoxEdit.Properties.Items.Add(semester[i]); } } comboBoxEdit.SelectedIndex = 0; service.Close(); }
private void Form4_Load(object sender, EventArgs e) { // Format tgl indonesia DateFormatCultureInfo(dateEdit1, dateEdit2); // IadmClient service = new IadmClient(); // gridControl1.DataSource = service.viewPeriode().Select(x => new { semester = $"{x.semester} {x.awalSemester.ToString("yyyy")}/{x.akhirSemester.ToString("yyyy")}", awalSemester = x.awalSemester.ToString("dd MMMM yyyy", new CultureInfo("id-ID")), akhirSemester = x.akhirSemester.ToString("dd MMMM yyyy", new CultureInfo("id-ID")), }).ToList(); service.Close(); }
public static string PostLogin(string username, string password) { try { IadmClient service = new IadmClient(); List <akun> data = new List <akun>(); akun user = new akun() { Username = username, Password = password }; string roles = service.GetLogin(user).TrimEnd(); service.Close(); return(roles); } catch (Exception) { throw; } }
private void AddPeriode(object sender, EventArgs e) { DateTime mulai = dateEdit1.DateTime; DateTime selesai = dateEdit2.DateTime; string a = comboBoxEdit1.SelectedItem.ToString(); IadmClient service = new IadmClient(); periode data = new periode() { semester = a, awalSemester = mulai, akhirSemester = selesai }; service.addPeriode(data); gridControl1.DataSource = service.viewPeriode().Select(x => new { semester = $"{x.semester} {x.awalSemester.ToString("yyyy")}/{x.akhirSemester.ToString("yyyy")}", awalSemester = x.awalSemester.ToString("dd MMMM yyyy", new CultureInfo("id-ID")), akhirSemester = x.akhirSemester.ToString("dd MMMM yyyy", new CultureInfo("id-ID")) }).ToList(); service.Close(); }