示例#1
0
        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>");
            }
        }