Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            mvStatus.SetActiveView(vwNoClub);   // default

            AircraftID = util.GetIntParam(Request, "ac", Aircraft.idAircraftUnknown);

            if (AircraftID != Aircraft.idAircraftUnknown && Page.User.Identity.IsAuthenticated && !String.IsNullOrEmpty(Page.User.Identity.Name))
            {
                IEnumerable <Club> lstClubsForAircraft       = null;
                IEnumerable <Club> lstClubsForUserInAircraft = Club.ClubsForAircraft(AircraftID, Page.User.Identity.Name);
                Aircraft           ac = new Aircraft(AircraftID);
                lblTailNumber.Text = lblTailNumber2.Text = lblTailNumber3.Text = ac.DisplayTailnumber;
                if (lstClubsForUserInAircraft.Count() > 0)
                {
                    mvStatus.SetActiveView(vwMember);
                    rptSchedules.DataSource = lstClubsForUserInAircraft;
                    rptSchedules.DataBind();
                }
                else if ((lstClubsForAircraft = Club.ClubsForAircraft(AircraftID)).Count() > 0)   // if the aircraft belongs to a club but you don't, show those clubs
                {
                    mvStatus.SetActiveView(vwNotMember);
                    rptClubsForAircraft.DataSource = lstClubsForAircraft;
                    rptClubsForAircraft.DataBind();
                }
            }
        }
    }
    /// <summary>
    /// Displays any club schedules for this aircraft
    /// </summary>
    protected void SetUpSchedules()
    {
        if (!Page.User.Identity.IsAuthenticated || m_ac.IsNew)
        {
            return;
        }

        IEnumerable <Club> lstClubs = Club.ClubsForAircraft(m_ac.AircraftID, Page.User.Identity.Name);

        if (lstClubs.Count() > 0)
        {
            rowClubSchedules.Visible = true;
            rptSchedules.DataSource  = lstClubs;
            rptSchedules.DataBind();

            // If *any* club has policy PrependsScheduleWithOwnerName, set the default text for it
            foreach (Club c in lstClubs)
            {
                if (c.PrependsScheduleWithOwnerName)
                {
                    mfbEditAppt1.DefaultTitle = MyFlightbook.Profile.GetUser(Page.User.Identity.Name).UserFullName;
                    break;
                }
            }
        }
    }
    /// <summary>
    /// Displays any club schedules for this aircraft
    /// </summary>
    protected void SetUpSchedules()
    {
        if (!Page.User.Identity.IsAuthenticated || m_ac.IsNew)
        {
            return;
        }

        IEnumerable <Club> lstClubs = Club.ClubsForAircraft(m_ac.AircraftID, Page.User.Identity.Name);

        if (lstClubs.Count() > 0)
        {
            rowClubSchedules.Visible = true;
            rptSchedules.DataSource  = lstClubs;
            rptSchedules.DataBind();
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            mvStatus.SetActiveView(vwNoClub);   // default

            AircraftID = util.GetIntParam(Request, "ac", Aircraft.idAircraftUnknown);

            if (AircraftID != Aircraft.idAircraftUnknown && Page.User.Identity.IsAuthenticated && !String.IsNullOrEmpty(Page.User.Identity.Name))
            {
                IEnumerable <Club> lstClubsForAircraft       = null;
                IEnumerable <Club> lstClubsForUserInAircraft = Club.ClubsForAircraft(AircraftID, Page.User.Identity.Name);
                Aircraft           ac = new Aircraft(AircraftID);
                lblTailNumber.Text = lblTailNumber2.Text = lblTailNumber3.Text = ac.DisplayTailnumber;
                if (lstClubsForUserInAircraft.Count() > 0)
                {
                    mvStatus.SetActiveView(vwMember);
                    rptSchedules.DataSource = lstClubsForUserInAircraft;
                    rptSchedules.DataBind();

                    // If *any* club has policy PrependsScheduleWithOwnerName, set the default text for it
                    foreach (Club c in lstClubsForUserInAircraft)
                    {
                        if (c.PrependsScheduleWithOwnerName)
                        {
                            mfbEditAppt1.DefaultTitle = MyFlightbook.Profile.GetUser(Page.User.Identity.Name).UserFullName;
                            break;
                        }
                    }
                }
                else if ((lstClubsForAircraft = Club.ClubsForAircraft(AircraftID)).Count() > 0)   // if the aircraft belongs to a club but you don't, show those clubs
                {
                    mvStatus.SetActiveView(vwNotMember);
                    rptClubsForAircraft.DataSource = lstClubsForAircraft;
                    rptClubsForAircraft.DataBind();
                }
            }
        }
    }