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 Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LoadDDLs();
     }
     if (Request.IsAuthenticated)
     {
         if (Roles.IsUserInRole(Page.User.Identity.Name, "CabinCrew"))
         {
             uiRadioButtonListReports.Items[2].Attributes.Add("style", "display:none");
             Crew C = new Crew();
             C.GetCrewByUserName(Page.User.Identity.Name);
             uiDropDownListCrew.SelectedValue = C.CrewID.ToString();
             uiDropDownListCrew.Enabled = false;
         }
     }
 }
        protected void uiLinkButtonGetReport_Click(object sender, EventArgs e)
        {
            Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource();
            FlightReportDataSetTableAdapters.GetCrewScheduleTableAdapter ta = new FlightReportDataSetTableAdapters.GetCrewScheduleTableAdapter();
            rds.Name = "CabinCrewScheduleDataSet";
            ta.ClearBeforeFill = true;

            try
            {
                CultureInfo provider = CultureInfo.InvariantCulture;
                provider = new CultureInfo("fr-FR");
                DateTime? From = null;
                DateTime? To = null;
                if (!string.IsNullOrEmpty(uiTextBoxFrom.Text))
                {
                    From = DateTime.ParseExact(uiTextBoxFrom.Text, "dd/MM/yyyy", provider);
                }
                if (!string.IsNullOrEmpty(uiTextBoxTo.Text))
                {
                    To = DateTime.ParseExact(uiTextBoxTo.Text, "dd/MM/yyyy", provider);
                }
                Crew current = new Crew();
                current.GetCrewByUserName(Page.User.Identity.Name);
                if (current.RowCount > 0)
                    rds.Value = ta.GetData(current.CrewID, From, To);
                else
                    rds.Value = ta.GetData(0, From, To);
            }
            catch (Exception ex)
            {

                throw;
            }
            uiReportViewer.LocalReport.DataSources.Clear();
            uiReportViewer.LocalReport.DataSources.Add(rds);
            //uiReportViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("From", uiTextBoxFrom.Text));
            //uiReportViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("To", uiTextBoxTo.Text));
            uiReportViewer.LocalReport.Refresh();
        }
 private void BindData()
 {
     Crew current = new Crew();
     current.GetCrewByUserName(Page.User.Identity.Name);
     Crew p = new Crew();
     DateTime? From = null;
     DateTime? To = null;
     CultureInfo provider = CultureInfo.InvariantCulture;
     provider = new CultureInfo("fr-FR");
     if (!string.IsNullOrEmpty(uiTextBoxFrom.Text))
     {
         From = DateTime.ParseExact(uiTextBoxFrom.Text, "dd/MM/yyyy", provider);
     }
     if (!string.IsNullOrEmpty(uiTextBoxTo.Text))
     {
         To = DateTime.ParseExact(uiTextBoxTo.Text, "dd/MM/yyyy", provider);
     }
     if (current.RowCount > 0)
         p.GetCrewSchedule(current.CrewID, From, To);
     else
         p.GetCrewSchedule(0, From, To);
     uiGridViewSchedule.DataSource = p.DefaultView;
     uiGridViewSchedule.DataBind();
 }