Пример #1
0
        protected void EventList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "delete")
                {
                    EventsEntryPageViewModel _eventMasterDAL = new EventsEntryPageViewModel();
                    if (_eventMasterDAL.DeleteEventDetails(e.CommandArgument.ToString(), "TRUE") == true)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Event Deleted Sucessfully.','Add Event Details');</script>", false);
                    }

                    GetEventList(0, 20, 0, "");
                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script language='javascript'>");
                sb.Append(@"alert('Error : " + ex.Message + "')");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", sb.ToString(), false);
            }
        }
Пример #2
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();
                }
            }
        }
Пример #3
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();
                }
            }
        }
Пример #4
0
        private void GetTicketDetails()
        {
            try
            {
                EventsEntryPageViewModel eventsEntryPageViewModel = new EventsEntryPageViewModel();
                List<EventPriceDetailsModel> _eventPriceDetailsModel = new List<EventPriceDetailsModel>();
                _eventPriceDetailsModel = eventsEntryPageViewModel.GetEventPriceDetails(Request.QueryString["EO"]);
                gvTicketDetails.DataSource = _eventPriceDetailsModel;
                gvTicketDetails.DataBind();

                GetEventDetails();
            }
            catch (Exception EX)
            {

            }
        }
Пример #5
0
        private void EditEventDetails(string EventSPID)
        {
            try
            {
                EventsEntryPageViewModel eventsEntryPageViewModel = new EventsEntryPageViewModel();
                EventMasterModel _eventMasterModel = new EventMasterModel();

                _eventMasterModel = eventsEntryPageViewModel.GetEventDetails(EventSPID);

                if (_eventMasterModel != null)
                {
                    txtEventTitle.Value = _eventMasterModel.EventTitle;
                    txtEventDesc.Value = _eventMasterModel.EventDesc;
                    txtArtist.Value = _eventMasterModel.Artists;
                    txtGenre.Value = _eventMasterModel.Genre;
                    txtEventDate.Value = _eventMasterModel.EventDate;
                    ddEventType.SelectedValue = _eventMasterModel.EventTypeID;
                    GetEventSubType(Convert.ToInt32(_eventMasterModel.EventTypeID));

                    img_prev.Src = _eventMasterModel.ImagePath;
                    imgSmallImg.Src = _eventMasterModel.SmallImagePath;
                    ImgTicketImage.Src = _eventMasterModel.EventLayout;

                    ddEvebtSubType.SelectedValue = _eventMasterModel.EventSubtypeID;
                    ddVenueDetails.SelectedValue = _eventMasterModel.VenueID;
                    hdEventID.Value = _eventMasterModel.EventID;

                    hdImagePath.Value = _eventMasterModel.ImagePath;
                    hdEventImagePath.Value = _eventMasterModel.SmallImagePath;
                    hdTicketImagePath.Value = _eventMasterModel.EventLayout;

                    txtEventDate.Value = Convert.ToDateTime(_eventMasterModel.EventDate).ToString("dd/MMM/yyyy");
                }

                EventTimeDetailsModel _eventTimeDetailsModel = new EventTimeDetailsModel();
                _eventTimeDetailsModel = eventsEntryPageViewModel.GetEventTimeDetails(EventSPID);

                if (_eventTimeDetailsModel != null)
                {
                    txtFromTime.Value = _eventTimeDetailsModel.EventFromTime.ToString("HH:mm");
                    txtTotTime.Value = _eventTimeDetailsModel.EventToTime.ToString("HH:mm");
                    EventTimeID.Value = _eventTimeDetailsModel.EventTimeID.ToString();
                }

                List<EventPriceDetailsModel> _eventPriceDetailsModel = new List<EventPriceDetailsModel>();
                _eventPriceDetailsModel = eventsEntryPageViewModel.GetEventPriceDetails(EventSPID);

                int i = 1;

                if (_eventPriceDetailsModel != null)
                {
                    foreach (var item in _eventPriceDetailsModel)
                    {
                        if (i == 1)
                        {
                            EPID1.Value = item.EventPriceID;
                            txtTicketType1.Value = item.EventPriceDetails;
                            txtTotalSeat1.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice1.Value = item.EventPrice;
                        }

                        if (i == 2)
                        {
                            EPID2.Value = item.EventPriceID;
                            txtTicketType2.Value = item.EventPriceDetails;
                            txtTotalSeat2.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice2.Value = item.EventPrice;
                        }

                        if (i == 3)
                        {
                            EPID3.Value = item.EventPriceID;
                            txtTicketType3.Value = item.EventPriceDetails;
                            txtTotalSeat3.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice3.Value = item.EventPrice;
                        }

                        if (i == 4)
                        {
                            EPID4.Value = item.EventPriceID;
                            txtTicketType4.Value = item.EventPriceDetails;
                            txtTotalSeat4.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice4.Value = item.EventPrice;
                        }

                        if (i == 5)
                        {
                            EPID5.Value = item.EventPriceID;
                            txtTicketType5.Value = item.EventPriceDetails;
                            txtTotalSeat5.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice5.Value = item.EventPrice;
                        }

                        if (i == 6)
                        {
                            EPID6.Value = item.EventPriceID;
                            txtTicketType6.Value = item.EventPriceDetails;
                            txtTotalSeat6.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice6.Value = item.EventPrice;
                        }

                        if (i == 7)
                        {
                            EPID7.Value = item.EventPriceID;
                            txtTicketType7.Value = item.EventPriceDetails;
                            txtTotalSeat7.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice7.Value = item.EventPrice;
                        }

                        if (i == 8)
                        {
                            EPID8.Value = item.EventPriceID;
                            txtTicketType8.Value = item.EventPriceDetails;
                            txtTotalSeat8.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice8.Value = item.EventPrice;
                        }

                        if (i == 9)
                        {
                            EPID9.Value = item.EventPriceID;
                            txtTicketType9.Value = item.EventPriceDetails;
                            txtTotalSeat9.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice9.Value = item.EventPrice;
                        }

                        if (i == 10)
                        {
                            EPID10.Value = item.EventPriceID;
                            txtTicketType10.Value = item.EventPriceDetails;
                            txtTotalSeat10.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice10.Value = item.EventPrice;
                        }

                        if (i == 11)
                        {
                            EPID11.Value = item.EventPriceID;
                            txtTicketType11.Value = item.EventPriceDetails;
                            txtTotalSeat11.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice11.Value = item.EventPrice;
                        }

                        if (i == 12)
                        {
                            EPID12.Value = item.EventPriceID;
                            txtTicketType12.Value = item.EventPriceDetails;
                            txtTotalSeat12.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice12.Value = item.EventPrice;
                        }

                        if (i == 13)
                        {
                            EPID13.Value = item.EventPriceID;
                            txtTicketType13.Value = item.EventPriceDetails;
                            txtTotalSeat13.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice13.Value = item.EventPrice;
                        }

                        if (i == 14)
                        {
                            EPID14.Value = item.EventPriceID;
                            txtTicketType14.Value = item.EventPriceDetails;
                            txtTotalSeat14.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice14.Value = item.EventPrice;
                        }

                        if (i == 15)
                        {
                            EPID15.Value = item.EventPriceID;
                            txtTicketType15.Value = item.EventPriceDetails;
                            txtTotalSeat15.Value = item.EventTotalSeat.ToString();
                            txtTicketPrice15.Value = item.EventPrice;
                        }

                        i++;
                    }
                }

                btnSave.Visible = false;
                btnUpdate.Visible = true;
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script language='javascript'>");
                sb.Append(@"alert('Error : " + ex.Message + "')");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", sb.ToString(), false);
            }
        }
