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)
        {
            if (txtText.Text == "")
            {
                lblErrorMessage.Text = "Please select a valid institution";
                return;
            }
            Qaelo.Models.SocietyModel.Society society = (Qaelo.Models.SocietyModel.Society)Session["SOCIETY"];
            bool uploadStatus = true;

            string filename1 = "";

            //Check if the files have something
            if (wizardPicture.HasFile)
            {
                try
                {
                    filename1 = Path.GetFileName(wizardPicture.FileName);
                    wizardPicture.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 = society.ProfileImage;
            }

            if (uploadStatus)
            {
                string images = filename1;

                //Upload shop
                if (new SocietyConnection().updateProfile(new Qaelo.Models.SocietyModel.Society("", txtDescription.Text, txtEmail.Text, txtFacebookLink.Text, txtMeetingDays.Text, txtMeetingTime.Text, txtName.Text, txtNumber.Text, "", filename1, society.RegistrationDate, txtSocityType.Text, txtText.Text, "", "", false), society.Id))
                {
                    //New Society
                    Session["SOCIETY"] = new SocietyConnection().getSociety(society.Id);
                    Response.Redirect("PostProfile.aspx?page=EditProfile");
                }
                else
                {
                    lblErrorMessage.Text = "Sorry an error occured while updating your profile, please try again";
                }
            }
            else
            {
                lblErrorMessage.Text = "Sorry an error occured while updating your profile, please upload image again";
            }
        }
Ejemplo n.º 3
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.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SOCIETY"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Society/ManageEvents.aspx");
            }

            SocietyConnection connection = new SocietyConnection();

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

            //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";
                }
            }
            //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-3'>
                  <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.Id);
            }

            //if (html == "") html = "<div class='alert alert-info'><h3>I'ts Empty here, Data will soon be available as soon as you post an event</div></h3>";

            listOfEvents.Text = html;
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SOCIETY"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Society/PostProfile.aspx");
            }

            Qaelo.Models.SocietyModel.Society society = (Qaelo.Models.SocietyModel.Society)Session["SOCIETY"];
            SocietyConnection connection = new SocietyConnection();

            if (Request.QueryString["page"] != null)
            {
                lblSuccess.Text = "Successfully Updated your profile";
            }

            if (Request.QueryString["disable"] != null)
            {
                //Delete Profile From Societies table

                connection.deleteSocietiesProfile(society.Id);

                lblSuccess.Text      = lblSuccess.Text = "";
                lblErrorMessage.Text = "Your Profile is now Private";
            }
            else if (Request.QueryString["enable"] != null)
            {
                //Insert Profile into Societies table

                if (!connection.isProfilePublic(society.Id))
                {
                    connection.uploadSocietiesProfile(society);
                }

                lblSuccess.Text      = lblSuccess.Text = "Your Profile is now Public";
                lblErrorMessage.Text = "";
            }

            string html = "";

            if (connection.isProfilePublic(society.Id))
            {
                html += string.Format(@"<div class='col-lg-3 col-lg-offset-3'>
                <h4> Your Current Profile Preview</h4>
                <div class='thumbnail'>
                  <div class='w3-card-12'>
                                <figure >
                                    <img src='../../../Images/Scociety/{0}'  class='' style='height:220px;width:100%' />
                          <figcaption style = 'background-image: url('')'>
                                {1}                  
                          </figcaption>
                           </figure>
                    <div class='w3-container' style='margin:10px'>
                        <h6><b>{2}- <small style='font-size:12px'>{3}</small></b></h6>
                        <strong>Type:<small>{4}</small></strong><br />
                       <strong> Meeting time: <small>{5}</small></strong><br />
                        <strong>Call:<small>{6}</small>
                      <a href='PostProfile.aspx?disable=delete' class='btn btn-danger pull-right'>Disable Profile</a>
                        </strong><br /><br/>
                    </div>
                  </div>
                </div>
                    </div>
            ", society.ProfileImage, society.Description, society.Name, society.University, society.SocietyType, society.MeetingTime, society.Number, society.Id);
            }
            else
            {
                html += string.Format(@"<div class='col-lg-3 col-lg-offset-3'>
<h3> Your Current Profile Preview</h3>
                <div class='thumbnail'>
                  <div class='w3-card-12'>
                                <figure >
                                    <img src='../../../Images/Scociety/{0}'  class='' style='height:220px;width:100%' />
                          <figcaption style = 'background-image: url('')'>
                                {1}                  
                          </figcaption>
                           </figure>
                    <div class='w3-container' style='margin:10px'>
                        <h6><b>{2}- <small style='font-size:12px'>{3}</small></b></h6>
                        <strong>Type:<small>{4}</small></strong><br />
                       <strong> Meeting time: <small>{5}</small></strong><br />
                        <strong>Call:<small>{6}</small>
                      <a href='PostProfile.aspx?enable=enable' class='btn btn-success pull-right'>Enable Profile</a>
                        </strong><br /><br/>
                    </div>
                  </div>
                </div>
                    </div>
            ", society.ProfileImage, society.Description, society.Name, society.University, society.SocietyType, society.MeetingTime, society.Number, society.Id);
            }

            lblSociety.Text = html;
        }
Ejemplo n.º 6
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");
            }
        }