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

            SocietyConnection connection = new SocietyConnection();

            Qaelo.Models.SocietyModel.Society poster = (Qaelo.Models.SocietyModel.Society)Session["SOCIETY"];

            if (!poster.Verified)
            {
                lblVerified.Text = "<div class='alert alert-danger'><h3>Your profile and posts  Will only be public once your account has been verified by Admin</div></h3>";
            }

            //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);
                foreach (int userId in userIds)
                {
                    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);
                    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 or profile get interaction</div></h4>";
            }

            lblListOfUsers.Text = html;
        }
Ejemplo n.º 2
0
        protected void btnFinish_Click(object sender, EventArgs e)
        {
            //Get the event
            SocietyConnection connection = new SocietyConnection();

            Qaelo.Models.SocietyModel.Society     society = (Qaelo.Models.SocietyModel.Society)Session["SOCIETY"];
            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 = Path.GetFileName(fu1.FileName);
                    fu1.SaveAs(Server.MapPath("~/Images/Shops/") + 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)
            {
                //Upload shop
                if (connection.updateEvent(new Models.EventPosterModel.MyEvent(myEvent.Id, society.Id, "", myEvent.Date, DateTime.Now, 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";
            }
        }
Ejemplo n.º 3
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");
            }
        }