private void FillCrewData() { Crew CurrentCrew = new Crew(); CurrentCrew.GetCrewByUserName(Page.User.Identity.Name); uiLabelName.Text = CurrentCrew.Name; uiLabelStaffNo.Text = CurrentCrew.StaffNo.ToString(); uiLabelLicenseNo.Text = CurrentCrew.LicenseNo; if (!CurrentCrew.IsColumnNull("Competenecycheck")) uiLabelCompetencyCheck.Text = CurrentCrew.Competenecycheck.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("MEDICALLICENSEEXPIRYFrom")) uiLabelFrom.Text = CurrentCrew.MEDICALLICENSEEXPIRYFrom.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("MEDICALLICENSEEXPIRYTo")) uiLabelTo.Text = CurrentCrew.MEDICALLICENSEEXPIRYTo.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("InstructorRenewal")) uiLabelInstructorRenewal.Text = CurrentCrew.InstructorRenewal.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("TRANSITIONCOURSE")) uiLabeltransitionCourse.Text = CurrentCrew.TRANSITIONCOURSE.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("RECURRENT12")) uiLabelRecurrent12.Text = CurrentCrew.RECURRENT12.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("RECURRENT24")) uiLabelRecurrent24.Text = CurrentCrew.RECURRENT24.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("SMS")) uiLabelSMS.Text = CurrentCrew.SMS.ToString("dd/MM/yyyy"); ; if (!CurrentCrew.IsColumnNull("Security")) uiLabelSecurity.Text = CurrentCrew.Security.ToString("dd/MM/yyyy"); ; uiLabelUsername.Text = CurrentCrew.Username; }
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; } } }