protected void Page_Load(object sender, EventArgs e) { Page.Form.DefaultButton = btn_UpdatePrivacy_em.UniqueID; MembershipUser mu = Membership.GetUser(); Username = mu.UserName; UserId = mu.ProviderUserKey.ToString(); string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; jobAlertLogic = new JobAlertLogic(connStr); isRegister = jobAlertLogic.IsRegisterJobAlert(Username); if (!isRegister) { Panel_JobAlert.Visible = false; } if ((Boolean)Context.Profile.GetPropertyValue("Employee.AllowCreateCV") == false) { lbtn_AdsCv.Visible = false; } if (!IsPostBack) { try { ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString(); } catch (Exception) { Response.Redirect("~/Account/my-jobs.aspx"); } if (isRegister) { bool AlertActive = jobAlertLogic.GetActiveValue(Username); if (AlertActive) { cb_EnableJobAlert.Checked = true; } } } checkChanged = cb_EnableJobAlert.Checked; }
protected void btn_Register_Click(object sender, EventArgs e) { if (Username != "" && Username.Length != 0) { try { JobAlertLogic jobAlertLogic = new JobAlertLogic(myConn); jobAlertLogic.RegisterJobAlert(Username); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('You have successfully registered job alert. Wish you get your dream job.');window.location.href='JobAlert.aspx';</script>"); } catch (Exception ex) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('" + ex.Message + "');</script>"); } } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('Please login again. \nIf there is any problem, please contact us.');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { try { MembershipUser mu = Membership.GetUser(); Username = mu.UserName; UserId = mu.ProviderUserKey.ToString(); if (!IsPostBack) { //Already exist CV. if ((Boolean)Context.Profile.GetPropertyValue("Employee.AllowCreateCV") == false) { JobAlertLogic jobAlertLogic = new JobAlertLogic(myConn); if (jobAlertLogic.IsRegisterJobAlert(Username)) { if (jobAlertLogic.IsActiveJobAlert(Username)) { hpl_CreateCV.Visible = false; facade = new BusinessFacade(myConn); string cate1 = Context.Profile.GetPropertyValue("CV.DesiredEmployment").ToString(); string cate2 = Context.Profile.GetPropertyValue("CV.DesiredEmployment2").ToString(); string cate3 = Context.Profile.GetPropertyValue("CV.DesiredEmployment3").ToString(); string lo1 = Context.Profile.GetPropertyValue("CV.DesiredLocations").ToString(); string lo2 = Context.Profile.GetPropertyValue("CV.DesiredLocations2").ToString(); string lo3 = Context.Profile.GetPropertyValue("CV.DesiredLocations3").ToString(); CollectionPager1.PageSize = General.PAGE_SIZE; CollectionPager1.MaxPages = General.MAX_PAGE; CollectionPager1.DataSource = facade.getJobAlert(cate1, cate2, cate3, lo1, lo2, lo3); CollectionPager1.BindToControl = Repeater1; Repeater1.DataSource = CollectionPager1.DataSourcePaged; Repeater1.DataBind(); if (Repeater1.Items.Count == 0) { Panel_NoJobsInList.Visible = true; Repeater1.Visible = false; } else { panel_headingmodule.Visible = true; string jobLabel = "jobs"; if (Repeater1.Items.Count == 1 || Repeater1.Items.Count == 0) { jobLabel = "job"; } Literal1.Text = string.Format("We found {0} {1} that may fit your expectation. Wish you a great career ahead!", Repeater1.Items.Count,jobLabel); } } else { Panel_IsActive.Visible = true; } } else { Panel_IsRegister.Visible = true; } } else { Panel_NotCreateCV.Visible = true; } } } catch (Exception ex) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('" + ex.Message + "');</script>"); } }