Пример #6
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (ValidatePage() == true)
                {
                    //BIG IMAGE

                    string s = filenm.Value;
                    string[] file = s.Split('.');
                    string t = file[file.Length - 1].ToString();
                    string ext = "";

                    var r = new Random();
                    string d = DateTime.Now.ToString("ddMMyyhhmmss") + r.Next(100);
                    ext = "E" + d;

                    string baseImageLocation = Server.MapPath("~\\ShowlineImages\\");
                    HttpFileCollection files = Request.Files;
                    HttpPostedFile httpPostedFile = files["filenm"];
                    string fileExt = Path.GetExtension(httpPostedFile.FileName).ToLower();
                    string fileName = Path.GetFileName(httpPostedFile.FileName);

                    //SMALL IMAGE

                    string sm = filesmallimage.Value;
                    string[] filesm = sm.Split('.');
                    string tsm = filesm[filesm.Length - 1].ToString();
                    string extSM = "";

                    string dsm = DateTime.Now.ToString("ddMMyyhhmmss") + r.Next(100);
                    extSM = "S" + dsm;

                    string baseImageLocationsm = Server.MapPath("~\\ShowlineImages\\");
                    HttpFileCollection filessm = Request.Files;
                    HttpPostedFile httpPostedFilesm = filessm["filesmallimage"];
                    string fileExtsm = Path.GetExtension(httpPostedFilesm.FileName).ToLower();
                    string fileNamesm = Path.GetFileName(httpPostedFilesm.FileName);

                    // TICKET IMAGE

                    string sTm = filebackgroundimage.Value;
                    string[] filesTm = sTm.Split('.');
                    string tsTm = filesTm[filesTm.Length - 1].ToString();
                    string extSTM = "";

                    string dsTm = DateTime.Now.ToString("ddMMyyhhmmss") + r.Next(100);
                    extSTM = "T" + dsTm;

                    string baseImageLocationsTm = Server.MapPath("~\\ShowlineImages\\");
                    HttpFileCollection filessTm = Request.Files;
                    HttpPostedFile httpPostedFilesTm = filessTm["filebackgroundimage"];
                    string fileExtsTm = Path.GetExtension(httpPostedFilesTm.FileName).ToLower();
                    string fileNamesTm = Path.GetFileName(httpPostedFilesTm.FileName);
                    //

                    EventsEntryPageViewModel _eventMasterDAL = new EventsEntryPageViewModel();
                    EventMasterModel eventMasterModel = new EventMasterModel();
                    List<EventTimeDetailsModel> eventTimeDetailsModel = new List<EventTimeDetailsModel>();

                    List<EventPriceDetailsModel> eventPriceDetailsModel = new List<EventPriceDetailsModel>();

                    eventMasterModel.EventTypeID = ddEventType.SelectedItem.Value;
                    eventMasterModel.EventSubtypeID = ddEvebtSubType.SelectedItem.Value.ToString();
                    eventMasterModel.VenueID = ddVenueDetails.SelectedItem.Value;
                    eventMasterModel.EventTitle = txtEventTitle.Value.Trim();
                    eventMasterModel.EventDesc = txtEventDesc.Value.Trim();
                    eventMasterModel.Artists = txtArtist.Value.Trim();
                    eventMasterModel.Genre = txtGenre.Value.Trim();
                    eventMasterModel.ImagePath = "/ShowlineImages/" + ext + "." + file[file.Length - 1].ToString();
                    eventMasterModel.SmallImagePath = "/ShowlineImages/" + extSM + "." + filesm[filesm.Length - 1].ToString();
                    eventMasterModel.EventLayout = "/ShowlineImages/" + extSTM + "." + filesTm[filesTm.Length - 1].ToString();
                    eventMasterModel.EventID = ext;
                    eventMasterModel.EventDate = txtEventDate.Value;

                    eventTimeDetailsModel.Add(new EventTimeDetailsModel
                        {
                            EventFromTime = Convert.ToDateTime(txtFromTime.Value),
                            EventToTime = Convert.ToDateTime(txtTotTime.Value)
                        });

                    if (txtTicketType1.Value.Trim() != "" || txtTotalSeat1.Value.Trim() != "" || txtTicketPrice1.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType1.Value.Trim(), EventPrice = txtTicketPrice1.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat1.Value.Trim()) });
                    }

                    if (txtTicketType2.Value.Trim() != "" || txtTotalSeat2.Value.Trim() != "" || txtTicketPrice2.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType2.Value.Trim(), EventPrice = txtTicketPrice2.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat2.Value.Trim()) });
                    }

                    if (txtTicketType3.Value.Trim() != "" || txtTotalSeat3.Value.Trim() != "" || txtTicketPrice3.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType3.Value.Trim(), EventPrice = txtTicketPrice3.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat3.Value.Trim()) });
                    }

                    if (txtTicketType4.Value.Trim() != "" || txtTotalSeat4.Value.Trim() != "" || txtTicketPrice4.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType4.Value.Trim(), EventPrice = txtTicketPrice4.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat4.Value.Trim()) });
                    }

                    if (txtTicketType5.Value.Trim() != "" || txtTotalSeat5.Value.Trim() != "" || txtTicketPrice5.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType5.Value.Trim(), EventPrice = txtTicketPrice5.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat5.Value.Trim()) });
                    }

                    if (txtTicketType6.Value.Trim() != "" || txtTotalSeat6.Value.Trim() != "" || txtTicketPrice6.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType6.Value.Trim(), EventPrice = txtTicketPrice6.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat6.Value.Trim()) });
                    }

                    if (txtTicketType7.Value.Trim() != "" || txtTotalSeat7.Value.Trim() != "" || txtTicketPrice7.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType7.Value.Trim(), EventPrice = txtTicketPrice7.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat7.Value.Trim()) });
                    }

                    if (txtTicketType8.Value.Trim() != "" || txtTotalSeat8.Value.Trim() != "" || txtTicketPrice8.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType8.Value.Trim(), EventPrice = txtTicketPrice8.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat8.Value.Trim()) });
                    }

                    if (txtTicketType9.Value.Trim() != "" || txtTotalSeat9.Value.Trim() != "" || txtTicketPrice9.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType9.Value.Trim(), EventPrice = txtTicketPrice9.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat9.Value.Trim()) });
                    }

                    if (txtTicketType10.Value.Trim() != "" || txtTotalSeat10.Value.Trim() != "" || txtTicketPrice10.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType10.Value.Trim(), EventPrice = txtTicketPrice10.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat10.Value.Trim()) });
                    }

                    if (txtTicketType11.Value.Trim() != "" || txtTotalSeat11.Value.Trim() != "" || txtTicketPrice11.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType11.Value.Trim(), EventPrice = txtTicketPrice11.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat11.Value.Trim()) });
                    }

                    if (txtTicketType12.Value.Trim() != "" || txtTotalSeat12.Value.Trim() != "" || txtTicketPrice12.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType12.Value.Trim(), EventPrice = txtTicketPrice12.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat12.Value.Trim()) });
                    }

                    if (txtTicketType13.Value.Trim() != "" || txtTotalSeat13.Value.Trim() != "" || txtTicketPrice13.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType13.Value.Trim(), EventPrice = txtTicketPrice13.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat13.Value.Trim()) });
                    }

                    if (txtTicketType14.Value.Trim() != "" || txtTotalSeat14.Value.Trim() != "" || txtTicketPrice14.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType14.Value.Trim(), EventPrice = txtTicketPrice14.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat14.Value.Trim()) });
                    }

                    if (txtTicketType15.Value.Trim() != "" || txtTotalSeat15.Value.Trim() != "" || txtTicketPrice15.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType15.Value.Trim(), EventPrice = txtTicketPrice15.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat15.Value.Trim()) });
                    }

                    if (_eventMasterDAL.InsertEventMaster(eventMasterModel, eventTimeDetailsModel, eventPriceDetailsModel) == true)
                    {
                        if (fileName != "")
                        {
                            httpPostedFile.SaveAs(baseImageLocation + ext + "." + file[file.Length - 1].ToString());
                        }

                        if (fileNamesm != "")
                        {
                            httpPostedFilesm.SaveAs(baseImageLocationsm + extSM + "." + filesm[filesm.Length - 1].ToString());
                        }

                        if (fileExtsTm != "")
                        {
                            httpPostedFilesTm.SaveAs(baseImageLocationsTm + extSTM + "." + filesTm[filesTm.Length - 1].ToString());
                        }

                        ClearAllControl();
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Event Saved Sucessfully.','Add Event Details');</script>", false);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ErrorMsg('Unexpected error occured.Plese refresh the page and try again!','Add Event Details');</script>", false);
                    }

                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script language='javascript'>");
                sb.Append(@"alert('Error : " + ex.Message + "')");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", sb.ToString(), false);
            }
        }
