示例#1
0
        /// <summary>
        /// This event fires when the user click on the Cancel Button
        ///     It turns off all the controls to make up Crews
        ///     It deletes the crew that is currently being formed
        ///     It refreshes the Current Crews List
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Cancel_Click(object sender, EventArgs e)
        {
            EmployeeGridView.Visible = false;
            SelectUnitDDL.Visible    = false;
            FleetCategory.ClearSelection();
            Done.Visible          = false;
            Cancel.Visible        = false;
            CreateCrew.Visible    = false;
            MakeCrew.Visible      = true;
            LastCrews.Visible     = true;
            FleetCategory.Visible = false;

            //Deletes the crew in formation.
            InfoUserControl.TryRun(() =>
            {
                if (!string.IsNullOrEmpty(CrewID.Text))
                {
                    int crewId = int.Parse(CrewID.Text);
                    CrewController crewManager = new CrewController();
                    crewManager.DeleteCrew(crewId);
                    CrewID.Text = "";
                    RefreshCurrentCrews();
                }
            });
        }
示例#2
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;
            }
        }