Exemplo n.º 1
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            ShowService service = new ShowService(Ioc.GetInstance <IShowRepository>());

            bool     success = false;
            short?   rank;
            DateTime?showDate;
            Guid?    showId = null;
            Guid?    tourId = null;

            if (Validated(out rank, out showDate))
            {
                //order = ddlOrder.SelectedValue != "0" ? (short?)short.Parse(ddlOrder.SelectedValue) : null;

                if (string.IsNullOrEmpty(txtGuid.Text))
                {
                    showId = Guid.NewGuid();
                }
                else
                {
                    showId = new Guid(txtGuid.Text);
                }

                Show show = new Show()
                {
                    ShowId = showId.Value,
                    //ShowName = txtShowName.Text.Trim(),
                    VenueName = txtVenueName.Text.Trim(),
                    City      = txtCity.Text.Trim(),
                    State     = ddlStates.SelectedValue.Trim(),
                    Country   = ddlCountry.Text.Trim(),
                    //Order = order,
                    //TicketPrice = ticketPrice,
                    Notes    = txtNotes.Text.Trim(),
                    ShowDate = showDate,
                    //Official = chkOfficial.Checked,
                    UserId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()),
                    TourId = tourId
                };

                service.SaveCommit(show, out success);
            }

            if (success)
            {
                lnkAddSetsToShow.NavigateUrl = LinkBuilder.AddSetsToShowLink(showId.Value);
                phAddSetsToShow.Visible      = true;
                phSuccess.Visible            = true;
                phError.Visible = false;
            }
            else
            {
                phError.Visible   = true;
                phSuccess.Visible = false;
            }
        }