private void BindData() { Flight f = new Flight(); f.GetPilotFlights(3); uiGridViewReports.DataSource = f.DefaultView; uiGridViewReports.DataBind(); }
private void BindReportData() { Flight AllReports = new Flight(); AllReports.GetPAXFlights(); AllReports.Sort = "ReportDate Desc"; uiRadGrid.DataSource = AllReports.DefaultView; uiRadGrid.DataBind(); }
protected void uiButtonSaveMaster_Click(object sender, EventArgs e) { if (CurrentFlightReport != null) { Flight objData = CurrentFlightReport; objData.FlightNo = uiTextBoxFlightNo.Text; objData.AirCraft_AirPlaneID = Convert.ToInt32(uiDropDownListAirCraftRegistration.SelectedValue); objData.ReportDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null); objData.IsHeavy = uiCheckBoxIsHeavy.Checked; objData.Save(); } else { Flight objData = new Flight(); objData.AddNew(); objData.FlightNo = uiTextBoxFlightNo.Text; objData.AirCraft_AirPlaneID = Convert.ToInt32(uiDropDownListAirCraftRegistration.SelectedValue); objData.ReportDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null); objData.IsHeavy = uiCheckBoxIsHeavy.Checked; objData.Save(); CurrentFlightReport = objData; EnableDisableTabs(); } }
protected void uiButtonSearch_Click(object sender, EventArgs e) { Flight r = new Flight(); r.SearchPAXFlights(uiTextBoxSearch.Text, !string.IsNullOrEmpty(uiTextBoxFromDate.Text) ? DateTime.ParseExact(uiTextBoxFromDate.Text, "dd/MM/yyyy", null) : DateTime.ParseExact("01/01/1900", "dd/MM/yyyy", null) , !string.IsNullOrEmpty(uiTextBoxToDate.Text) ? DateTime.ParseExact(uiTextBoxToDate.Text, "dd/MM/yyyy", null) : DateTime.MaxValue); uiGridViewReports.DataSource = r.DefaultView; uiGridViewReports.DataBind(); }
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(); } }