コード例 #1
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            if (txtTicketPrice.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Enter Ticket Price.','Add Event Details');</script>", false);
                return;
            }

            if (txtTicketType.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Enter Ticket Type.','Add Event Details');</script>", false);
                return;
            }

            if (txtTotalSeats.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Enter Total Seats.','Add Event Details');</script>", false);
                return;
            }

            if (hdEventSPID.Value == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Session Expired.','Add Event Details');</script>", false);
                Response.Redirect("/viewevent.aspx", false);
                return;
            }

            using (TicketTypeViewModel ttm = new TicketTypeViewModel())
            {
                bool RetVal = false ;
                RetVal = ttm.CheckTicketName(txtTicketType.Text, hdEventSPID.Value.ToString());

                if (RetVal == false)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Ticket Type alerady Exists.','Add Event Details');</script>", false);
                    GetTicketDetails();
                    return;
                }

                RetVal = ttm.AddTickets(txtTicketType.Text, txtTicketPrice.Text, hdEventSPID.Value.ToString(), Convert.ToInt32(txtTotalSeats.Text));

                if (RetVal == true)
                {
                    EventsEntryPageViewModel eep = new EventsEntryPageViewModel();
                    eep.GenerateBarCode(hdEventSPID.Value, txtTicketType.Text);
                    eep = null;

                    txtTicketPrice.Text = "";
                    txtTicketType.Text = "";
                    txtTotalSeats.Text = "";
                    hdEventID.Value = "";

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Event Saved Sucessfully.','Add Event Details');</script>", false);
                    GetTicketDetails();
                }
            }
        }
コード例 #2
0
        protected void btnUpdate_ServerClick(object sender, EventArgs e)
        {
            if (txtTicketPrice.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Enter Ticket Price.','Add Event Details');</script>", false);
                return;
            }

            if (txtTicketType.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Enter Ticket Type.','Add Event Details');</script>", false);
                return;
            }

            if (txtTotalSeats.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Enter Total Seats.','Add Event Details');</script>", false);
                return;
            }

            if (hdEventID.Value == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Select Ticket Type to Edit.','Add Event Details');</script>", false);
                return;
            }

            using (TicketTypeViewModel ttm = new TicketTypeViewModel())
            {
                bool RetVal = ttm.UpdateTicketType(txtTicketType.Text, txtTicketPrice.Text, Convert.ToInt32(hdEventID.Value), Convert.ToInt32(txtTotalSeats.Text));

                if (RetVal == true)
                {
                    EventsEntryPageViewModel eep = new EventsEntryPageViewModel();
                    eep.GenerateBarCode(hdEventSPID.Value, txtTicketType.Text);
                    eep = null;

                    txtTicketPrice.Text = "";
                    txtTicketType.Text = "";
                    txtTotalSeats.Text = "";
                    hdEventID.Value = "";

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Event Saved Sucessfully.','Add Event Details');</script>", false);
                    GetTicketDetails();
                }
            }
        }
コード例 #3
0
        private void GetEventDetails()
        {
            using (TicketTypeViewModel ttm = new TicketTypeViewModel())
            {
                string ticketFromTime="";
                string ticketToTime = "";
                string EventName= "";
                ttm.TicketDetails(hdEventSPID.Value, out ticketFromTime, out ticketToTime, out  EventName);
                lblEventName.Text = EventName;
                lblEventTime.Text = ticketFromTime + " - " + ticketToTime;

            }
        }
コード例 #4
0
        protected void gvTicketDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            using (TicketTypeViewModel ttm = new TicketTypeViewModel())
            {
                bool RetVal = ttm.DeleteTicket(Convert.ToInt32(gvTicketDetails.Rows[e.RowIndex].Cells[1].Text));

                if (RetVal == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Event Deleted Sucessfully.','Add Event Details');</script>", false);
                    GetTicketDetails();
                }
            }
        }