Exemplo n.º 1
0
        public IActionResult getBookingDermaga(BookingDermagaParam DermagaParam)
        {
            BookingDermagaDL    dal   = new BookingDermagaDL();
            BookingDermagaModel hasil = new BookingDermagaModel();

            IEnumerable <GetBookingDermagaList> result = dal.getBookingDermaga(DermagaParam);

            hasil.message = "Success";
            hasil.status  = "S";
            hasil.count   = result.Cast <Object>().Count();
            hasil.data    = result.ToList();

            return(Ok(hasil));
        }
Exemplo n.º 2
0
        public IEnumerable <GetBookingDermagaList> getBookingDermaga(BookingDermagaParam bookingParam)
        {
            IEnumerable <GetBookingDermagaList> result = null;

            using (IDbConnection connection = Extension.GetConnection(1))
            {
                try
                {
                    string paramKodePelanggan = "";
                    if (!string.IsNullOrEmpty(bookingParam.kode_pelanggan) && bookingParam.kode_pelanggan != "string")
                    {
                        paramKodePelanggan = " AND MAGIC_BOOKING_HEADER.KODE_PELANGGAN='" + bookingParam.kode_pelanggan + "'";
                    }

                    var sql = "";
                    if (!string.IsNullOrEmpty(bookingParam.kode_booking) && bookingParam.kode_booking != "string")
                    {
                        sql = "SELECT * FROM MAGIC_BOOKING_HEADER JOIN MAGIC_BOOKING_DETAIL ON MAGIC_BOOKING_HEADER.BOOKING_ID=MAGIC_BOOKING_DETAIL.BOOKING_ID " +
                              "AND MAGIC_BOOKING_HEADER.BOOKING_ID='" + bookingParam.kode_booking + "'" + paramKodePelanggan + " ORDER BY MAGIC_BOOKING_HEADER.BOOKING_ID ASC";
                    }
                    else if (!string.IsNullOrEmpty(bookingParam.kode_pelanggan) && bookingParam.kode_pelanggan != "string")
                    {
                        sql = "SELECT DISTINCT(MAGIC_BOOKING_HEADER.BOOKING_ID), " +
                              "MAGIC_BOOKING_HEADER.CREATED_DATE, " +
                              "MAGIC_BOOKING_HEADER.KOMODITI, " +
                              "MAGIC_BOOKING_HEADER.NAMA_KAPAL, " +
                              "MAGIC_BOOKING_HEADER.KODE_KAPAL, " +
                              "MAGIC_BOOKING_HEADER.GT, " +
                              "MAGIC_BOOKING_HEADER.LOA, " +
                              "MAGIC_BOOKING_HEADER.DRAFT, " +
                              "MAGIC_BOOKING_HEADER.KD_CABANG, " +
                              "MAGIC_BOOKING_HEADER.LAMA_RENCANA_TAMBAT, " +
                              "MAGIC_BOOKING_HEADER.KODE_PELABUHAN, " +
                              "MAGIC_BOOKING_HEADER.NAMA_PELABUHAN, " +
                              "MAGIC_BOOKING_HEADER.KADE_AWAL, " +
                              "MAGIC_BOOKING_HEADER.KADE_AKHIR, " +
                              "MAGIC_BOOKING_HEADER.KODE_PELANGGAN, " +
                              "MAGIC_BOOKING_DETAIL.ASAL, " +
                              "MAGIC_BOOKING_DETAIL.TUJUAN, " +
                              "MAGIC_BOOKING_DETAIL.JAM_MULAI, " +
                              "MAGIC_BOOKING_DETAIL.JAM_SELESAI, " +
                              "MAGIC_BOOKING_DETAIL.JUMLAH_GERAKAN, " +
                              "MAGIC_BOOKING_DETAIL.GERAKAN, " +
                              "MAGIC_BOOKING_DETAIL.KODE_PELABUHAN_ASAL, " +
                              "MAGIC_BOOKING_DETAIL.KODE_PELABUHAN_TUJUAN, " +
                              "MAGIC_BOOKING_DETAIL.TGL_MULAI, " +
                              "MAGIC_BOOKING_DETAIL.TGL_SELESAI " +
                              "FROM MAGIC_BOOKING_HEADER " +
                              "JOIN MAGIC_BOOKING_DETAIL ON MAGIC_BOOKING_HEADER.BOOKING_ID = MAGIC_BOOKING_DETAIL.BOOKING_ID" + paramKodePelanggan + " ORDER BY MAGIC_BOOKING_HEADER.BOOKING_ID ASC";
                    }
                    else
                    {
                        sql = "SELECT DISTINCT(MAGIC_BOOKING_HEADER.BOOKING_ID), " +
                              "MAGIC_BOOKING_HEADER.CREATED_DATE, " +
                              "MAGIC_BOOKING_HEADER.KOMODITI, " +
                              "MAGIC_BOOKING_HEADER.NAMA_KAPAL, " +
                              "MAGIC_BOOKING_HEADER.KODE_KAPAL, " +
                              "MAGIC_BOOKING_HEADER.GT, " +
                              "MAGIC_BOOKING_HEADER.LOA, " +
                              "MAGIC_BOOKING_HEADER.DRAFT, " +
                              "MAGIC_BOOKING_HEADER.KD_CABANG, " +
                              "MAGIC_BOOKING_HEADER.LAMA_RENCANA_TAMBAT, " +
                              "MAGIC_BOOKING_HEADER.KODE_PELABUHAN, " +
                              "MAGIC_BOOKING_HEADER.NAMA_PELABUHAN, " +
                              "MAGIC_BOOKING_HEADER.KADE_AWAL, " +
                              "MAGIC_BOOKING_HEADER.KADE_AKHIR, " +
                              "MAGIC_BOOKING_HEADER.KODE_PELANGGAN, " +
                              "MAGIC_BOOKING_DETAIL.ASAL, " +
                              "MAGIC_BOOKING_DETAIL.TUJUAN, " +
                              "MAGIC_BOOKING_DETAIL.JAM_MULAI, " +
                              "MAGIC_BOOKING_DETAIL.JAM_SELESAI, " +
                              "MAGIC_BOOKING_DETAIL.JUMLAH_GERAKAN, " +
                              "MAGIC_BOOKING_DETAIL.GERAKAN, " +
                              "MAGIC_BOOKING_DETAIL.KODE_PELABUHAN_ASAL, " +
                              "MAGIC_BOOKING_DETAIL.KODE_PELABUHAN_TUJUAN, " +
                              "MAGIC_BOOKING_DETAIL.TGL_MULAI, " +
                              "MAGIC_BOOKING_DETAIL.TGL_SELESAI " +
                              "FROM MAGIC_BOOKING_HEADER " +
                              "JOIN MAGIC_BOOKING_DETAIL ON MAGIC_BOOKING_HEADER.BOOKING_ID = MAGIC_BOOKING_DETAIL.BOOKING_ID ORDER BY MAGIC_BOOKING_HEADER.BOOKING_ID ASC";
                    }

                    result = connection.Query <GetBookingDermagaList>(sql);
                }
                catch (Exception)
                {
                    result = null;
                }
            }

            return(result);
        }