Exemplo n.º 1
0
        protected void rptApplications_ItemCommand(object obj, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "deleteCmd":
                var jobAppId = new Guid((string)e.CommandArgument);

                var jobApplication = _memberApplicationsQuery.GetInternalApplication(jobAppId);
                if (jobApplication == null)
                {
                    throw new ApplicationException("Failed to find job application with ID " + jobAppId);
                }

                var jobAd    = _jobAds[jobApplication.PositionId];
                var jobTitle = jobAd.Title;

                _jobAdApplicationSubmissionsCommand.RevokeApplication(jobAd, LoggedInMember.Id);

                AddConfirm("Your application for \"" + jobTitle + "\" was deleted successfully.");

                ReInitialiseApplications();
                break;

            default: throw new Exception("rptApplications_ItemCommand was called with undefined command name!");
            }

            var redirectUrl = ucPagingBar.GetRedirectUrlAfterRemovingItem(e.Item.ItemIndex);

            if (redirectUrl == null)
            {
                // Refresh the list of job applications now that one has been removed.

                InitialiseApplications();
            }
            else
            {
                NavigationManager.Redirect(redirectUrl);
            }
        }