protected void btnUpload_Click(object sender, EventArgs e) { bool validImage = false; advertiser logo = new advertiser(); validImage = logo.validateLogoDimensions(fiuLogo); if (validImage) { bool flag = false; flag = logo.updateLogo(fiuLogo.FileBytes, logo.getCompanyID(User.Identity.Name)); if (flag) { lblMessage.Text = "Upload Successful"; lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Green; } else { lblMessage.Text = "Upload Failed"; lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Red; } } else { lblMessage.Text = "Upload Failed. Please ensure image is in .jpg or .jpeg format and having dimensions 150x100."; lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Red; } }
protected void btnPurchaseDetails_Click(object sender, EventArgs e) { string jobseekerID = Request.QueryString["id"].ToString(); advertiser purchase = new advertiser(); int unitAmount = 1; string totalUnits = purchase.GetUnitCountByEmail(User.Identity.Name); try { bool flag = purchase.DepleteUnitsByEmail(unitAmount, User.Identity.Name); //Redirect user to success page if (flag) { purchase.PurchaseJobseeker(jobseekerID, User.Identity.Name); Response.Redirect("PurchasedJobseekerDetail.aspx?id=" + jobseekerID + "&units=" + totalUnits + "&amt=" + unitAmount); } else { Response.Redirect("PurchaseFailure.aspx"); } } catch (SqlException) { Response.Redirect("PurchaseFailure.aspx"); } }
protected void btnExtendAdvert_Click(object sender, EventArgs e) { dataAccess database = new dataAccess(); advertiser post = new advertiser(); string totalUnits = post.GetUnitCountByEmail(User.Identity.Name); int unitAmount = 0; double addDate = 0; if (ddlAdvertLength.SelectedValue.ToString() == "15") { addDate = 15; unitAmount = 1; } else if (ddlAdvertLength.SelectedValue.ToString() == "30") { addDate = 30; unitAmount = 2; } DateTime expiryDate = post.GetExpireDateByJobPostID(GridView1.SelectedValue.ToString()); bool flag = post.DepleteUnitsByEmail(unitAmount, User.Identity.Name); //Redirect user to success page if (flag) { database.updateData("UPDATE jobsdb_JobPost SET ExpireDate ='" + string.Format("{0:yyyy/MM/dd}", expiryDate.AddDays(addDate)) + "' WHERE ID='" + GridView1.SelectedValue.ToString() + "'"); Response.Redirect("PostSuccessfull.aspx?PostID=" + GridView1.SelectedValue.ToString() + "&type=e&amt=" + unitAmount.ToString() + "&units=" + totalUnits); } else { Response.Redirect("PostFailed.aspx"); } }
protected void btnCheckout_Click(object sender, EventArgs e) { dataAccess database = new dataAccess(); advertiser purchaseUnts = new advertiser(); Int64 ID = 0; string insertString = "INSERT INTO jobsdb_UnitOrder (Employer, UnitQty, UnitAmount, Date, Paid, Credited, Active) VALUES ('" + purchaseUnts.getCompanyID(User.Identity.Name) + "','" + txtTotalUnits.Text.ToString() + "','" + unitAmount + "',GETDATE(),'N','N','Y'); SELECT SCOPE_IDENTITY()"; ID = database.insertData_ReturnID(insertString); Response.Redirect("Order.aspx?OrderID=" + ID); }
protected void FillGridView() { advertiser company = new advertiser(); SqlDataSource sqlDataSourcePurchasedJobseekers = new SqlDataSource(); sqlDataSourcePurchasedJobseekers.ConnectionString = ConfigurationManager.ConnectionStrings["ZamJobsConnString"].ConnectionString.ToString(); string companyID = company.getCompanyID(User.Identity.Name); sqlDataSourcePurchasedJobseekers.SelectCommand = "SELECT jobsdb_PurchaseJobseeker.Company, jobsdb_JobSeeker.ID, jobsdb_JobSeeker.FirstName, jobsdb_JobSeeker.LastName, jobsdb_JobSeeker.ContactNumber, jobsdb_JobSeeker.Email FROM jobsdb_JobSeeker INNER JOIN jobsdb_PurchaseJobseeker ON jobsdb_JobSeeker.ID = jobsdb_PurchaseJobseeker.Jobseeker WHERE Company ='" + companyID + "'"; GridView1.DataSource = sqlDataSourcePurchasedJobseekers; GridView1.DataBind(); }
protected void btnDownloadCV_Click(object sender, EventArgs e) { advertiser CV = new advertiser(); string jobseekerID = Request.QueryString["JobseekerID"].ToString(); byte[] data = CV.getCV(jobseekerID); // Open binary data in word .doc format Response.Clear(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-word"; Response.AddHeader("content-disposition", "attachment;filename=ZamJobsCV_" + CV.GetJobseekerName(jobseekerID) + ".doc"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(data); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { try { string ID = Request.QueryString["JobseekerID"].ToString(); int idNum = Convert.ToInt32(ID); try { advertiser jobseeker = new advertiser(); bool flag = jobseeker.checkJobseeker(ID); if (flag) { if (jobseeker.checkUserAccessToJobseeker(User.Identity.Name, ID)) { btnDownloadCV.Visible = true; lblErrorMsg.Visible = false; DetailsView1.Enabled = true; } else { btnDownloadCV.Visible = false; lblErrorMsg.Text = "You do not have access to the requested jobseeker."; lblErrorMsg.Visible = true; DetailsView1.Enabled = false; DetailsView1.Visible = false; } } else { btnDownloadCV.Visible = false; lblErrorMsg.Text = "There hase been an error with your request."; lblErrorMsg.Visible = true; } } catch (FormatException) { } } catch (Exception) { btnDownloadCV.Visible = false; lblErrorMsg.Text = "There hase been an error with your request."; lblErrorMsg.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { advertiser advertiser = new advertiser(); string ID = advertiser.getCompanyID(User.Identity.Name); dataAccess database = new dataAccess(); System.Data.DataTable logos = database.getTable("SELECT Logo FROM jobsdb_Employer Where ID='" + ID + "'"); if (logos.Rows[0]["Logo"].ToString() == "") { imgLogo.ImageUrl = "~/Images/no-logo.gif"; } else { imgLogo.ImageUrl = "UploadLogo.aspx?imageID=" + ID; displayAdvertiserLogo(); } }
protected void Page_Load(object sender, EventArgs e) { string jobseekerID = Request.QueryString["id"].ToString(); advertiser purchase = new advertiser(); if (purchase.CheckJobseekerStatus(jobseekerID)) { if (purchase.CheckExistingPurchaseJobseeker(jobseekerID, User.Identity.Name)) { btnPurchaseDetails.Enabled = false; } } else { btnPurchaseDetails.Visible = false; lblMessage.Text = "User does not exist or inactive."; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["PostID"] != null) { advertiser jobpost = new advertiser(); string companyID = jobpost.getCompanyID(User.Identity.Name); string jobpostID = Request.QueryString["PostID"].ToString(); string selectQuery = @"SELECT ID, Title, Overview, (SELECT CompanyName FROM jobsdb_Employer WHERE (jobsdb_JobPost.Company = ID)) AS Company, (SELECT Country FROM jobsdb_Country WHERE (ID = jobsdb_JobPost.Country)) AS Country, (SELECT Region FROM jobsdb_Region WHERE (ID = jobsdb_JobPost.Region)) AS Region, (SELECT Location FROM jobsdb_Location WHERE (ID = jobsdb_JobPost.Location)) AS Location, (SELECT Category FROM jobsdb_JobCategory WHERE (ID = jobsdb_JobPost.Category)) AS Category, (SELECT JobType FROM jobsdb_JobType WHERE (ID = jobsdb_JobPost.Type)) AS Type, WorkExperience, WorkExperienceComment, (SELECT EducationLevel FROM jobsdb_Education WHERE (ID = jobsdb_JobPost.EducationLevel)) AS EducationLevel, EducationLevelComment, PersonalAttributes, Competencies, PostDate, ExpireDate FROM jobsdb_JobPost WHERE ID ='" + jobpostID + "' AND Company='" + companyID + "'"; SqlDataSource sqlDataSourceJobPost = new SqlDataSource(); sqlDataSourceJobPost.ConnectionString = ConfigurationManager.ConnectionStrings["ZamJobsConnString"].ConnectionString.ToString(); sqlDataSourceJobPost.SelectCommand = selectQuery; DetailsView1.DataSource = sqlDataSourceJobPost; DetailsView1.DataBind(); } }
protected void btnPost_Click(object sender, EventArgs e) { SqlConnection connString = new SqlConnection(ConfigurationManager.ConnectionStrings["ZamJobsConnString"].ConnectionString); string title = txtJobTitle.Text; string overview = txtJobOverview.Text; string companyEmail = User.Identity.Name; dataAccess advertiser = new dataAccess(); advertiser post = new advertiser(); string totalUnits = post.GetUnitCountByEmail(User.Identity.Name); DataTable IdTbl = advertiser.getTable("SELECT ID FROM jobsdb_Employer WHERE email = '" + companyEmail + "'"); Int16 companyID = Convert.ToInt16(IdTbl.Rows[0]["ID"]); Int16 country = Convert.ToInt16(ddlCountry.SelectedValue); Int16 region = 0; if (ddlRegion.SelectedValue != "") { region = Convert.ToInt16(ddlRegion.SelectedValue); } Int16 location = 0; if (ddlLocation.SelectedValue != "") { location = Convert.ToInt16(ddlLocation.SelectedValue); } Int16 type = Convert.ToInt16(ddlJobType.SelectedValue); Int16 category = Convert.ToInt16(ddlCategory.SelectedValue); Int16 jobType = Convert.ToInt16(ddlJobType.SelectedValue); Int16 experience = Convert.ToInt16(ddlWorkExperience.SelectedValue); string exerienceComment = txtWorkExperience.Text; Int16 education = Convert.ToInt16(ddlEducation.SelectedValue); string educationComment = txtEducation.Text; string personalAttributes = txtPesonalAttributes.Text; string competencies = txtCompetencies.Text; string postDate = string.Format("{0:yyyy/MM/dd}", DateTime.Today); int unitAmount = 0; string expiryDate = string.Format("{0:yyyy/MM/dd}", DateTime.Now.AddDays(Convert.ToDouble(ddlAdvertLength.SelectedValue.ToString()))); if (ddlAdvertLength.SelectedValue.ToString() == "15") { unitAmount = 1; } else if (ddlAdvertLength.SelectedValue.ToString() == "30") { unitAmount = 2; } // create query string to insert data in database string insertString = @" insert into jobsdb_JobPost (Title,Overview,Company,Country,Region,Location,Category,Type, WorkExperience,WorkExperienceComment,EducationLevel,EducationLevelComment,PersonalAttributes,Competencies,PostDate,ExpireDate) values ('" + title + "','" + overview + "','" + companyID + "','" + country + "','" + region + "','" + location + "','" + category + "','" + type + "','" + experience + "','" + exerienceComment + "','" + education + "','" + educationComment + "','" + personalAttributes + "','" + competencies + "','" + postDate + "','" + expiryDate + "'); SELECT SCOPE_IDENTITY()"; try { bool flag = post.DepleteUnitsByEmail(unitAmount, User.Identity.Name); //Redirect user to success page if (flag) { //SqlCommand cmd = new SqlCommand(insertString, connString); Int64 id = advertiser.insertData_ReturnID(insertString); //connString.Open(); // Call ExecuteNonQuery to send command //cmd.ExecuteNonQuery(); //connString.Close(); Response.Redirect("PostSuccessfull.aspx?PostID=" + id + "&type=n&amt=" + unitAmount.ToString() + "&units=" + totalUnits); } else { } } catch (SqlException) { Response.Redirect("PostUnsuccessfull.aspx"); } }
advertiser parentav; //parent navigator void Start() { parent = transform.parent.gameObject; parentav = transform.parent.gameObject.GetComponent <advertiser>(); }
protected Int64 getUnitAmount() { advertiser unitAmt = new advertiser(); return(Convert.ToInt64(unitAmt.getUnitAmount())); }