protected void btnUpdate_Click(object sender, EventArgs e) { if (txtConfirmPassword.Text == txtNewPassword.Text) { AccountConnection account = new AccountConnection(); Qaelo.Models.StudentModel.Student s = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; //Test password if (account.correctStudent(s.Email, Secrecy.HashPassword(txtCurrentPassword.Text)) && account.updateStudentPassword(s.Id, Secrecy.HashPassword(txtNewPassword.Text), Secrecy.HashPassword(txtCurrentPassword.Text))) { lblSuccess.Text = "Successfuly Updated Password"; lblErrorMessage.Text = ""; } else { lblErrorMessage.Text = "Incorrect Current Password"; lblSuccess.Text = ""; } } else { lblErrorMessage.Text = "New password and confirm Password Do not match "; lblSuccess.Text = ""; } }
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; }
protected void Page_Load(object sender, EventArgs e) { if (Session["STUDENT"] == null) { Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Student/students-book-a-room.aspx"); } //Load anything that is possible to load Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; txtRoomNo.Text = Request.QueryString["Id"]; }
protected void Page_Load(object sender, EventArgs e) { //Session //if (Session["STUDENT"] == null) // Response.Redirect("~/Web/Account/tempLogin.aspx"); if (Request.QueryString["id"] == null) { Response.Redirect("~/Web/Users/Student/student-accommodation.aspx"); } int id = Convert.ToInt32(Request.QueryString["id"].ToString()); reserveRoom.HRef = "students-book-a-room.aspx?id=" + id; if (Request.QueryString["reserve"] != null && Request.QueryString["id"] != null) { lblSuccess.Text = "Successfully Reserved this room, Please wait for email confirmation from the landlord"; } Qaelo.Models.StudentModel.Student student = (Models.StudentModel.Student)(Session["STUDENT"]); AccommodationConnection connection = new AccommodationConnection(); //Check if the user clicked the join button if (student != null) { if (Request.QueryString["joinId"] != null) { Qaelo.Models.AccommodationModel.Accommodation myroom = connection.getRoom(Convert.ToInt32(Request.QueryString["joinId"].ToString())); connection.joinPropery(myroom.managerId, myroom.id, student.Id); } else if (Request.QueryString["unjoinId"] != null) { Qaelo.Models.AccommodationModel.Accommodation myroom = connection.getRoom(Convert.ToInt32(Request.QueryString["unjoinId"].ToString())); connection.unjoinProperty(myroom.id, student.Id); } } else { if (Request.QueryString["joinId"] != null) { Response.Redirect("~/Web/Account/tempLogin.aspx"); } } string name = ""; //Load the Room Qaelo.Models.AccommodationModel.Accommodation room = (new AccommodationConnection().getRoom(id)); if (room == null) { return; } Manager manager = new ManagerConnection().getManager(room.managerId); //Confirm Veririfcation if (manager != null) { if (manager.verified) { if (manager.propertyName != "") { name = manager.propertyName; } else { name = "Room Available"; } if (student != null) { if (connection.propertyJoinedByUser(room.id, student.Id)) { lblPanelTopic.Text = string.Format(@"{0} - {1}km away from {2}<a href='students-room.aspx?unjoinId={3} &id={3}' class='btn btn-danger btn-xs pull-right'>Joined</a>", name, room.distanceFromCampus, room.campus, room.id); } else { lblPanelTopic.Text = string.Format(@"{0} - {1}km away from {2}<a href='students-room.aspx?joinId={3} &id={3}' class='btn btn-primary btn-xs pull-right'>Join Property</a>", name, room.distanceFromCampus, room.campus, room.id); } } else { lblPanelTopic.Text = string.Format(@"{0} - {1}km away from {2}<a href='students-room.aspx?joinId={3} &id={3}' class='btn btn-primary btn-xs pull-right'>Join Property</a>", name, room.distanceFromCampus, room.campus, room.id); } string[] listOfImages = room.images.Split(';'); if (listOfImages[0] != "") { imgImage1.Src = "../../../Images/Accommodation/" + listOfImages[0]; } if (listOfImages[1] != "") { imgImage2.Src = "../../../Images/Accommodation/" + listOfImages[1]; } if (listOfImages[2] != "") { imgImage3.Src = "../../../Images/Accommodation/" + listOfImages[2]; } if (listOfImages[3] != "") { imgImage4.Src = "../../../Images/Accommodation/" + listOfImages[3]; } if (listOfImages[4] != "") { imgImage5.Src = "../../../Images/Accommodation/" + listOfImages[4]; } lblLocation.Text = room.address; lblRoomType.Text = room.accomodationType; lblEmail.Text = manager.email; lblName.Text = manager.firstName + " " + manager.lastName; lblNumber.Text = manager.number; lblDescription.Text = room.description.Replace(char.ConvertFromUtf32(13), "<br/>"); } else { Response.Redirect("~/Web/Users/Student/student-accommodation.aspx"); } } else { Response.Redirect("~/Web/Users/Student/student-accommodation.aspx"); } }
protected void btnFinish_Click(object sender, EventArgs e) { Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; //Save image string file = ""; if (file1.HasFile) { try { file = student.Id + Path.GetFileName(file1.FileName); file1.SaveAs(Server.MapPath("~/Images/Book/") + file); } catch (Exception ex) { lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } else { lblErrorMessage.Text = "Please upload book image"; return; } if (txtDescription.Text == "") { lblErrorMessage.Text = "Please provide decription of the book"; return; } if (txtPrice.Text == "") { lblErrorMessage.Text = "Please provide book price"; return; } if (txtTitle.Text == "") { lblErrorMessage.Text = "Please provide book title"; return; } int price = 0; if (txtPrice.Text.Contains(",") || txtPrice.Text.Contains(".")) { if (txtPrice.Text.Contains(",")) { price = Convert.ToInt32(txtPrice.Text.Split(',')[0]); } else if (txtPrice.Text.Contains(".")) { price = Convert.ToInt32(txtPrice.Text.Split('.')[0]); } } else { price = Convert.ToInt32(txtPrice.Text); } //Store book new StudentConnection().postBook(new Models.StudentModel.Book(student.Id, txtDescription.Text, ddlField.SelectedItem.Value, txtTitle.Text, file, Convert.ToDouble(price), ddlYear.SelectedItem.Value)); sendRegistrationEmail(txtshare1.Text); //Send email to a friend Response.Redirect("students-profile.aspx?page=sellbooks"); }
protected void Button1_Click(object sender, EventArgs e) { Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; if (txtMoveInDate.Text.Equals("") || txtPostalAddress.Text.Equals("") || txtRoomNo.Text.Equals("")) { lblErrorMessage.Text = "All fields are required"; return; } string salary = ""; string bankstatement = ""; string guardianID = ""; string id = ""; //Save everthing <img src="../../../Images/Accommodation/44accommodation4.jpg" /> //Process files if (fuSalary.HasFile) { try { salary = student.Id + Path.GetFileName(fuSalary.FileName); fuSalary.SaveAs(Server.MapPath("~/Images/Accommodation/") + salary); } catch (Exception ex) { lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; return; } } if (fuBankStatement.HasFile) { try { bankstatement = student.Id + Path.GetFileName(fuBankStatement.FileName); fuBankStatement.SaveAs(Server.MapPath("~/Images/Accommodation/") + bankstatement); } catch (Exception ex) { lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; return; } } if (fuGuardianId.HasFile) { try { guardianID = student.Id + Path.GetFileName(fuGuardianId.FileName); fuGuardianId.SaveAs(Server.MapPath("~/Images/Accommodation/") + guardianID); } catch (Exception ex) { lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; return; } } if (fuID.HasFile) { try { id = student.Id + Path.GetFileName(fuID.FileName); fuID.SaveAs(Server.MapPath("~/Images/Accommodation/") + id); } catch (Exception ex) { lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; return; } } //submit reservations new AccommodationConnection().reserveRoom(new Models.AccommodationModel.Reservation(student.Id, bankstatement, student.Email, student.FirstName + " " + student.LastName, txtPostalAddress.Text, guardianID, student.Number, Convert.ToDateTime(txtMoveInDate.Text), Convert.ToBoolean(ddlRoomAvailable.SelectedItem.Value), Convert.ToInt32(txtRoomNo.Text), salary, ddlSponsor.SelectedItem.Value, id, Convert.ToBoolean(ddlSeenRoom.SelectedItem.Value))); Response.Redirect("students-room.aspx?Id=" + Request.QueryString["Id"] + "&reserve=true"); }
protected void btnFinish_Click(object sender, EventArgs e) { Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; string images = ""; string price = ""; string work = ""; //set price if (ddlPriceTerms.SelectedItem.Value == "Negotiable") { price = "Negotiable"; } else { price = txtPrice.Text + " " + ddlPriceTerms.SelectedItem.Value; } if (ddlWork1.SelectedItem.Value != "NONE") { work += ddlWork1.SelectedItem.Value + ";"; } else { lblErrorMessage.Text = "Please select your freelancing specialty"; } if (ddlWork2.SelectedItem.Value != "NONE") { work += ddlWork2.SelectedItem.Value + ";"; } else { work += ";"; } if (ddlWork3.SelectedItem.Value != "NONE") { work += ddlWork3.SelectedItem.Value + ";"; } else { work += ";"; } //Select Images string f1 = "default.jpg"; string f2 = "default.jpg"; string f3 = "default.jpg"; if (file1.HasFile) { try { f1 = student.Id + Path.GetFileName(file1.FileName); file1.SaveAs(Server.MapPath("~/Images/Freelancer/") + f1); } catch (Exception ex) { f1 = "default.jpg"; lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } else { f1 = "default.jpg"; } if (file2.HasFile) { try { f2 = student.Id + Path.GetFileName(file2.FileName); file2.SaveAs(Server.MapPath("~/Images/Freelancer/") + f2); } catch (Exception ex) { f2 = "default.jpg"; lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } else { f2 = "default.jpg"; } if (file3.HasFile) { try { f3 = student.Id + Path.GetFileName(file3.FileName); file3.SaveAs(Server.MapPath("~/Images/Freelancer/") + f3); } catch (Exception ex) { f3 = "default.jpg"; lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } else { f3 = "default.jpg"; } images = f1 + ";" + f2 + ";" + f3; new Data.StudentData.StudentConnection().postWork(new Models.StudentModel.Freelancer(student.Id, txtDescription.Text, images, price, work)); Response.Redirect("students-profile.aspx?page=freelancer"); }
protected void btnSearch_Click(object sender, EventArgs e) { //load StudentConnection connection = new StudentConnection(); //Get all students from selected varsity string query = " Institution = " + "'" + txtText.Text + "'"; List <Qaelo.Models.StudentModel.Student> students = connection.getAllStudents(query); List <Qaelo.Models.StudentModel.Freelancer> freelancers = new List <Models.StudentModel.Freelancer>(); //add each profile to freelance list foreach (Qaelo.Models.StudentModel.Freelancer freelancer in connection.getAllFreelancers()) { //add student as freelance if (connection.getStudent(freelancer.StudentId) != null) { if (connection.getStudent(freelancer.StudentId).Institution.Equals(txtText.Text)) { if (freelancer.Work.Contains(txtFreelancers.Text)) { freelancers.Add(freelancer); } } } } string html = ""; int length = General.getLengthOfLongestFreelancer(freelancers); foreach (Models.StudentModel.Freelancer freelancer in freelancers) { if (connection.isProfilePublic(freelancer.StudentId)) { //if a student is a freelancer then include it here string[] abilities = freelancer.Work.Split(';'); string work = ""; for (int i = 0; i < abilities.Count(); i++) { if (abilities[i].Count() > 0) { if ((i + 1) == abilities.Count()) { work += abilities[i]; } else { if (abilities[i].Count() > 4) { work += "<li>" + abilities[i] + "</li>"; } //work += "." + abilities[i] + "." + "<br/>"; } } } string fr = "<h6 style='margin-top:10px'>I freelance as a : <br/><ul></h6><small style='font-size:12px'>" + work + "</b></small><ul/>"; Qaelo.Models.StudentModel.Student student = connection.getStudent(freelancer.StudentId); string[] images = freelancer.Image.Split(';'); html += string.Format(@" <div class='col-md-3 thumbnail'> <div class='w3-card-12'> <figure > <img src='../../../Images/Users/Students/{0}' 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> {4}<br/> <a href='#freelancer{5}' data-toggle='modal' class='btn pull-right form-control' style='background:#d89b4e'>View profile</a> <br/><br/> </div> </div> </div> ", student.ProfileImage, student.Description, student.FirstName + student.LastName, student.Institution, fr, student.Id); //Modal pop up //Get freelance portfolio PreviousWork portfolio = connection.getPortfolio(student.Id); string image1 = "default.jpg"; string image2 = "default.jpg"; string image3 = "default.jpg"; string video1 = "videoDefault.mp4"; string video2 = "videoDefault.mp4"; string video3 = "videoDefault.mp4"; string cvDescription = ""; if (portfolio != null) { //Test for images string[] pictures = portfolio.Pictures.Split(';'); if (pictures[0] != string.Empty) { image1 = pictures[0]; } if (pictures[1] != string.Empty) { image2 = pictures[1]; } if (pictures[2] != string.Empty) { image3 = pictures[2]; } //Test for videos string[] videos = portfolio.Videos.Split(';'); if (videos[0] != string.Empty) { video1 = videos[0]; } if (videos[1] != string.Empty) { video2 = videos[1]; } if (videos[2] != string.Empty) { video3 = videos[2]; } cvDescription = portfolio.Links; } lblSingleProfile.Text += string.Format(@"<div class='modal fade' id='freelancer{11}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'> <div class='modal-dialog modal-lg'> <div class='modal-content'> <div class='modal-body'> <div class='container'> <div class='col-sm-9'> <div class='col-sm-5'> <h2>Education</h2> <hr /> <strong>University:</strong><p>{0}</p> <strong>Course Enrolled:</strong><p>{1}</p> <strong>Freelance:</strong><p>{2}</p> <strong>Freelancing Description:</strong><p>{3}</p> <strong>Price:</strong><p>{4}</p> </div> <div class='col-sm-5'> <h2>Contact Info</h2> <hr /> <strong>Full Name :</strong><p>{5}</p> <strong>Email:</strong><p>{6}</p> <strong>Phone No:</strong><p>{7}</p> </div> </div> <div class='col-sm-9' style='margin-top:50px'> </div> <!-- Portfolio--> <div class='col-sm-9'> <div class='panel-group' id='accordion{11}'> <div class='panel panel-warning'> <div class='panel-heading'> <h4 class='panel-title'> <a data-toggle='collapse' data-parent='#accordion{11}' href='#collapse1{11}'> View My Portfolio Pictures</a> </h4> </div> <div id='collapse1{11}' class='panel-collapse collapse in'> <div class='panel-body'> <div class='col-sm-12'> <div class='col-sm-4'> <a id='popover1{11}' class='btn' rel='popover1{11}' data-content='' > <img src='../../../Images/Freelancer/{12}' class='img-thumbnail' /> </a> </div> <div class='col-sm-4'> <a id='popover2{11}' class='btn' rel='popover2{11}' data-content='' > <img src='../../../Images/Freelancer/{13}' class='img-thumbnail' /> </a> </div> <div class='col-sm-4'> <a id='popover3{11}' class='btn' rel='popover3{11}' data-content='' > <img src='../../../Images/Freelancer/{14}' class='img-thumbnail' /> </a> </div> </div> </div> </div> </div> </div> <!-- Next conetent here--> <div class='panel panel-warning'> <div class='panel-heading'> <h4 class='panel-title'> <a data-toggle='collapse' data-parent='#accordion{11}' href='#collapse2{11}'> View My Portfolio Videos</a> </h4> </div> <div id='collapse2{11}' class='panel-collapse collapse'> <div class='panel-body'> <div class='col-sm-12'> <div class='col-sm-4'> <video src='../../../Images/Freelancer/{15}' class='img-thumbnail' style='height:150px;' controls='controls' /> </div> <div class='col-sm-4'> <video src='../../../Images/Freelancer/{16}' class='img-thumbnail' style='height:150px;' controls='controls' /> </div> <div class='col-sm-4'> <video src='../../../Images/Freelancer/{17}' class='img-thumbnail' style='height:150px;' controls='controls' /> </div> </div> </div> </div> </div> <!-- Next content here--> <div class='panel panel-warning'> <div class='panel-heading'> <h4 class='panel-title'> <a data-toggle='collapse' data-parent='#accordion{11}' href='#collapse3{11}'> View My Portfolio CV</a> </h4> </div> <div id='collapse3{11}' class='panel-collapse collapse'> <div class='panel-body'> <div class='col-sm-12'> <p> {18} </p> </div> </div> </div> </div> </div> </div> <div class='modal-footer'> <button class='btn btn-default pull-left' data-dismiss='modal'>Cancel</button> </div> </div> </div> </div> </div>", student.Institution, student.QualificationEnrolled, freelancer.Work, freelancer.Description, freelancer.Price, student.FirstName + " " + student.LastName, student.Email, student.Number, images[0], images[1], images[2], student.Id, image1, image2, image3, video1, video2, video3, cvDescription); } } if (html.Length > 0) { lblProfileView.Text = html; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["search"] != null) { txtText.Text = Request.QueryString["search"].ToString(); #region not loggedin if (Session["STUDENT"] == null) { AccommodationConnection connection = new AccommodationConnection(); //Load all the accommodations string html = ""; string accommodationName = ""; string address = ""; //Check if the user clicked the join button if (Request.QueryString["joinId"] != null) { //Login Response.Redirect("~/Web/Account/tempLogin.aspx"); } else if (Request.QueryString["unjoinId"] != null) { //Login Response.Redirect("~/Web/Account/tempLogin.aspx"); } string university = txtText.Text; List <Qaelo.Models.AccommodationModel.Accommodation> rooms = connection.getAllMyRoomsByUniversity(university); foreach (Qaelo.Models.AccommodationModel.Accommodation room in rooms) { //Get accommodation Name int managerId = room.id; Manager manager = new ManagerConnection().getManager(room.managerId); //Confirm Veririfcation if (manager != null) { if (manager.verified) { if (manager.propertyName != "") { accommodationName = manager.propertyName; } else { accommodationName = "Room Available"; } //Get Images string[] listOfImages = room.images.Split(';'); string nfsas = ""; string gender = ""; string campus = room.campus; if (accommodationName.Length > 21) { accommodationName = accommodationName.Substring(0, 21) + "..."; } if (room.address.Length > 41) { address = room.address.Substring(0, 40) + "..."; } else { address = room.address; } if (campus.Length > 18) { campus = room.campus.Substring(0, 15) + "..."; } else { campus = room.campus; } if (room.gender == "All") { gender = ""; } else { gender = room.gender; } if (room.accredited) { nfsas = "<i class='glyphicon glyphicon-check'></i> Student Loan Accredited"; } else { nfsas = "<i class='glyphicon glyphicon-check'></i>Cash Only"; } //check if available or not string available = ""; if (room.status) { available = "<a class='btn btn-success'>Available</a>"; } else { available = "<a class='btn btn-danger' >Not available</a>"; } //Before Joined Property html += string.Format(@"<div class='col-xs-12 col-sm-12 col-md-12'> <div class='thumbnail'> <div class='row'> <div class='col-sm-6'> <a data-toggle='modal' data-target='#myModal{0}' href='#myGallery{0}' data-slide-to='0'> <img src = '../../../Images/Accommodation/{1}' class='img-rounded' height='250' width='100%'/> </a> </div> <div class='col-sm-6 col-md-6'> <i class='small pull-right' style='background-color:aliceblue'><small>{2}</small></i> <h4>{3}</h4> <a href='students-room.aspx?id={0}'> <small><cite title = 'Brxiton' ><i class='glyphicon glyphicon-map-marker'> </i> {10}</cite></small> <div class='list-group'> <div class='list-group-item'>{4}</div> <div class='list-group-item'><i class='fa fa-users' aria-hidden='true'></i>{5} <b> {6}</b></div> <div class='list-group-item'><i class='fa fa-map-marker' aria-hidden='true'></i>{7} KM from {8}</div> </div> </a> <div class='btn-group'> <a type ='button' href='student-accommodation.aspx?joinId={0}' class='btn btn-success'>Join Property</a> </div> <p style = 'font-size:15px' class='pull-right'><b>R{9}</b> </p> </div> </div> </div> </div> ", room.id, listOfImages[0], available, accommodationName, nfsas, room.arrangement, gender, room.distanceFromCampus, campus, room.price, room.address); //Modal html += string.Format(@"<div class='modal fade-scale' id='myModal{0}' style='margin-top:10%'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-body'> <div id = 'myGallery{0}' class='carousel slide' data-interval='false'> <div class='carousel-inner'> <div class='item active'> <img src = '../../../Images/Accommodation/{1}' alt='item0' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{2}' alt='item2' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{3}' alt='item3' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{4}' alt='item4' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{5}' alt='item5' width='100%'> </div> </div> <a class='left carousel-control' href='#myGallery{0}' role='button' data-slide='prev'> <span class='glyphicon glyphicon-chevron-left'></span></a> <a class='right carousel-control' href='#myGallery{0}' role='button' data-slide='next'> <span class='glyphicon glyphicon-chevron-right'></span></a> </div> </div> </div> </div> </div>", room.id, listOfImages[0], listOfImages[1], listOfImages[2], listOfImages[3], listOfImages[4]); }//If verified } } //if (html == "") // html = "<div class='alert alert-info'><h3>Unfortunately there are no rooms in this category</div></h3>"; lblListOfRooms.Text = html; } #endregion #region Loggedin else { AccommodationConnection connection = new AccommodationConnection(); Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)(Session["STUDENT"]); //Load all the accommodations string html = ""; string accommodationName = ""; int studentId = student.Id; string address = ""; //Check if the user clicked the join button if (Request.QueryString["joinId"] != null) { Qaelo.Models.AccommodationModel.Accommodation room = connection.getRoom(Convert.ToInt32(Request.QueryString["joinId"].ToString())); connection.joinPropery(room.managerId, room.id, studentId); } else if (Request.QueryString["unjoinId"] != null) { Qaelo.Models.AccommodationModel.Accommodation room = connection.getRoom(Convert.ToInt32(Request.QueryString["unjoinId"].ToString())); connection.unjoinProperty(room.id, studentId); } string university = txtText.Text; List <Qaelo.Models.AccommodationModel.Accommodation> rooms = connection.getAllMyRoomsByUniversity(university); foreach (Qaelo.Models.AccommodationModel.Accommodation room in rooms) { //Get accommodation Name int managerId = room.id; Manager manager = new ManagerConnection().getManager(room.managerId); //Confirm Veririfcation if (manager != null) { if (manager.verified) { if (manager.propertyName != "") { accommodationName = manager.propertyName; } else { accommodationName = "Room Available"; } //Get Images string[] listOfImages = room.images.Split(';'); string nfsas = ""; string gender = ""; string campus = room.campus; if (accommodationName.Length > 21) { accommodationName = accommodationName.Substring(0, 21) + "..."; } if (room.address.Length > 41) { address = room.address.Substring(0, 40) + "..."; } else { address = room.address; } if (campus.Length > 18) { campus = room.campus.Substring(0, 15) + "..."; } else { campus = room.campus; } if (room.gender == "All") { gender = ""; } else { gender = room.gender; } if (room.accredited) { nfsas = "<i class='glyphicon glyphicon-check'></i> Student Loan Accredited"; } else { nfsas = "<i class='glyphicon glyphicon-check'></i>Cash Only"; } //check if available or not string available = ""; if (room.status) { available = "<a class='btn btn-success'>Available</a>"; } else { available = "<a class='btn btn-danger' >Not available</a>"; } if (connection.propertyJoinedByUser(room.id, studentId)) { //When the property is joined html += string.Format(@"<div class='col-xs-12 col-sm-12 col-md-12'> <div class='thumbnail'> <div class='row'> <div class='col-sm-6'> <a data-toggle='modal' data-target='#myModal{0}' href='#myGallery{0}' data-slide-to='0'> <img src = '../../../Images/Accommodation/{1}' class='img-rounded' height='250' width='100%'/> </a> </div> <div class='col-sm-6 col-md-6'> <i class='small pull-right' style='background-color:aliceblue'><small>{2}</small></i> <h4>{3}</h4> <a href='students-room.aspx?id={0}'> <small><cite title = 'Brxiton' ><i class='glyphicon glyphicon-map-marker'> </i> {10}</cite></small> <div class='list-group'> <div class='list-group-item'>{4}</div> <div class='list-group-item'><i class='fa fa-users' aria-hidden='true'></i>{5} <b> {6}</b></div> <div class='list-group-item'><i class='fa fa-map-marker' aria-hidden='true'></i>{7} KM from {8}</div> </div> </a> <div class='btn-group'> <a type ='button' href='student-accommodation.aspx?unjoinId={0} &search={11}' class='btn btn-danger'>Joined</a> </div> <p style = 'font-size:15px' class='pull-right'><b>R{9}</b> </p> </div> </div> </div> </div> ", room.id, listOfImages[0], available, accommodationName, nfsas, room.arrangement, gender, room.distanceFromCampus, campus, room.price, address, Request.QueryString["search"]); } else { //Before Joined Property html += string.Format(@"<div class='col-xs-12 col-sm-12 col-md-12'> <div class='thumbnail'> <div class='row'> <div class='col-sm-6 col-md-6'> <a data-toggle='modal' data-target='#myModal{0}' href='#myGallery{0}' data-slide-to='0'> <img src = '../../../Images/Accommodation/{1}' class='img-rounded' height='250' width='100%'/> </a> </div> <div class='col-sm-6 col-md-6'> <i class='small pull-right' style='background-color:aliceblue'><small>{2}</small></i> <h4>{3}</h4> <a href='students-room.aspx?id={0}'> <small><cite title = 'Brxiton' ><i class='glyphicon glyphicon-map-marker'> </i> {10}</cite></small> <div class='list-group'> <div class='list-group-item'>{4}</div> <div class='list-group-item'><i class='fa fa-users' aria-hidden='true'></i>{5} <b> {6}</b></div> <div class='list-group-item'><i class='fa fa-map-marker' aria-hidden='true'></i>{7} KM from {8}</div> </div> </a> <div class='btn-group'> <a type ='button' href='student-accommodation.aspx?joinId={0} &search={11}' class='btn btn-success'>Join Property</a> </div> <p style = 'font-size:15px' class='pull-right'><b>R{9}</b> </p> </div> </div> </div> </div> ", room.id, listOfImages[0], available, accommodationName, nfsas, room.arrangement, gender, room.distanceFromCampus, campus, room.price, room.address, Request.QueryString["search"]); } //Modal html += string.Format(@"<div class='modal fade-scale' id='myModal{0}' style='margin-top:10%'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-body'> <div id = 'myGallery{0}' class='carousel slide' data-interval='false'> <div class='carousel-inner'> <div class='item active'> <img src = '../../../Images/Accommodation/{1}' alt='item0' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{2}' alt='item2' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{3}' alt='item3' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{4}' alt='item4' width='100%'> </div> <div class='item'> <img src = '../../../Images/Accommodation/{5}' alt='item5' width='100%'> </div> </div> <a class='left carousel-control' href='#myGallery{0}' role='button' data-slide='prev'> <span class='glyphicon glyphicon-chevron-left'></span></a> <a class='right carousel-control' href='#myGallery{0}' role='button' data-slide='next'> <span class='glyphicon glyphicon-chevron-right'></span></a> </div> </div> </div> </div> </div>", room.id, listOfImages[0], listOfImages[1], listOfImages[2], listOfImages[3], listOfImages[4]); }//If verified } } #endregion //if (html == "") // html = "<div class='alert alert-info'><h3>Unfortunately there are no rooms in this category</div></h3>"; lblListOfRooms.Text = html; }//End of else } } }
protected void btnSearch_Click(object sender, EventArgs e) { SocietyConnection connection = new Data.SocietyData.SocietyConnection(); Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; //Check if the user clicked the join button if (Request.QueryString["joinId"] != null) { if (student != null) { int societyId = Convert.ToInt32(Request.QueryString["joinId"].ToString()); connection.joinSociety(societyId, student.Id); } else { //Redirect Response.Redirect("~/Web/Account/tempLogin.aspx"); } } else if (Request.QueryString["unJoinId"] != null) { if (student != null) { int societyId = Convert.ToInt32(Request.QueryString["unJoinId"].ToString()); connection.unJoinSociety(societyId, student.Id); } } List <Qaelo.Models.SocietyModel.Society> societies = connection.getAllSocietiesByVarsity(txtText.Text); string html = ""; if (student != null) { foreach (Qaelo.Models.SocietyModel.Society society in societies) { if (new SocietyConnection().getSociety(society.Id).Verified) { //Check if the society was likeed if (connection.societyJoinedByUser(society.Id, student.Id)) { html += string.Format(@"<div class='col-sm-3'> <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='Societies.aspx?unJoinId={7}' class='btn btn-danger pull-right'>Joined</a> </strong><br /> </div><br /> </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-sm-3'> <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='Societies.aspx?joinId={7}' class='btn btn-default pull-right'>Join</a> </strong><br /> </div><br /> </div> </div> </div> ", society.ProfileImage, society.Description, society.Name, society.University, society.SocietyType, society.MeetingTime, society.Number, society.Id); } } }//End of for each } else { foreach (Qaelo.Models.SocietyModel.Society society in societies) { html += string.Format(@"<div class='col-sm-3'> <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='Societies.aspx?joinId={7}' class='btn btn-default pull-right'>Join</a> </strong><br /> </div><br /> </div> </div> </div> ", society.ProfileImage, society.Description, society.Name, society.University, society.SocietyType, society.MeetingTime, society.Number, society.Id); } } //if (html == "") //{ // html = "<div class='alert alert-info'><h3>unfortunately Societies are not available at the moment</div></h3>"; //} lblListOfSocieties.Text = html; }
protected void Page_Load(object sender, EventArgs e) { if (Session["STUDENT"] == null) { Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Student/student-edit-profile.aspx"); } if (IsPostBack) { } else { Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; txtDescription.Text = student.Description; txtEmail.Text = student.Email; txtName.Text = student.FirstName; txtLastName.Text = student.LastName; txtNumber.Text = student.Number; txtQualification.Text = student.QualificationEnrolled; if (student.YearOfStudy != string.Empty) { ddlYear.SelectedIndex = ddlYear.Items.IndexOf(ddlYear.Items.FindByValue(student.YearOfStudy)); } txtText.Text = student.Institution; string proficePic = "~/Images/Users/Students/" + student.ProfileImage; if (student.ProfileImage.Contains("http")) { proficePic = student.ProfileImage; } wizardPicturePreview.Src = proficePic; //Freelancing autofill Qaelo.Models.StudentModel.Freelancer freelancer = new StudentConnection().Freelancer(student.Id); if (freelancer != null) { ddlWork1.Text = freelancer.Work; txtPrice.Text = freelancer.Price; txtDescription.Text = freelancer.Description; string terms = ""; if (freelancer.Price.Contains("Once-off")) { terms = "Once-off"; txtPrice.Text = freelancer.Price.Split(' ')[0]; } else if (freelancer.Price.Contains("Per/Hour")) { terms = "Per/Hour"; txtPrice.Text = freelancer.Price.Split(' ')[0]; } else if (freelancer.Price.Contains("Negotiable")) { terms = "Negotiable"; } else { terms = ""; } ddlPriceTerms.SelectedIndex = ddlPriceTerms.Items.IndexOf(ddlPriceTerms.Items.FindByValue(terms)); } } }
protected void btnFinish_Click(object sender, EventArgs e) { Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"]; if (txtText.Text == "") { lblErrorMessage.Text = "Please select a valid tertiary institutiom"; return; } string filename1 = ""; //Check if the files have something if (wizardPicture.HasFile) { try { filename1 = student.Id + Path.GetFileName(wizardPicture.FileName); wizardPicture.SaveAs(Server.MapPath("~/Images/Users/Students/") + filename1); } catch (Exception ex) { lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; filename1 = student.ProfileImage; } } else { filename1 = student.ProfileImage; } /** Freelancing **/ string price = ""; string work = ""; //set price if (ddlPriceTerms.SelectedItem.Value == "Negotiable") { price = "Negotiable"; } else { price = txtPrice.Text + " " + ddlPriceTerms.SelectedItem.Value; } //Validation if (ddlWork1.Text != string.Empty) { work += ddlWork1.Text; } else { lblErrorMessage.Text = "Please select your freelancing specialty"; return; } if (txtDescription.Text == "") { lblErrorMessage.Text = "Please provide description for your freelancing services"; return; } else if (txtLastName.Text == "") { lblErrorMessage.Text = "Please provide provide your Surname"; return; } else if (txtName.Text == "") { lblErrorMessage.Text = "Please provide provide your Name"; return; } else if (txtNumber.Text == "") { lblErrorMessage.Text = "Please provide provide your Phone number"; return; } else if (txtPrice.Text == "" && ddlPriceTerms.SelectedItem.Value != "Negotiable") { lblErrorMessage.Text = "Please provide price for your freelancing services"; return; } else if (txtQualification.Text == "") { lblErrorMessage.Text = "Please provide provide qualification enrolled"; return; } else if (ddlYear.SelectedItem.Value == "NONE") { lblErrorMessage.Text = "Please select year of study"; return; } string images = filename1; //Upload if (new StudentConnection().updateStudent(new Qaelo.Models.StudentModel.Student(student.Id, "", "", student.Email, txtName.Text, txtText.Text, txtLastName.Text, txtNumber.Text, "", filename1, txtQualification.Text, DateTime.Now, "", ddlYear.SelectedItem.Value))) { //Save freelancing new StudentConnection().updateFreelancer(new Models.StudentModel.Freelancer(student.Id, txtDescription.Text, "", price, work)); Session["STUDENT"] = new AccountConnection().getStudent(student.Id); Response.Redirect("students-profile.aspx?page=profile"); } else { lblErrorMessage.Text = "Sorry an error occured while updating your profile, please try again"; } }
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"); } }