Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["EVENTPOSTER"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx");
            }

            EventConnection connection = new EventConnection();

            Qaelo.Models.EventPosterModel.EventPoster poster = (Qaelo.Models.EventPosterModel.EventPoster)Session["EVENTPOSTER"];

            //Load all the id's of the students who liked an event
            string     html     = "";
            List <int> eventIds = connection.getListOfEventIds(poster.Id);

            //Load all the Students
            foreach (int id in eventIds)
            {
                List <int> userIds = connection.getListOfStudentIds(id);
                MyEvent    myEvent = connection.getEventById(id);

                if (userIds.Count > 0)
                {
                    html += string.Format(@"<h3 align='center'><a href='ManageEvents.aspx'>List of users who like {0} event</a></h3>
                                <table class='table responsive table-striped table-bordered' cellspacing='0' width='100%'>
                               <thead>
                              <tr>
                                <th>Profile</th>
                                <th>Name</th>
                                <th>Email</th>
                                <th>Number</th>
                              </tr>
                            </thead><tbody>", myEvent.Name);
                    foreach (int userId in userIds)
                    {
                        Qaelo.Models.StudentModel.Student s = connection.getStudent(userId);
                        html += string.Format(@"
                                            <tr>
                                            <td><img src='../../../Images/Users/Students/{0}' class='img-thumbnail' width='50' height='50' /></td>
                                            <td>{1}</td>
                                            <td>{2}</td>
                                            <td>{3}</td>
                                          </tr>", s.ProfileImage, s.FirstName + " " + s.LastName, s.Email, s.Number, myEvent.Name);
                    }

                    html += "</tbody></table><br/>";
                }
            }

            //if (html == "") html = "<div class='alert alert-warning'><h4>I'ts Empty here, Data will soon be available as soon as your events get interaction</div></h4>";

            lblListOfUsers.Text = html;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["EVENTPOSTER"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/EventPoster/ManageEvents.aspx");
            }

            EventConnection connection = new EventConnection();

            Qaelo.Models.EventPosterModel.EventPoster poster = (Qaelo.Models.EventPosterModel.EventPoster)Session["EVENTPOSTER"];

            //check delete Event
            if (Request.QueryString["delId"] != null)
            {
                if (connection.deleteEvent(Convert.ToInt32(Request.QueryString["delId"].ToString()), poster.Id))
                {
                    lblSuccess.Text = "Event has been deleted successfuly";
                }
                else
                {
                    lblErrorMessage.Text = "An error occurred while deleting event please try again";
                }
            }

            //Chekck if its from sell ticket event page
            if (Request.QueryString["page"] != null)
            {
                if (Request.QueryString["page"].ToString() == "sellTicket")
                {
                    lblSuccess.Text = "Successfully Added ticket information";
                }
            }
            //Load all events
            List <MyEvent> events = connection.getAllMyEvents(poster.Id);

            string html = "";

            foreach (MyEvent item in events)
            {
                string price = " Free";

                if (item.EntryFee > 0)
                {
                    price = " R" + item.EntryFee.ToString();
                }
                //Check if the event was liked
                string description = item.Description;

                if (description.Length > 45)
                {
                    description = description.Substring(0, 45) + "...";
                }

                html += string.Format(@"<div class='col-lg-4'>
                  <div class='thumbnail'>
                  <div class='w3-card-12'>
                      <img src = '../../../Images/Events/{0}' class='' style='height:220px;width:100%' />
                    <div class='w3-container' style='margin:10px'>
                        <h6><b>{6}-<small style = 'font-size:12px'> {1}</small></b></h6>
                        <small><cite title = '' ><i class='glyphicon glyphicon-map-marker'>
                           </i> {2}</cite></small>
                      <p>{3}</p>
                        <strong>Entry Fee :{4}     
                        </a></strong><br/>
                        <p>
                            <a href='ManageEvents.aspx?delId={5}' class='btn btn-danger pull-left'> Delete</a>
                            <a href='EditEvent.aspx?editId={5}' class='btn btn-info pull-right'> Edit</a>
                        </p>
                    </div><br /><br />
                    </div>
                  </div>
                 </div>", item.Image, General.getDateString(item.Date), item.Location, description, price, item.Id, item.Name);
            }
            listOfEvents.Text = html;
        }
Beispiel #3
0
        protected void btnFinish_Click(object sender, EventArgs e)
        {
            if (txtText.Text.Equals("") || txtAddress.Equals("") || txtDescription.Text.Equals("") || txtName.Text.Equals("") || txtPrice.Text.Equals(""))
            {
                lblErrorMessage.Text = "All fields are required";
                return;
            }

            //Get the event
            EventConnection connection = new EventConnection();

            Qaelo.Models.EventPosterModel.EventPoster poster  = (Qaelo.Models.EventPosterModel.EventPoster)Session["EVENTPOSTER"];
            Qaelo.Models.EventPosterModel.MyEvent     myEvent = connection.getEventById(Convert.ToInt32(Request.QueryString["editId"].ToString()));

            string filename1    = "";
            bool   uploadStatus = true;

            //Check if the files have something
            if (fu1.HasFile)
            {
                try
                {
                    filename1 = poster.Id + Path.GetFileName(fu1.FileName);
                    fu1.SaveAs(Server.MapPath("~/Images/Events/") + filename1);
                }
                catch (Exception ex)
                {
                    lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
                    uploadStatus         = false;
                }
            }
            else
            {
                filename1 = myEvent.Image;
            }

            if (uploadStatus)
            {
                DateTime eventDate = myEvent.Date;

                if (!txtDate.Text.Equals(""))
                {
                    eventDate = Convert.ToDateTime(txtDate.Text);
                }

                //Upload shop
                if (connection.updateEvent(new Models.EventPosterModel.MyEvent(myEvent.Id, poster.Id, "", eventDate, myEvent.DatePosted, txtDescription.Text, Convert.ToDouble(txtPrice.Text), filename1, txtAddress.Text, txtName.Text, txtText.Text)))
                {
                    lblSuccess.Text = "You have successfully Edited " + txtName.Text + " event";
                    Response.Redirect("ManageEvents.aspx");
                }
                else
                {
                    lblErrorMessage.Text = "Sorry an error occured while editing your event, please try again";
                }
            }
            else
            {
                lblErrorMessage.Text = "Sorry an error occured while editing your event, please upload image again";
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Load event
            Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"];

            if (Request.QueryString["eventId"] != null)
            {
                EventConnection connecton = new EventConnection();

                //Like and unlike
                if (student != null)
                {
                    if (Request.QueryString["like"] != null)
                    {
                        connecton.likeEvent(Convert.ToInt32(Request.QueryString["like"].ToString()), student.Id);
                    }
                    else if (Request.QueryString["unlike"] != null)
                    {
                        connecton.unlikeEvent(Convert.ToInt32(Request.QueryString["unlike"].ToString()), student.Id);
                    }
                }
                else
                {
                    if (Request.QueryString["like"] != null)
                    {
                        Response.Redirect("~/Web/Account/tempLogin.aspx");
                    }
                }

                int     eventId = Convert.ToInt32(Request.QueryString["eventId"]);
                MyEvent myEvent = connecton.getEventById(eventId);

                if (myEvent == null)
                {
                    return;
                }

                if (student != null)
                {
                    if (connecton.eventLikedByUser(myEvent.Id, student.Id))
                    {
                        lblPanelTopic.Text = string.Format(@"{0} - {1}<a href='students-event.aspx?unlike={2} &eventId={2}' class='btn btn-danger btn-xs pull-right'>Liked</a>", myEvent.Name, myEvent.Location, myEvent.Id);
                    }
                    else
                    {
                        lblPanelTopic.Text = string.Format(@"{0} - {1}<a href='students-event.aspx?like={2} &eventId={2}' class='btn btn-primary btn-xs pull-right'>Like</a>", myEvent.Name, myEvent.Location, myEvent.Id);
                    }
                }
                else
                {
                    lblPanelTopic.Text = string.Format(@"{0} - {1}<a href='students-event.aspx?like={2} &eventId={2}' class='btn btn-primary btn-xs pull-right'>Like</a>", myEvent.Name, myEvent.Location, myEvent.Id);
                }

                lblDate.Text = General.getDateString(myEvent.Date);
                if (myEvent.Image != "")
                {
                    imgImage1.Src = "../../../Images/Events/" + myEvent.Image;
                }

                //Get Event Manager
                Qaelo.Models.EventPosterModel.EventPoster poster = connecton.getPoster(myEvent.EventPosterId);
                lblName.Text   = poster.FullName;
                lblEmail.Text  = poster.Email;
                lblNumber.Text = poster.Number;

                lblDescription.Text = myEvent.Description.Replace(char.ConvertFromUtf32(13), "<br/>");
                TicketModel ticket = connecton.getTicketById(eventId);

                if (ticket != null)
                {
                    lblTicketSales.Text          = ticket.PriceDescription.Replace(char.ConvertFromUtf32(13), "<br/>");
                    lblTicketAccountdetails.Text = string.Format(@"<p>Bank Name :{0}</p>
                                <p>Account Holder :{1}</p>
                                <p>Account No: {2}</p>
                                <p>Branch Code: {3}</p>
                                <p>Reference : {4}</p>", ticket.BankName, ticket.AccountHolder, ticket.AccountNo, ticket.BranchCode, ticket.reference);
                    divTickets.Visible           = true;
                }
                else
                {
                    divTickets.Visible = false;
                }
            }
            else if (Request.QueryString["seventId"] != null)
            {
                SocietyConnection connecton = new SocietyConnection();
                int     eventId             = Convert.ToInt32(Request.QueryString["seventId"]);
                MyEvent myEvent             = connecton.getEventById(eventId);

                if (myEvent == null)
                {
                    return;
                }

                if (student != null)
                {
                    //Like and unlike
                    if (Request.QueryString["like"] != null)
                    {
                        connecton.likeEvent(Convert.ToInt32(Request.QueryString["like"].ToString()), myEvent.EventPosterId, student.Id);
                    }
                    else if (Request.QueryString["unlike"] != null)
                    {
                        connecton.unlikeEvent(Convert.ToInt32(Request.QueryString["unlike"].ToString()), student.Id);
                    }
                }
                else
                {
                    if (Request.QueryString["like"] != null)
                    {
                        Response.Redirect("~/Web/Account/tempLogin.aspx");
                    }
                }

                if (student != null)
                {
                    if (new Qaelo.Data.SocietyData.SocietyConnection().eventLikedByUser(myEvent.Id, student.Id))
                    {
                        lblPanelTopic.Text = string.Format(@"{0} - {1}<a href='students-event.aspx?unlike={2} &seventId={2}' class='btn btn-danger btn-xs pull-right'>Liked</a>", myEvent.Name, myEvent.Location, myEvent.Id);
                    }
                    else
                    {
                        lblPanelTopic.Text = string.Format(@"{0} - {1}<a href='students-event.aspx?like={2} &seventId={2}' class='btn btn-primary btn-xs pull-right'>Like</a>", myEvent.Name, myEvent.Location, myEvent.Id);
                    }
                }
                else
                {
                    lblPanelTopic.Text = string.Format(@"{0} - {1}<a href='students-event.aspx?like={2} &seventId={2}' class='btn btn-primary btn-xs pull-right'>Like</a>", myEvent.Name, myEvent.Location, myEvent.Id);
                }



                lblDate.Text = General.getDateString(myEvent.Date);
                if (myEvent.Image != "")
                {
                    imgImage1.Src = "../../../Images/Events/" + myEvent.Image;
                }

                //Get Event Manager
                Qaelo.Models.SocietyModel.Society poster = connecton.getSociety(myEvent.EventPosterId);
                lblName.Text   = poster.Name;
                lblEmail.Text  = poster.Email;
                lblNumber.Text = poster.Number;

                lblDescription.Text = myEvent.Description.Replace(char.ConvertFromUtf32(13), "<br/>");
                TicketModel ticket = new EventConnection().getTicketById(eventId);

                if (ticket != null)
                {
                    lblTicketSales.Text          = ticket.PriceDescription.Replace(char.ConvertFromUtf32(13), "<br/>");
                    lblTicketAccountdetails.Text = string.Format(@"<p>Bank Name :{0}</p>
                                <p>Account Holder :{1}</p>
                                <p>Account No: {2}</p>
                                <p>Branch Code: {3}</p>
                                <p>Reference : {4}</p>", ticket.BankName, ticket.AccountHolder, ticket.AccountNo, ticket.BranchCode, ticket.reference);
                    divTickets.Visible           = true;
                }
                else
                {
                    divTickets.Visible = false;
                }
            }
            else
            {
                Response.Redirect("~/Web/Users/Student/students-events.aspx");
            }
        }