Пример #7
0
        protected void btnUpdate_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (ValidatePage() == true)
                {
                    string s = filenm.Value;
                    string[] file;
                    string ext = "";

                    if (s == "")
                    {
                        file = hdImagePath.Value.Split('.');
                    }
                    else
                    {
                        file = s.Split('.');

                    }

                    string t = file[file.Length - 1].ToString();
                    var r = new Random();
                    string d = hdEventID.Value;
                    ext = d;
                    string baseImageLocation = Server.MapPath("~\\ShowlineImages\\");
                    HttpFileCollection files = Request.Files;
                    HttpPostedFile httpPostedFile = files["filenm"];
                    string fileExt = Path.GetExtension(httpPostedFile.FileName).ToLower();
                    string fileName = Path.GetFileName(httpPostedFile.FileName);

                    #region SmallImagePath

                    string sm = filesmallimage.Value;
                    string[] filesm;
                    string extsm = "";
                    string dsm = "S" + hdEventID.Value.Substring(1, hdEventID.Value.Length - 1);

                    if (sm == "")
                    {
                        filesm = hdEventImagePath.Value.Split('.');
                    }
                    else
                    {
                        filesm = sm.Split('.');
                    }

                    string tsm = filesm[filesm.Length - 1].ToString();
                    r = new Random();

                    extsm = dsm;
                    string baseImageLocationsm = Server.MapPath("~\\ShowlineImages\\");
                    HttpFileCollection filessm = Request.Files;
                    HttpPostedFile httpPostedFilesm = filessm["filesmallimage"];
                    string fileExtsm = Path.GetExtension(httpPostedFilesm.FileName).ToLower();
                    string fileNamesm = Path.GetFileName(httpPostedFilesm.FileName);

                    #endregion

                    #region TicketImage

                    string sTm = filebackgroundimage.Value;
                    string[] filesTm;
                    string extsTm = "";
                    string dsTm = "T" + hdEventID.Value.Substring(1, hdEventID.Value.Length - 1);

                    if (sTm == "")
                    {
                        filesTm = hdTicketImagePath.Value.Split('.');
                    }
                    else
                    {
                        filesTm = sTm.Split('.');
                    }

                    string tTm = filesTm[filesTm.Length - 1].ToString();
                    r = new Random();

                    extsTm = dsTm;
                    string baseImageLocationsTm = Server.MapPath("~\\ShowlineImages\\");
                    HttpFileCollection filessTm = Request.Files;
                    HttpPostedFile httpPostedFilesTm = filessTm["filebackgroundimage"];
                    string fileExtsTm = Path.GetExtension(httpPostedFilesTm.FileName).ToLower();
                    string fileNamesTm = Path.GetFileName(httpPostedFilesTm.FileName);

                    #endregion

                    EventsEntryPageViewModel _eventMasterDAL = new EventsEntryPageViewModel();
                    EventMasterModel eventMasterModel = new EventMasterModel();
                    List<EventTimeDetailsModel> eventTimeDetailsModel = new List<EventTimeDetailsModel>();

                    List<EventPriceDetailsModel> eventPriceDetailsModel = new List<EventPriceDetailsModel>();

                    eventMasterModel.EventTypeID = ddEventType.SelectedItem.Value;
                    eventMasterModel.EventSubtypeID = ddEvebtSubType.SelectedItem.Value.ToString();
                    eventMasterModel.VenueID = ddVenueDetails.SelectedItem.Value;
                    eventMasterModel.EventTitle = txtEventTitle.Value.Trim();
                    eventMasterModel.EventDesc = txtEventDesc.Value.Trim();
                    eventMasterModel.Artists = txtArtist.Value.Trim();
                    eventMasterModel.Genre = txtGenre.Value.Trim();
                    eventMasterModel.ImagePath = "/ShowlineImages/" + ext + "." + file[file.Length - 1].ToString();
                    eventMasterModel.SmallImagePath = "/ShowlineImages/" + extsm + "." + filesm[filesm.Length - 1].ToString();
                    eventMasterModel.EventLayout = "/ShowlineImages/" + extsTm + "." + filesTm[filesTm.Length - 1].ToString();
                    eventMasterModel.EventID = ext;
                    eventMasterModel.EventDate = txtEventDate.Value;

                    eventTimeDetailsModel.Add(new EventTimeDetailsModel
                    {
                        EventFromTime = Convert.ToDateTime(txtFromTime.Value),
                        EventToTime = Convert.ToDateTime(txtTotTime.Value)
                        //EventFromTime = Convert.ToDateTime(txtEventDate.Value + " " + txtFromTime.Value),
                        //EventToTime = Convert.ToDateTime(txtEventDate.Value + " " + txtTotTime.Value)
                    });

                    if (txtTicketType1.Value.Trim() != "" || txtTotalSeat1.Value.Trim() != "" || txtTicketPrice1.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType1.Value.Trim(), EventPrice = txtTicketPrice1.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat1.Value.Trim()) });
                    }

                    if (txtTicketType2.Value.Trim() != "" || txtTotalSeat2.Value.Trim() != "" || txtTicketPrice2.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType2.Value.Trim(), EventPrice = txtTicketPrice2.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat2.Value.Trim()) });
                    }

                    if (txtTicketType3.Value.Trim() != "" || txtTotalSeat3.Value.Trim() != "" || txtTicketPrice3.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType3.Value.Trim(), EventPrice = txtTicketPrice3.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat3.Value.Trim()) });
                    }

                    if (txtTicketType4.Value.Trim() != "" || txtTotalSeat4.Value.Trim() != "" || txtTicketPrice4.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType4.Value.Trim(), EventPrice = txtTicketPrice4.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat4.Value.Trim()) });
                    }

                    if (txtTicketType5.Value.Trim() != "" || txtTotalSeat5.Value.Trim() != "" || txtTicketPrice5.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType5.Value.Trim(), EventPrice = txtTicketPrice5.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat5.Value.Trim()) });
                    }

                    if (txtTicketType6.Value.Trim() != "" || txtTotalSeat6.Value.Trim() != "" || txtTicketPrice6.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType6.Value.Trim(), EventPrice = txtTicketPrice6.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat6.Value.Trim()) });
                    }

                    if (txtTicketType7.Value.Trim() != "" || txtTotalSeat7.Value.Trim() != "" || txtTicketPrice7.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType7.Value.Trim(), EventPrice = txtTicketPrice7.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat7.Value.Trim()) });
                    }

                    if (txtTicketType8.Value.Trim() != "" || txtTotalSeat8.Value.Trim() != "" || txtTicketPrice8.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType8.Value.Trim(), EventPrice = txtTicketPrice8.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat8.Value.Trim()) });
                    }

                    if (txtTicketType9.Value.Trim() != "" || txtTotalSeat9.Value.Trim() != "" || txtTicketPrice9.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType9.Value.Trim(), EventPrice = txtTicketPrice9.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat9.Value.Trim()) });
                    }

                    if (txtTicketType10.Value.Trim() != "" || txtTotalSeat10.Value.Trim() != "" || txtTicketPrice10.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType10.Value.Trim(), EventPrice = txtTicketPrice10.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat10.Value.Trim()) });
                    }

                    if (txtTicketType11.Value.Trim() != "" || txtTotalSeat11.Value.Trim() != "" || txtTicketPrice11.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType11.Value.Trim(), EventPrice = txtTicketPrice11.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat11.Value.Trim()) });
                    }

                    if (txtTicketType12.Value.Trim() != "" || txtTotalSeat12.Value.Trim() != "" || txtTicketPrice12.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType12.Value.Trim(), EventPrice = txtTicketPrice12.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat12.Value.Trim()) });
                    }

                    if (txtTicketType13.Value.Trim() != "" || txtTotalSeat13.Value.Trim() != "" || txtTicketPrice13.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType13.Value.Trim(), EventPrice = txtTicketPrice13.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat13.Value.Trim()) });
                    }

                    if (txtTicketType14.Value.Trim() != "" || txtTotalSeat14.Value.Trim() != "" || txtTicketPrice14.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType14.Value.Trim(), EventPrice = txtTicketPrice14.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat14.Value.Trim()) });
                    }

                    if (txtTicketType15.Value.Trim() != "" || txtTotalSeat15.Value.Trim() != "" || txtTicketPrice15.Value.Trim() != "")
                    {
                        eventPriceDetailsModel.Add(new EventPriceDetailsModel { EventPriceDetails = txtTicketType15.Value.Trim(), EventPrice = txtTicketPrice15.Value.Trim(), EventTotalSeat = Convert.ToInt32(txtTotalSeat15.Value.Trim()) });
                    }

                    if (_eventMasterDAL.UpdateEventMaster(eventMasterModel, eventTimeDetailsModel) == true)
                    {
                        if (fileName != "")
                        {
                            //FileInfo fileInfoPath = new FileInfo(baseImageLocation + ext + "." + file[file.Length - 1].ToString());
                            //if (fileInfoPath.Exists)
                            //{
                            //    fileInfoPath.Delete();
                            //}

                            httpPostedFile.SaveAs(baseImageLocation + ext + "." + file[file.Length - 1].ToString());
                        }

                        if (fileNamesm != "")
                        {
                            httpPostedFilesm.SaveAs(baseImageLocation + extsm + "." + filesm[filesm.Length - 1].ToString());
                        }

                        if (fileNamesTm != "")
                        {
                            httpPostedFilesTm.SaveAs(baseImageLocation + extsTm + "." + filesTm[filesTm.Length - 1].ToString());
                        }

                        ClearAllControl();

                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Event Saved Sucessfully.','Add Event Details');</script>", false);
                        Response.Redirect("~/viewevent.aspx", false);
                        Context.ApplicationInstance.CompleteRequest();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ErrorMsg('Unexpected error occured.Plese refresh the page and try again!','Add Event Details');</script>", false);
                    }

                    //if (_eventMasterDAL.DeleteEventDetails(hdEventID.Value) == true)
                    //{

                    //    if (_eventMasterDAL.InsertEventMaster(eventMasterModel, eventTimeDetailsModel, eventPriceDetailsModel) == true)
                    //    {
                    //        if (fileName != "")
                    //        {
                    //            httpPostedFile.SaveAs(baseImageLocation + ext + "." + file[file.Length - 1].ToString());
                    //        }

                    //        if (fileNamesm != "")
                    //        {
                    //            httpPostedFilesm.SaveAs(baseImageLocation + extsm + "." + filesm[filesm.Length - 1].ToString());
                    //        }

                    //        if (fileNamesTm != "")
                    //        {
                    //            httpPostedFilesTm.SaveAs(baseImageLocation + extsTm + "." + filesTm[filesTm.Length - 1].ToString());
                    //        }

                    //        ClearAllControl();

                    //        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ConfirmMsg('Event Saved Sucessfully.','Add Event Details');</script>", false);
                    //        //Response.Redirect("~/viewevent.aspx"); //kk redirect
                    //        Response.Redirect("~/viewevent.aspx", false);
                    //        Context.ApplicationInstance.CompleteRequest();

                    //    }
                    //    else
                    //    {
                    //        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ErrorMsg('Unexpected error occured.Plese refresh the page and try again!','Add Event Details');</script>", false);
                    //    }
                    //}
                    //else
                    //{
                    //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Add Event Details", "<script type='text/javascript'>ErrorMsg('Unexpected error occured.Plese refresh the page and try again!','Add Event Details');</script>", false);
                    //}

                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script language='javascript'>");
                sb.Append(@"alert('Error : " + ex.Message + "')");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", sb.ToString(), false);
            }
        }
