Ejemplo n.º 1
0
        private void btnMakeReport_Click(object sender, EventArgs e)
        {
            DTO_AmenityReport amenityReport = new DTO_AmenityReport(
                tbFlightNumber.Text,
                dtFrom.Value,
                dtTo.Value
                );
            BUS_AmenityReport bus_amenityReport = new BUS_AmenityReport();

            dataGridView1.DataSource = bus_amenityReport.GetAmenitiesReportTable(amenityReport);
        }
Ejemplo n.º 2
0
        public DataTable GetAmenitiesReportTable(DTO_AmenityReport amenityReport)
        {
            try
            {
                DataTable      result          = new DataTable();
                DAL_Amenities  dal_amenities   = new DAL_Amenities();
                DAL_CabinTypes dal_cabinTypes  = new DAL_CabinTypes();
                DataTable      amenitiesTable  = dal_amenities.GetAllAmenities();
                DataTable      cabinTypesTable = dal_cabinTypes.GetAllCabinTypesTable();

                result.Columns.Add("Name");

                foreach (DataRow dr in amenitiesTable.Rows)
                {
                    result.Columns.Add(dr["Service"].ToString());
                }

                foreach (DataRow drCabin in cabinTypesTable.Rows)
                {
                    DataRow newDr;
                    newDr         = result.NewRow();
                    newDr["Name"] = drCabin["Name"].ToString();

                    foreach (DataRow drAmenity in amenitiesTable.Rows)
                    {
                        DataTable dt = this.GetReportByAmenityIDAndCabinID(
                            amenityReport.FlightNumber,
                            drAmenity["ID"].ToString(),
                            drCabin["ID"].ToString(),
                            amenityReport.From.ToString("yyyy/MM/dd"),
                            amenityReport.To.ToString("yyyy/MM/dd")
                            );

                        if (dt.Rows.Count > 0)
                        {
                            newDr[drAmenity["Service"].ToString()] = dt.Rows[0]["Total"].ToString();
                        }
                        else
                        {
                            newDr[drAmenity["Service"].ToString()] = 0;
                        }
                    }

                    result.Rows.Add(newDr);
                }

                return(result);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
 public DataTable GetAmenitiesReportTable(DTO_AmenityReport amenityReport)
 {
     return(dal_amenityReport.GetAmenitiesReportTable(amenityReport));
 }