public PinereDataModel() { DataAirline = new DataAirline(); Pasien = new Pasien(); KKP = new KKP(); Sampel = new Sampel(); Litbang = new Litbang(); }
public static Pasien GetPasien(int Id) { Pasien Pasien = new Pasien(); try { using (var dc = new PinereDataContext(PinereConstant.PinereConnectionString)) { Pasien = (from a in dc.GetPasien(Id) select new Pasien { Id = a.Id, DataAirlineId = a.DataAirlineId.Value.ToString(), Nama = a.Nama, TanggalLahir = GetDateStringFromDate(a.TanggalLahir), Kelamin = a.Kelamin, Pekerjaan = a.Pekerjaan, Passport = a.Passport, KTP = a.KTP, Alamat = a.Alamat, NamaAirline = a.NamaAirline, NomorPenerbangan = a.NomorPenerbangan, NomorTelpon = a.NomorTelpon }).SingleOrDefault(); if (Pasien == null) { Pasien = new Pasien(); } } } catch (Exception e) { throw new Exception(e.Message); } return(Pasien); }
public static Boolean SavePasien(PinereDataContext dc, string User, int DataAirlineId, Pasien ps, out string PasienId) { PasienId = string.Empty; try { var Pasien = (from a in dc.InsertPasien(ps.Id, DataAirlineId, ps.Nama, GetDateFromStringDate(ps.TanggalLahir), ps.Kelamin, ps.Pekerjaan, ps.Passport, ps.KTP, ps.Alamat, ps.NamaAirline, ps.NomorPenerbangan, ps.NomorTelpon, DateTime.Now, User) select a).SingleOrDefault(); PasienId = Pasien.PasienId.ToString(); return(true); } catch (Exception e) { throw new Exception(e.Message); } }