protected void uiGridViewPiolts_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView objData = (DataRowView)e.Row.DataItem; Pilot current = new Pilot(); current.LoadByPrimaryKey(Convert.ToInt32(objData["PilotID"].ToString())); Label temp = (Label)e.Row.FindControl("uiLabelName"); temp.Text = current.FirstName + " " + current.SecondName; Label temp2 = (Label)e.Row.FindControl("uiLabelStaffNo"); if (!current.IsColumnNull("StaffNo")) { temp2.Text = current.StaffNo.ToString(); } CheckBox IsPilot = (CheckBox)e.Row.FindControl("uiCheckBoxIsPilot"); if (!current.IsColumnNull("IsPilot")) IsPilot.Checked = current.IsPilot; else IsPilot.Checked = false; if (objData["PositionID"] != null) { Label pos = (Label)e.Row.FindControl("uiLabelPosition"); Position Currentpos = new Position(); Currentpos.LoadByPrimaryKey(Convert.ToInt32(objData["PositionID"].ToString())); pos.Text = Currentpos.Title; } } }
protected void uiGridViewCrew_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView objData = (DataRowView)e.Row.DataItem; Crew current = new Crew(); current.LoadByPrimaryKey(Convert.ToInt32(objData["CrewID"].ToString())); Label temp = (Label)e.Row.FindControl("uiLabelName"); temp.Text = current.Name; Label temp2 = (Label)e.Row.FindControl("uiLabelStaffNo"); if (!current.IsColumnNull("StaffNo")) { temp2.Text = current.StaffNo.ToString(); } if (objData["PositionID"] != null) { Label pos = (Label)e.Row.FindControl("uiLabelPosition"); Position Currentpos = new Position(); Currentpos.LoadByPrimaryKey(Convert.ToInt32(objData["PositionID"].ToString())); pos.Text = Currentpos.Title; } } }
private void LoadDDLs() { Crew AllCrew = new Crew(); AllCrew.LoadAll(); uiDropDownListCrew.DataSource = AllCrew.DefaultView; uiDropDownListCrew.DataTextField = "Name"; uiDropDownListCrew.DataValueField = "CrewID"; uiDropDownListCrew.DataBind(); uiDropDownListCrew.Items.Insert(0, new ListItem("Select Member", "")); Position AllPositions = new Position(); AllPositions.LoadAll(); uiDropDownListCrewPos.DataSource = AllPositions.DefaultView; ; uiDropDownListCrewPos.DataTextField = "Title"; uiDropDownListCrewPos.DataValueField = "PositionID"; uiDropDownListCrewPos.DataBind(); uiDropDownListCrewPos.Items.Insert(0, new ListItem("Select Position", "")); }
private void LoadDDLs() { Pilot Allpilots = new Pilot(); Allpilots.GetAllPilots(); uiDropDownListPilot.DataSource = Allpilots.DefaultView; uiDropDownListPilot.DataTextField = "DisplayName"; uiDropDownListPilot.DataValueField = "PilotID"; uiDropDownListPilot.DataBind(); uiDropDownListPilot.Items.Insert(0, new ListItem("Select Pilot", "")); Pilot AllCopilots = new Pilot(); AllCopilots.GetAllCoPilots(); uiDropDownListCoPilot.DataSource = AllCopilots.DefaultView; uiDropDownListCoPilot.DataTextField = "DisplayName"; uiDropDownListCoPilot.DataValueField = "PilotID"; uiDropDownListCoPilot.DataBind(); uiDropDownListCoPilot.Items.Insert(0, new ListItem("Select Co-Pilot", "")); Position AllPositions = new Position(); AllPositions.LoadAll(); uiDropDownListPilotPos.DataSource = AllPositions.DefaultView; uiDropDownListPilotPos.DataTextField = "Title"; uiDropDownListPilotPos.DataValueField = "PositionID"; uiDropDownListPilotPos.DataBind(); uiDropDownListPilotPos.Items.Insert(0, new ListItem("Select Position", "")); uiDropDownListCOPos.DataSource = AllPositions.DefaultView; uiDropDownListCOPos.DataTextField = "Title"; uiDropDownListCOPos.DataValueField = "PositionID"; uiDropDownListCOPos.DataBind(); uiDropDownListCOPos.Items.Insert(0, new ListItem("Select Position", "")); Crew AllCrew = new Crew(); AllCrew.LoadAll(); uiDropDownListCrew.DataSource = AllCrew.DefaultView; uiDropDownListCrew.DataTextField = "Name"; uiDropDownListCrew.DataValueField = "CrewID"; uiDropDownListCrew.DataBind(); uiDropDownListCrew.Items.Insert(0, new ListItem("Select Member", "")); uiDropDownListCrewPos.DataSource = AllPositions.DefaultView; ; uiDropDownListCrewPos.DataTextField = "Title"; uiDropDownListCrewPos.DataValueField = "PositionID"; uiDropDownListCrewPos.DataBind(); uiDropDownListCrewPos.Items.Insert(0, new ListItem("Select Position", "")); AirPort AllAirports = new AirPort(); AllAirports.LoadAll(); uiDropDownListSectorFrom.DataSource = AllAirports.DefaultView; uiDropDownListSectorFrom.DataTextField = "IATACode"; uiDropDownListSectorFrom.DataValueField = "AirPortID"; uiDropDownListSectorFrom.DataBind(); uiDropDownListSectorFrom.Items.Insert(0, new ListItem("Select Airport", "")); uiDropDownListSectorTo.DataSource = AllAirports.DefaultView; uiDropDownListSectorTo.DataTextField = "IATACode"; uiDropDownListSectorTo.DataValueField = "AirPortID"; uiDropDownListSectorTo.DataBind(); uiDropDownListSectorTo.Items.Insert(0, new ListItem("Select Airport", "")); AirPlane Ap = new AirPlane(); Ap.LoadAll(); uiDropDownListAirCraftRegistration.DataSource = Ap.DefaultView; uiDropDownListAirCraftRegistration.DataTextField = "Name"; uiDropDownListAirCraftRegistration.DataValueField = "AirPlaneID"; uiDropDownListAirCraftRegistration.DataBind(); }
private void LoadDDLs() { Pilot Allpilots = new Pilot(); Allpilots.GetAllPilots(); uiDropDownListPilot.DataSource = Allpilots.DefaultView; uiDropDownListPilot.DataTextField = "DisplayName"; uiDropDownListPilot.DataValueField = "PilotID"; uiDropDownListPilot.DataBind(); uiDropDownListPilot.Items.Insert(0, new ListItem("Select Pilot", "")); Pilot AllCopilots = new Pilot(); AllCopilots.GetAllCoPilots(); uiDropDownListCoPilot.DataSource = AllCopilots.DefaultView; uiDropDownListCoPilot.DataTextField = "DisplayName"; uiDropDownListCoPilot.DataValueField = "PilotID"; uiDropDownListCoPilot.DataBind(); uiDropDownListCoPilot.Items.Insert(0, new ListItem("Select Co-Pilot", "")); Position AllPositions = new Position(); AllPositions.LoadAll(); uiDropDownListPilotPos.DataSource = AllPositions.DefaultView; uiDropDownListPilotPos.DataTextField= "Title"; uiDropDownListPilotPos.DataValueField = "PositionID"; uiDropDownListPilotPos.DataBind(); uiDropDownListPilotPos.Items.Insert(0, new ListItem("Select Position", "")); uiDropDownListCOPos.DataSource = AllPositions.DefaultView; uiDropDownListCOPos.DataTextField = "Title"; uiDropDownListCOPos.DataValueField = "PositionID"; uiDropDownListCOPos.DataBind(); uiDropDownListCOPos.Items.Insert(0, new ListItem("Select Position", "")); }