public PinereDataModel() { DataAirline = new DataAirline(); Pasien = new Pasien(); KKP = new KKP(); Sampel = new Sampel(); Litbang = new Litbang(); }
public static Boolean SaveDataAirline(PinereDataContext dc, string User, DataAirline ai, out string DataAirlineId) { DataAirlineId = string.Empty; try { var DataAirline = (from a in dc.InsertDataAirline(ai.Id, int.Parse(ai.NamaAirline), ai.NomorPenerbangan, GetDateFromStringDate(ai.WaktuBerangkat), ai.KotaAsal, ai.KotaTujuan, int.Parse(ai.JumlahPenumpang), int.Parse(ai.PenumpangSakit), ai.FormGendec, DateTime.Now, User, ai.NamaPetugas, ai.NomorPetugas, int.Parse(ai.JumlahSakit)) select a).SingleOrDefault(); DataAirlineId = DataAirline.DataAirlineId.ToString(); return(true); } catch (Exception e) { throw new Exception(e.Message); } }
public static DataAirline GetDataAirline(int Id) { DataAirline DataAirline = new DataAirline(); try { using (var dc = new PinereDataContext(PinereConstant.PinereConnectionString)) { DataAirline = (from a in dc.GetDataAirline(Id) select new DataAirline { Id = a.ID, NamaAirline = a.Nama_Airline.Value.ToString(), NamaAirlineDis = a.Nama_Airline_Dis, NomorPenerbangan = a.Nomor_Penerbangan, WaktuBerangkat = GetDateStringFromDate(a.Waktu_Berangkat), KotaAsal = a.Kota_Asal, KotaAsalDis = a.Kota_Asal_Dis, KotaTujuan = a.Kota_Tujuan, KotaTujuanDis = a.Kota_Tujuan_Dis, JumlahPenumpang = a.Jumlah_Penumpang.Value.ToString(), PenumpangSakit = a.Penumpang_Sakit.Value.ToString(), PenumpangSakitDis = a.Penumpang_Sakit_Dis, FormGendec = a.Form_Gendec, CreatedBy = a.CreatedBy, CreatedDate = GetDateStringFromDate(a.CreatedDate), UpdatedBy = a.UpdatedBy, UpdatedDate = GetDateStringFromDate(a.UpdatedDate), NamaPetugas = a.Nama_Petugas, NomorPetugas = a.Nomor_Petugas, JumlahSakit = a.Jumlah_Sakit.Value.ToString() }).SingleOrDefault(); if (DataAirline == null) { DataAirline = new DataAirline(); } } } catch (Exception e) { throw new Exception(e.Message); } return(DataAirline); }