Example #1
0
 private void BindCrew()
 {
     FlightCrew crew = new FlightCrew();
     crew.GetCrewByFlightID(CurrentFlightReport.ReportID);
     uiGridViewCrew.DataSource = crew.DefaultView;
     uiGridViewCrew.DataBind();
 }
Example #2
0
        protected void uiGridViewReports_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditReport")
            {
                Flight objData = new Flight();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                uiDropDownListAirCraftRegistration.SelectedValue = objData.AirCraft_AirPlaneID.ToString();
                uiTextBoxFlightNo.Text = objData.FlightNo;
                uiTextBoxDate.Text = objData.ReportDate.ToString("dd/MM/yyyy");
                uiCheckBoxIsHeavy.Checked = objData.IsHeavy;
                CurrentFlightReport = objData;
                uiPanelEdit.Visible = true;
                uiPanelViewAll.Visible = false;
                BindSectors();
                BindCrew();
                BindPilots();
            }

            else if (e.CommandName == "DeleteReport")
            {
                Flight objData = new Flight();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                FlightCrew crew = new FlightCrew();
                crew.GetCrewByFlightID(objData.ReportID);
                FlightPilot pilots = new FlightPilot();
                pilots.GetPilotByFlightID(objData.ReportID);
                Sector sectors = new Sector();
                sectors.GetSectorsByFlightID(objData.ReportID);

                pilots.DeleteAll();
                pilots.Save();

                crew.DeleteAll();
                crew.Save();

                sectors.DeleteAll();
                sectors.Save();

                objData.MarkAsDeleted();
                objData.Save();

                BindReportData();
            }
        }