Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void AllCurrentCrews_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string caller = e.CommandName;

            switch (caller)
            {
            case "SelectedCrew":
                CrewID.Text = e.CommandArgument.ToString();
                string crew = "";
                SiteMenu.Visible = true;
                Done.Visible     = true;
                JobCardStatusGridView.Visible = false;
                JobcardTitle.Visible          = false;
                UnitReoprtGV.Visible          = false;
                UnitReportHeader.Visible      = false;
                InfoUserControl.TryRun(() =>
                {
                    FleetController fleet = new FleetController();
                    crew = fleet.GetUnitDescription(int.Parse(CrewID.Text));
                });
                InfoUserControl.ShowInfo("You are updating crew " + crew + "");
                RefreshCrewMember();
                break;

            case "RemoveMember":
                InfoUserControl.TryRun(() =>
                {
                    CrewController crewManager = new CrewController();
                    crewManager.RemoveCrewMember(int.Parse(e.CommandArgument.ToString()), int.Parse(CrewID.Text));
                    RefreshCurrentCrews();
                });
                break;

            case "DeleteJobCard":
                InfoUserControl.TryRun(() =>
                {
                    CrewController crewManager = new CrewController();
                    crewManager.DeleteJobCardCrew(int.Parse(e.CommandArgument.ToString()));
                    RefreshCurrentCrews();
                });
                break;

            case "DeleteCrew":
                MessageUserControl.TryRun(() =>
                {
                    CrewController crewManager = new CrewController();
                    crewManager.DeleteCrew(int.Parse(e.CommandArgument.ToString()));
                    RefreshCurrentCrews();
                    PopulateUnitReport();
                    PopulateRouteStatus();
                });
                break;
            }
        }