protected void uiLinkButtonAddCrew_Click(object sender, EventArgs e) { FlightCrew Member = new FlightCrew(); Member.AddNew(); Member.ReportID = CurrentFlightReport.ReportID; Member.PositionID = Convert.ToInt32(uiDropDownListCrewPos.SelectedValue); Member.CrewID = Convert.ToInt32(uiDropDownListCrew.SelectedValue); Member.Save(); BindCrew(); }
protected void uiGridViewCrew_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteCrew") { FlightCrew objData = new FlightCrew(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); BindCrew(); } }
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(); } }