Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CareerSiteSettings cs = Utility.GetCareerSiteSettings();

            // Retrieve the JobId from the query string
            try
            {
                try
                {
                    CountryId = this.Request.QueryString["CountryId"].ToString();
                }
                catch
                {
                    // Assume United States if no country is found
                    CountryId = Location.USA;
                }

                JobId = this.Request.QueryString["JobId"].ToString();


                this.jobDetails1.MaskedHiringOrgId = cs.MaskedHiringOrgId;
                this.jobDetails1.EMediaId          = cs.EMediaId;
                this.jobDetails1.JobId             = System.Convert.ToInt32(JobId);
                this.jobDetails1.QuestionIdList    = cs.RetrieveDisplayQuestionIdList();

                try
                {
                    this.jobDetails1.DataBind();
                }
                catch (Exception ex)
                {
                    // Log the error to the database
                    Utility.HandleException(ex);
                    Response.Redirect(ConfigurationManager.AppSettings["jobnotfoundredirectpage"] + "?nf=1");
                }
            }
            catch
            {
                // Log the fact that an invalid JobId was passed in
                Utility.HandleException(new Exception("Invalid JobId: " + this.Request.QueryString["JobId"].ToString()));
                Response.Redirect(ConfigurationManager.AppSettings["jobnotfoundredirectpage"] + "?nf=1");
            }

            try
            {
                this.ltrlCorremetrixProductTag.Text = "";

                UseTinyUrl = Request.QueryString["UseTinyUrl"] != null ? Request.QueryString["UseTinyUrl"].ToString() : "0";
                targetpage = ConfigurationManager.AppSettings["targetpage"];
                if (this.Request.UrlReferrer != null &&
                    (this.Request.UrlReferrer.ToString().ToLowerInvariant().Contains("jobsearch.aspx") || this.Request.UrlReferrer.ToString().ToLowerInvariant().Contains("advancesearch.aspx") ||
                     this.Request.UrlReferrer.ToString().ToLowerInvariant().Contains("jobdetails.aspx") || this.Request.UrlReferrer.ToString().ToLowerInvariant().Contains("tell_a_friend.aspx")))
                {
                    ((HyperLink)this.FindControlInDataTemplate("returntoJobsearch")).Visible = true;
                }

                Jobs Jobs = new Jobs();

                string srcvalue   = string.IsNullOrEmpty(Request["src"]) ? string.Empty : Request["src"];
                string countryid  = Request["countryid"] == null ? "1" : Request["countryid"].ToString();
                string LocationId = Request["LocationID"] == null ? "0" : Request["LocationID"].ToString();
                string FeedName   = Request["FeedName"] == null ? "" : Request["FeedName"].ToString();
                string taleoReqID = "";

                taleoReqID = ((HiddenField)this.FindControlInDataTemplate("hdnReqNo")).Value;
                jobtitle   = ((HiddenField)this.FindControlInDataTemplate("hdnJobTitle")).Value + " : " + taleoReqID;

                strPrimayLoc = ((HiddenField)this.FindControlInDataTemplate("hdnPrimaryLocation")).Value;
                strMultiLocs = ((HiddenField)this.FindControlInDataTemplate("hdnMultiLocations")).Value;
                //strMultiLocs = GetJobMultiLocations(JobId, "");
                //((Label)this.FindControlInDataTemplate("lblLocation")).Text = GetJobMultiLocations2(strPrimayLoc, strMultiLocs);

                pageTitle             = "Bank of America Careers: " + jobtitle;
                lblJobTitle.InnerText = jobtitle;



                if (CountryId == "1")
                {
                    ((Label)this.FindControlInDataTemplate("lblDescripton")).Text    = LinkBuilder(((Label)this.FindControlInDataTemplate("lblDescripton")).Text, "Description");
                    ((Label)this.FindControlInDataTemplate("lblQualification")).Text = LinkBuilder(((Label)this.FindControlInDataTemplate("lblQualification")).Text, "Qualification");
                }
                string CANADAURL = ConfigurationManager.AppSettings["CanadaApplyURL"].ToString();

                if (CountryId == Location.CANADA && CANADAURL != "")
                {
                    ApplyURL = CANADAURL;
                }
                else
                {
                    ApplyURL = ((HiddenField)this.FindControlInDataTemplate("hdnApplyURL")).Value + "&src=" + Request["src"];

                    /*
                     * if (CountryId == "1")
                     * {
                     *  //This is only for usa job.  How does hdnApplyUrl get set?
                     *  ApplyURL = ((HiddenField)this.FindControlInDataTemplate("hdnApplyURL")).Value + "&src=" + Request["src"];
                     *  //ApplyURL = this.jobDetails1.ResolveClientUrl();
                     *  //ApplyURL = "https://bacfhrs.taleo.net/careersection/application.jss?lang=en&type=1&csNo=2&portal=140160497&reqNo=" + this.jobDetails1.JobId + "&postdata=$QEbCcxFGN7OUb1h-_JXJTg==";
                     * }
                     * else
                     * {
                     * }
                     */
                }

                ((HiddenField)this.FindControlInDataTemplate("hApplyNow")).Value = targetpage + "countryid=" + CountryId + "&url=" + HttpUtility.UrlEncode(ApplyURL);
                ViewState["pageTitle"] = pageTitle;
                ViewState["jobtitle"]  = jobtitle;

                ((HyperLink)this.FindControlInDataTemplate("returntoJobsearch")).NavigateUrl = "jobsearch.aspx?" + Request.QueryString;

                string applyJobTitle = CleanJobTitle(jobtitle);

                boanet_safebutton.writeBOASafeButton("Apply1", ((PlaceHolder)this.FindControlInDataTemplate("phApply1")), "ApplyNow|*|" + applyJobTitle, Apply_Click_NoJS, this.Request, ((HiddenField)this.FindControlInDataTemplate("hApplyNow")).Value + "&jobpipeline=" + this.Request.QueryString["jobpipeline"]);
                boanet_safebutton.writeBOASafeButton("Apply2", ((PlaceHolder)this.FindControlInDataTemplate("phApply2")), "ApplyNow|*|" + applyJobTitle, Apply_Click_NoJS, this.Request, ((HiddenField)this.FindControlInDataTemplate("hApplyNow")).Value + "&jobpipeline=" + this.Request.QueryString["jobpipeline"]);

                prepbuttons();

                //not ready For Pro Yet!!
                ((HyperLink)this.FindControlInDataTemplate("TellaFriend")).NavigateUrl = "Tell_a_friend.aspx?" + Request.QueryString;

                //check if this job is in the jobcart. If so, display remove Job Cart Link
                if (Cookie.CookieContainsValue(Cookie.JOB_CART_COOKIE_NAME, JobId))
                {
                    ((Button)this.FindControlInDataTemplate("btnRemoveFromJobCart")).Visible = true;
                    ((Button)this.FindControlInDataTemplate("btnRemoveFromCart")).Visible    = true;
                    ((Button)this.FindControlInDataTemplate("btnAddToJobCart")).Visible      = false;
                    ((Button)this.FindControlInDataTemplate("btnAddToCart")).Visible         = false;
                }

                string cmJobID = "";

                if (countryid == "1")
                {
                    cmJobID = "US" + taleoReqID;
                }
                else
                {
                    //international job
                    //ApplyURL split this by & and get 'id=' value
                    string[] arrUrl = ApplyURL.Split('&');
                    foreach (string parm in arrUrl)
                    {
                        if (parm.StartsWith("id="))
                        {
                            //split by = to get reqno
                            cmJobID = JobId.Substring(0, 3) + parm.Substring(3);
                        }
                    }
                }

                hdnJobId.Value = cmJobID;
                BuildCorremetrixProductTag(cmJobID, CleanJobTitle(jobtitle));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }