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 uiLinkButtonCancelCrew_Click(object sender, EventArgs e) { uiPanelViewAll.Visible = true; uiPanelEdit.Visible = false; ClearFields(); CurrentCrew = null; }
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(); }
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 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(); }
private void LoadDDLs() { Crew AllCrew = new Crew(); AllCrew.LoadAll(); AllCrew.DefaultView.Sort = "Name"; uiRadComboBoxCabin.DataSource = AllCrew.DefaultView; uiRadComboBoxCabin.DataTextField = "Name"; uiRadComboBoxCabin.DataValueField = "CrewID"; uiRadComboBoxCabin.DataBind(); uiRadComboBoxCabin.Items.Insert(0, new RadComboBoxItem("Select Crew", "0")); uiRadComboBoxCrewSearch.DataSource = AllCrew.DefaultView; ; uiRadComboBoxCrewSearch.DataTextField = "Name"; uiRadComboBoxCrewSearch.DataValueField = "CrewID"; uiRadComboBoxCrewSearch.DataBind(); uiRadComboBoxCrewSearch.Items.Insert(0, new RadComboBoxItem("Select Crew", "0")); Flight_BLL.Activities AllAct = new Flight_BLL.Activities(); AllAct.LoadAll(); uiRadComboBoxActivity.DataSource = AllAct.DefaultView; uiRadComboBoxActivity.DataTextField = "Name"; uiRadComboBoxActivity.DataValueField = "ActivityID"; uiRadComboBoxActivity.DataBind(); uiRadComboBoxActivity.Items.Insert(0, new RadComboBoxItem("Select Activity", "0")); uiRadComboBoxActSearch.DataSource = AllAct.DefaultView; ; uiRadComboBoxActSearch.DataTextField = "Name"; uiRadComboBoxActSearch.DataValueField = "ActivityID"; uiRadComboBoxActSearch.DataBind(); uiRadComboBoxActSearch.Items.Insert(0, new RadComboBoxItem("Select Activity", "0")); }
protected void uiRadGridActivityLog_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { DataRowView row = (DataRowView)e.Item.DataItem; Crew c = new Crew(); c.LoadByPrimaryKey(Convert.ToInt32(row["CrewID"].ToString())); Label CrewName = (Label)e.Item.FindControl("uiLabelName"); CrewName.Text = c.Name; Flight_BLL.Activities Act = new Flight_BLL.Activities(); Act.LoadByPrimaryKey(Convert.ToInt32(row["ActivityID"].ToString())); Label ActName = (Label)e.Item.FindControl("uiLabelActivityName"); ActName.Text = Act.Name; } }
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", "")); 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", "")); 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", "0")); uiDropDownListSectorTo.DataSource = AllAirports.DefaultView; uiDropDownListSectorTo.DataTextField = "IATACode"; uiDropDownListSectorTo.DataValueField = "AirPortID"; uiDropDownListSectorTo.DataBind(); uiDropDownListSectorTo.Items.Insert(0, new ListItem("Select Airport", "0")); }
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() { 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 Crew", "")); }
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(); }
protected void uiRadGridCrew_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName == "EditCrew") { Crew objData = new Crew(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); CurrentCrew = objData; FillCrewData(); uiPanelEdit.Visible = true; uiPanelViewAll.Visible = false; } else if (e.CommandName == "DeleteCrew") { Crew objData = new Crew(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); if (Membership.GetUser(objData.Username) != null) { Membership.DeleteUser(objData.Username); } objData.MarkAsDeleted(); objData.Save(); SearchCrew(); } }
private void UpdateCrew() { Crew objData = new Crew(); objData = CurrentCrew; objData.Name = uiTextBoxName.Text; objData.StaffNo = Convert.ToInt32(uiTextBoxStaffNo.Text); objData.LicenseNo = uiTextBoxLicenseNo.Text; if (uiRadDatePickerCompetenecycheck.SelectedDate != null) objData.Competenecycheck = uiRadDatePickerCompetenecycheck.SelectedDate.Value; if (uiRadDatePickerMLEF.SelectedDate != null) objData.MEDICALLICENSEEXPIRYFrom = uiRadDatePickerMLEF.SelectedDate.Value; if (uiRadDatePickerMLET.SelectedDate != null) objData.MEDICALLICENSEEXPIRYTo = uiRadDatePickerMLET.SelectedDate.Value; if (uiRadDatePickerInstructorRenewal.SelectedDate != null) objData.InstructorRenewal = uiRadDatePickerInstructorRenewal.SelectedDate.Value; if (uiRadDatePickerTransitionCourse.SelectedDate != null) objData.TRANSITIONCOURSE = uiRadDatePickerTransitionCourse.SelectedDate.Value; if (uiRadDatePickerRecurrent12.SelectedDate != null) objData.RECURRENT12 = uiRadDatePickerRecurrent12.SelectedDate.Value; if (uiRadDatePickerRecurrent24.SelectedDate != null) objData.RECURRENT24 = uiRadDatePickerRecurrent24.SelectedDate.Value; if (uiRadDatePickerSMS.SelectedDate != null) objData.SMS = uiRadDatePickerSMS.SelectedDate.Value; if (uiRadDatePickerSecurity.SelectedDate != null) objData.Security = uiRadDatePickerSecurity.SelectedDate.Value; objData.Save(); }
private void SearchCrew() { Crew CrewObj = new Crew(); CrewObj.SearchCrew(uiTextBoxSearch.Text); uiRadGridCrew.DataSource = CrewObj.DefaultView; uiRadGridCrew.DataBind(); }
private void AddNewCrew() { MembershipCreateStatus obj; MembershipUser objUser = Membership.CreateUser(uiTextBoxUserName.Text, uiTextBoxPassword.Text, "*****@*****.**", null, null, true, out obj); bool success = true; switch (obj) { case MembershipCreateStatus.DuplicateUserName: uiLabelError.Text = "duplicate username"; uiLabelError.Visible = true; success = false; break; case MembershipCreateStatus.InvalidPassword: uiLabelError.Text = "invalid password. password must be (6) characters or more."; uiLabelError.Visible = true; success = false; break; case MembershipCreateStatus.ProviderError: case MembershipCreateStatus.UserRejected: uiLabelError.Text = "an error occurred. please try again."; uiLabelError.Visible = true; success = false; break; default: break; } if (!Roles.IsUserInRole(uiTextBoxUserName.Text, "CabinCrew") && success) { Roles.AddUserToRole(uiTextBoxUserName.Text, "CabinCrew"); } if (success) { Crew objData = new Crew(); objData.AddNew(); objData.Name = uiTextBoxName.Text; objData.Username = uiTextBoxUserName.Text; objData.StaffNo = Convert.ToInt32(uiTextBoxStaffNo.Text); objData.LicenseNo = uiTextBoxLicenseNo.Text; if(uiRadDatePickerCompetenecycheck.SelectedDate != null) objData.Competenecycheck = uiRadDatePickerCompetenecycheck.SelectedDate.Value; if (uiRadDatePickerMLEF.SelectedDate != null) objData.MEDICALLICENSEEXPIRYFrom = uiRadDatePickerMLEF.SelectedDate.Value; if (uiRadDatePickerMLET.SelectedDate != null) objData.MEDICALLICENSEEXPIRYTo = uiRadDatePickerMLET.SelectedDate.Value; if (uiRadDatePickerInstructorRenewal.SelectedDate != null) objData.InstructorRenewal = uiRadDatePickerInstructorRenewal.SelectedDate.Value; if (uiRadDatePickerTransitionCourse.SelectedDate != null) objData.TRANSITIONCOURSE = uiRadDatePickerTransitionCourse.SelectedDate.Value; if (uiRadDatePickerRecurrent12.SelectedDate != null) objData.RECURRENT12 = uiRadDatePickerRecurrent12.SelectedDate.Value; if (uiRadDatePickerRecurrent24.SelectedDate != null) objData.RECURRENT24 = uiRadDatePickerRecurrent24.SelectedDate.Value; if (uiRadDatePickerSMS.SelectedDate != null) objData.SMS = uiRadDatePickerSMS.SelectedDate.Value; if (uiRadDatePickerSecurity.SelectedDate != null) objData.Security = uiRadDatePickerSecurity.SelectedDate.Value; objData.Save(); } }