Пример #8
0
        private void EditEventDetails(string EventSPID)
        {
            EventsEntryPageViewModel eventsEntryPageViewModel = new EventsEntryPageViewModel();
            EventMasterModel _eventMasterModel = new EventMasterModel();

            _eventMasterModel = eventsEntryPageViewModel.GetEventDetails(EventSPID);

            if (_eventMasterModel != null)
            {
                txtEventTitle.Value = _eventMasterModel.EventTitle;
                txtEventDesc.Value = _eventMasterModel.EventDesc;
                txtArtist.Value = _eventMasterModel.Artists;
                txtGenre.Value = _eventMasterModel.Genre;
                txtEventDate.Value = _eventMasterModel.EventDate;
                ddEventType.SelectedValue= _eventMasterModel.EventTypeID;
                GetEventSubType(Convert.ToInt32(_eventMasterModel.EventTypeID));

                img_prev.Src = _eventMasterModel.ImagePath;
                imgSmallImg.Src = _eventMasterModel.SmallImagePath;
                ImgTicketImage.Src = _eventMasterModel.EventLayout;

                ddEvebtSubType.SelectedValue = _eventMasterModel.EventSubtypeID;
                ddVenueDetails.SelectedValue = _eventMasterModel.VenueID;
                hdEventID.Value = _eventMasterModel.EventID;

                hdImagePath.Value = _eventMasterModel.ImagePath;
                hdEventImagePath.Value = _eventMasterModel.SmallImagePath;
                hdTicketImagePath.Value = _eventMasterModel.EventLayout;

                txtEventDate.Value = Convert.ToDateTime(_eventMasterModel.EventDate).ToString("dd/MMM/yyyy");
            }

            EventTimeDetailsModel _eventTimeDetailsModel = new EventTimeDetailsModel();
            _eventTimeDetailsModel = eventsEntryPageViewModel.GetEventTimeDetails(EventSPID);

            if (_eventTimeDetailsModel != null)
            {
                txtFromTime.Value = _eventTimeDetailsModel.EventFromTime.ToString("HH:mm");
                txtTotTime.Value = _eventTimeDetailsModel.EventToTime.ToString("HH:mm");
                EventTimeID.Value = _eventTimeDetailsModel.EventTimeID.ToString();
            }

            List<EventPriceDetailsModel> _eventPriceDetailsModel = new List<EventPriceDetailsModel>();
            _eventPriceDetailsModel = eventsEntryPageViewModel.GetEventPriceDetails(EventSPID);

            int i = 1;

            if (_eventPriceDetailsModel != null)
            {
                foreach (var item in _eventPriceDetailsModel)
                {
                    if (i == 1)
                    {
                        EPID1.Value = item.EventPriceID;
                        txtTicketType1.Value = item.EventPriceDetails;
                        txtTotalSeat1.Value = item.EventTotalSeat.ToString();
                        txtTicketPrice1.Value = item.EventPrice;
                    }

                    if (i == 2)
                    {
                        EPID2.Value = item.EventPriceID;
                        txtTicketType2.Value = item.EventPriceDetails;
                        txtTotalSeat2.Value = item.EventTotalSeat.ToString();
                        txtTicketPrice2.Value = item.EventPrice;
                    }

                    if (i == 3)
                    {
                        EPID3.Value = item.EventPriceID;
                        txtTicketType3.Value = item.EventPriceDetails;
                        txtTotalSeat3.Value = item.EventTotalSeat.ToString();
                        txtTicketPrice3.Value = item.EventPrice;
                    }

                    if (i == 4)
                    {
                        EPID4.Value = item.EventPriceID;
                        txtTicketType4.Value = item.EventPriceDetails;
                        txtTotalSeat4.Value = item.EventTotalSeat.ToString();
                        txtTicketPrice4.Value = item.EventPrice;
                    }

                    i++;
                }
            }

            btnSave.Visible = false;
            btnUpdate.Visible = true;
        }