protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString(); } catch (Exception) { Response.Redirect("~/"); } } facade = new BusinessFacade(myConn); Form.DefaultButton = btn_SendMail.UniqueID; if (string.IsNullOrEmpty(Request.Params["jId"])) { Response.Redirect("~/publicArea/errorpages/Error404.aspx"); } else { JId = Convert.ToInt16(Request.Params["jId"]); } Dj = facade.GetDetailJobById(JId); //Job detail lbl_JobTitle.Text = Dj.Title; lbl_OrgName.Text = Dj.OrgName; txt_Subject.Text = "Application for " + Dj.Title + " via TeachinVietnam"; if (!IsPostBack) { if (!Directory.Exists(Server.MapPath("~/temp/anonymous"))) { Directory.CreateDirectory(Server.MapPath("~/temp/anonymous")); } string[] filePaths = Directory.GetFiles(Server.MapPath("~/temp/anonymous/"), "*.*", SearchOption.AllDirectories); foreach (string path in filePaths) { File.Delete(path); } } //Limit characters txtMessage.Attributes.Add("onkeydown", "textCounter(this,'" + Label1.ClientID + "', 5000)"); txtMessage.Attributes.Add("onkeyup", "textCounter(this,'" + Label1.ClientID + "', 5000)"); txtMessage.Attributes.Add("onmousedown", "textCounter(this,'" + Label1.ClientID + "', 5000)"); txtMessage.Attributes.Add("onmouseup", "textCounter(this,'" + Label1.ClientID + "', 5000)"); txtMessage.Attributes.Add("onblur", "textCounter(this,'" + Label1.ClientID + "', 5000)"); }
protected void Page_Load(object sender, EventArgs e) { facade = new BusinessFacade(myConn); if (!IsPostBack) { try { if (Request.Params["view"] == "preview") { Job = (DetailJob)Session["Preview"]; ViewState["dj"] = Job; if (Session["execJob"] != null) { ViewState["execJob"] = Session["execJob"]; } btn_Apply.Visible = false; hpl_PreviousUrl.Visible = false; btn_SaveJob.Visible = false; btn_Edit.Visible = true; Panel_Additional.Visible = false; } else { id = Convert.ToInt16(Request.QueryString["jId"]); Job = facade.GetDetailJobById(id); Repeater_SameEmployerJob.DataSource = facade.GetJobByEmployer(facade.GetGuidByJobId(id)); Repeater_SameEmployerJob.DataBind(); Repeater_InterestedJob.DataSource = facade.GetJobBySameCate(Job.Category, Job.Category2, Job.Category3); Repeater_InterestedJob.DataBind(); ViewState["detailedJob"] = Job; ViewState["jid"] = id; facade.PlusView(id); //Plus 1 for viewcount } } catch (NullReferenceException ex) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "PopupScript", "<script>alert('"+ex.Message+"');</script>"); //Response.Redirect("~/publicArea/errorpages/Error404.aspx"); } catch (IndexOutOfRangeException outofrange) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "PopupScript", "<script>alert('" + outofrange.Message + "');</script>"); //Response.Redirect("~/publicArea/errorpages/Error404.aspx"); } } if (!IsPostBack) { try { if (Job.OrgLogo != "" && Job.OrgLogo != null) { OrgLogo_img.ImageUrl = General.EMP_LOGO + Job.Username + "/" + Job.OrgLogo; } else { OrgLogo_img.ImageUrl = "~/images/companyLogo/no_image.jpg"; } TimeSpan addago = DateTime.Now.Subtract(Job.UploadDate); if (addago.Days == 0 || addago.Days == 1) { UploadDate_lbl.Text = Convert.ToString(addago.Days) + " day ago"; } else { UploadDate_lbl.Text = Convert.ToString(addago.Days) + " days ago"; } ClosingDate_lbl.Text = string.Format("{0:MMM} {0:dd}, {0:yyyy}", Job.ClosingDate); //Description lbl_Description.Text = HttpUtility.HtmlDecode(Job.Description.ToString().Replace(Environment.NewLine, "<br />")); lbl_BriefInfo.Text = HttpUtility.HtmlDecode(Job.OrgInfo.ToString().Replace(Environment.NewLine, "<br />")); //Salary if (job.SalaryType == false) { lbl_Salary.Text = "negotiable"; } else if (Job.Salary == 0 && Job.SalaryTo == 0) { lbl_Salary.Text = "negotiable"; } else { lbl_Salary.Text = Job.Salary + " - " + Job.SalaryTo + " " + Job.SalaryCurrency + "/" + Job.SalaryPaymentType; } } catch (Exception) { } } if (!IsPostBack) { try { ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString(); hpl_PreviousUrl.NavigateUrl = ViewState["PreviousPageUrl"].ToString(); } catch (Exception) { } } }