Exemple #1
0
        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);
        }