protected void btnUpdate_Click(object sender, EventArgs e) { if (txtConfirmPassword.Text == txtNewPassword.Text) { AccountConnection account = new AccountConnection(); Qaelo.Models.CompanyModel.Company s = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"]; //Test password if (account.correctCompany(s.Email, Secrecy.HashPassword(txtCurrentPassword.Text)) && account.updateCompanyPassword(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 btnFinish_Click(object sender, EventArgs e) { Qaelo.Models.CompanyModel.Company com = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"]; if (new CompanyConnection().updatePost(new Models.CompanyModel.Job(Convert.ToInt32(Request.QueryString["editId"]), com.Id, DateTime.Now, txtADetails.Text, DateTime.Now, txtDescription.Text, txtTitle.Text, ddlType.SelectedItem.Value))) { Response.Redirect("ManagePostings.aspx?page=editPost"); } else { lblErrorMessage.Text = "An error occured,please try again"; lblSuccess.Text = ""; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["COMPANY"] == null) { Response.Redirect("~/Web/Account/tempLogin.aspx"); } string html = ""; CompanyConnection connection = new CompanyConnection(); Qaelo.Models.CompanyModel.Company company = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"]; List <Qaelo.Models.CompanyModel.Job> jobs = connection.getAllPostByCompanyId(company.Id); foreach (Qaelo.Models.CompanyModel.Job item in jobs) { List <int> userIds = connection.getAllLikedUsers(item.Id, company.Id); html += string.Format(@"<h3 align='center'><a href='landlord-my-rooms.aspx'>List of users who like:{0} Post</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>", item.Title); foreach (int userId in userIds) { Qaelo.Models.StudentModel.Student s = new Data.Accounts.AccountConnection().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); } html += "</tbody></table><br/>"; } //if (html == "") html = "<div class='alert alert-info'><h3>I'ts Empty here, Data will soon be available as soon as your posts get interaction</div></h3>"; lblListOfUsers.Text = html; }
protected void Page_Load(object sender, EventArgs e) { if (Session["COMPANY"] == null) { Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Company/EditProfile.aspx"); } if (!IsPostBack) { //Get Company Qaelo.Models.CompanyModel.Company company = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"]; txtDescription.Text = company.Description; txtEmail.Text = company.Email; txtFacebookLink.Text = company.FacebookLink; txtName.Text = company.Name; txtNumber.Text = company.Number; txtCompanyType.Text = company.CompanyType; wizardPicturePreview.Src = "~/Images/Users/Company/" + company.ProfileImage; } }
protected void btnFinish_Click(object sender, EventArgs e) { string filename = ""; Qaelo.Models.CompanyModel.Company company = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"]; //Check if the files have something if (wizardPicture.HasFile) { try { filename = company.Id + Path.GetFileName(wizardPicture.FileName); wizardPicture.SaveAs(Server.MapPath("~/Images/Users/Company/") + filename); } catch (Exception ex) { lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; return; } } else { filename = company.ProfileImage; } Qaelo.Models.CompanyModel.Company companyUpdate = new Models.CompanyModel.Company(company.Id, txtCompanyType.Text, txtDescription.Text, company.Email, txtFacebookLink.Text, txtName.Text, txtNumber.Text, "", filename, company.RegistrationDate, company.UserType, company.Verified); if (new CompanyConnection().updateCompany(companyUpdate)) { lblSuccess.Text = "Profile Updated Successfully"; lblErrorMessage.Text = ""; Session["COMPANY"] = companyUpdate; } else { lblErrorMessage.Text = "Could not update profile, please try again"; lblSuccess.Text = ""; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["COMPANY"] == null) { Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Company/ManagePostings.aspx"); } if (Request.QueryString["page"] != null) { if (Request.QueryString["page"].ToString() == "post") { lblSuccess.Text = "Successfully created a post"; } if (Request.QueryString["page"].ToString() == "editPost") { lblSuccess.Text = "Successfully Edited a post"; } } CompanyConnection connection = new CompanyConnection(); Qaelo.Models.CompanyModel.Company company = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"]; if (Request.QueryString["delId"] != null) { if (connection.deletePost(Convert.ToInt32(Request.QueryString["delId"].ToString()), company.Id)) { lblSuccess.Text = "Post has been deleted successfuly"; } else { lblErrorMessage.Text = "An error occurred while deleting Post please try again"; } } List <Qaelo.Models.CompanyModel.Job> jobs = connection.getAllPostByCompanyId(company.Id); string html = ""; foreach (Qaelo.Models.CompanyModel.Job item in jobs) { html += string.Format(@"<div class='col-lg-3'> <div class='thumbnail'> <div class='w3-card-12'> <figure > <img src='../../../Images/Users/Company/{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>{3}</small></b></h6> <strong> Closing Date : <small> {4}</small></strong><br/> <strong> Date Posted: <small> {5}</small></strong><br/> </strong> <a href='ManagePostings.aspx?delId={6}' class='btn btn-danger pull-lef'>Delete</a> <a href='EditPost.aspx?editId={6}' class='btn btn-info pull-right'>Edit</a> </div> </div> </div> </div>", company.ProfileImage, item.Description, company.Name, item.Title, General.getDateString(item.ClosingDate), General.getPastTimeString(item.DatePosted), item.Id); } lblPosts.Text = html; }