Ejemplo n.º 1
0
        /// <summary>
        /// Finds the gig by gig identifier.
        /// The gig is stored in context and the request is redirected
        /// to ShowGigByAccID which will show it.
        /// </summary>
        /// <param name="gigIdentifier">The gig identifier.</param>
        private void FindGigByGigIdentifier(int gigIdentifier)
        {
            try
            {
                #region Unity

                /* Get the Service */
                IUnityContainer container  = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                IGigService     gigService = container.Resolve <IGigService>();

                Gig       gig       = gigService.FindGig(gigIdentifier);
                MusicType musicType = gigService.FindMusicType(gig.typeId);
                #endregion

                #region Delegate on factories
                ///* Create an "GigService". */
                //IGigService gigService = GigServiceFactory.GetService();

                ///* Get Gig Data */
                //GigVO gig = gigService.FindGig(gigIdentifier);

                #endregion

                /* Attach data to context */
                Context.Items.Add("gig", gig);
                Context.Items.Add("musicType", musicType);

                /* Redirect to Visualization WebForm */
                Server.Transfer(Response.ApplyAppPathModifier("./ShowGigByGigID.aspx"));
            }
            catch (InstanceNotFoundException)
            {
                lblIdentifierError.Visible = true;
            }
        }
Ejemplo n.º 2
0
        protected void BtnRemoveClick(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                /* Get identifier. */
                int gigIdentifier = Convert.ToInt32(txtIdentifier.Text);

                /* Do action. */
                try
                {
                    #region Unity
                    /* Get the Service */
                    IUnityContainer container  = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                    IGigService     gigService = container.Resolve <IGigService>();
                    gigService.RemoveGig(gigIdentifier);
                    #endregion

                    #region Delegate on factories
                    /* Create an "GigService". */
                    //IGigService gigService = GigServiceFactory.GetService();
                    //gigService.RemoveGig(gigIdentifier);
                    #endregion


                    Response.Redirect(Response.ApplyAppPathModifier("./SuccessfulOperation.aspx"));
                }
                catch (InstanceNotFoundException)
                {
                    lblIdentifierError.Visible = true;
                }
            }
        }
Ejemplo n.º 3
0
        protected void PbpDataSource_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
        {
            /* Get the Service */
            IUnityContainer container = (IUnityContainer)
                                        HttpContext.Current.Application["unityContainer"];

            // gigService is not resolved against the container because it
            // produce a proxy that it not available for databinding
            IGigService gigService = new GigService();

            gigService = (IGigService)
                         container.BuildUp(gigService.GetType(), gigService);

            e.ObjectInstance = gigService;
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Dependency Injection

                /* Get the Service */
                IUnityContainer container = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                gigService = container.Resolve <IGigService>();

                #endregion

                List <MusicType> types = gigService.GetMusicTypes();
                this.ddlGigType.DataSource     = types;
                this.ddlGigType.DataTextField  = "description";
                this.ddlGigType.DataValueField = "typeId";
                this.ddlGigType.DataBind();
            }
        }
Ejemplo n.º 5
0
        protected void BtnCreateClick(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                /* Create a Gig. */
                String nameGig = txtGigName.Text;

                DateTime gigDate = Convert.ToDateTime(txtCal.Text);

                byte musicTypeId = Byte.Parse(this.ddlGigType.SelectedItem.Value);
                Gig  gig         = Gig.CreateGig(-1, nameGig, gigDate, musicTypeId);


                Gig createdGig;

                #region Delegate on factories
                /* Create an "GigService". */
                //IGigService gigService = GigServiceFactory.GetService();


                #endregion

                #region Dependency Injection

                /* Get the Service */
                IUnityContainer container = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                gigService = container.Resolve <IGigService>();

                #endregion

                createdGig = gigService.CreateGig(gig);

                Context.Items.Add("createdGig", createdGig);

                LogManager.RecordMessage("Gig " + createdGig.gigId + " created.", MessageType.Info);

                Server.Transfer(Response.ApplyAppPathModifier("./GigCreated.aspx"));
            }
        }
Ejemplo n.º 6
0
 public GigsController(IGigService gigService, IMapper mapper)
 {
     this.gigService = gigService;
     this.mapper     = mapper;
 }
Ejemplo n.º 7
0
 public GigsController(IGigService gigservice)
 {
     _gigService = gigservice;
 }
Ejemplo n.º 8
0
 public static void Init()
 {
     container  = TestManager.ConfigureUnityContainer("unity");
     gigService = container.Resolve <IGigService>();
 }
Ejemplo n.º 9
0
 public GigsController(IGigService gigService, ILogger <GigsController> logger)
 {
     this.gigService = gigService;
     this._logger    = logger;
 }
Ejemplo n.º 10
0
        internal virtual IGigService CreateIGigService()
        {
            IGigService target = null;

            return(target);
        }
Ejemplo n.º 11
0
 public static void MyClassInitialize(TestContext testContext)
 {
     container  = TestManager.ConfigureUnityContainer("unity");
     gigService = container.Resolve <IGigService>();
 }