Exemplo n.º 1
0
    protected void btnAddShow_Click(object sender, EventArgs e)
    {
        ReadFormFields();
        StoreCommon();
        if (ValidateShow())
        {
            MembershipUser userInfo = Membership.GetUser();
            Guid           user_ID  = (Guid)userInfo.ProviderUserKey;

            if (!string.IsNullOrEmpty(Club_ID))
            {
                Guid club_ID  = new Guid(Club_ID);
                Guid venue_ID = new Guid(Venue_ID);

                Shows show = new Shows(_connString);
                show.Club_ID           = club_ID;
                show.Show_Year_ID      = Convert.ToInt32(lstShowYears.SelectedValue);
                show.Show_Type_ID      = Convert.ToInt32(lstShowTypes.SelectedValue);
                show.Venue_ID          = venue_ID;
                show.Show_Name         = txtShowName.Text;
                show.Show_Opens        = DateTime.Parse(Request.Form[txtShowDateTime.UniqueID]);
                show.Judging_Commences = DateTime.Parse(Request.Form[txtJudgingDateTime.UniqueID]);
                show.Closing_Date      = DateTime.Parse(Request.Form[txtCloseDateTime.UniqueID]);
                short res;
                if (short.TryParse(txtMaxClassesPerDog.Text, out res))
                {
                    show.MaxClassesPerDog = res;
                }

                Guid?show_ID = show.Insert_Show(user_ID);

                if (show_ID != null)
                {
                    Show_ID           = show_ID.ToString();
                    Common.Show_ID    = Show_ID;
                    MessageLabel.Text = "The show was added successfully";
                    //ClearEntryFields();
                    PopulateShowGridView(Club_ID);
                    if (!string.IsNullOrEmpty(btnReturn.PostBackUrl))
                    {
                        DivReturn.Visible     = true;
                        divAddClasses.Visible = true;
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateShow())
            {
                Shows show = new Shows(_connString);
                show.Club_ID           = _clubID;
                show.Show_Year_ID      = Convert.ToInt32((cboShowYears.SelectedItem as ComboBoxItem).Value.ToString());
                show.Show_Type_ID      = Convert.ToInt32((cboShowType.SelectedItem as ComboBoxItem).Value.ToString());
                show.Venue_ID          = new Guid((cboVenue.SelectedItem as ComboBoxItem).Value.ToString());
                show.Show_Name         = txtShowName.Text;
                show.Show_Opens        = DateTime.Parse(string.Format("{0} {1}", dteShowDate.Value.ToString("yyyy-MM-dd"), dteShowTime.Value.ToString("hh:mm")));
                show.Judging_Commences = DateTime.Parse(string.Format("{0} {1}", dteShowDate.Value.ToString("yyyy-MM-dd"), dteJudgingCommences.Value.ToString("hh:mm")));
                show.Closing_Date      = dteEntryClosingDate.Value;
                short res;
                if (short.TryParse(numClassesPerDog.Text, out res))
                {
                    show.MaxClassesPerDog = res;
                }

                if (_showID == new Guid())
                {
                    Guid?show_ID = show.Insert_Show(_user_ID);

                    if (show_ID != null)
                    {
                        MessageLabel.Text = "The show was added successfully";
                    }
                }
                else
                {
                    if (!show.Update_Show(_showID, _user_ID))
                    {
                        MessageLabel.Text = "The show was saved successfully";
                    }
                }
            }
        }