public void SetExistInfo()
    {
        User1 = (User)Session["User"];
        if (User1 == null)
        {
            Session["Login"] = null;
            Session["User"] = null;
            Response.Redirect("Login.aspx");
        }
        else
        {
            User1.SetFullInfo();
            Session["User"] = User1;
            txtName.Text = User1.LastName + " " + User1.FirstName;
            txtDateOfBirth.Text = Convert.ToDateTime(User1.DateBirthDay).ToString("MM/dd/yyyy");
            txtPhoneNumber.Text = User1.PhoneNumber;
            txtMaxim.Text = User1.MaximOfLife;
            ThumbImg = User1.ThumImg;

            BindDropDownList(ddlProvine, GetAllProvine(), "ProvinceName", "ProvinceID");
            ddlProvine.SelectedValue = User1.Address.Province.Id;

            BindDropDownList(ddlDistrict, GetAllDistrictInProvince(User1.Address.Province.Id), "DistrictName", "DistrictID");
            ddlDistrict.SelectedValue = User1.Address.District.Id;

            BindDropDownList(ddRaces, GetAllRaces(), "RaceName", "RaceID");
            ddRaces.SelectedValue = User1.Races.RaceId;

            BindDropDownList(ddlJob, GetAllJobs(), "JobIndustryName", "JobIndustryID");
            ddlJob.SelectedValue = User1.JobIndustries.JobIndutriesId;

            BindDropDownList(ddlSex, GetAllSexs(), "SexName", "SexID");
            ddlSex.SelectedValue = User1.Sex.SexId;
        }
    }
    public void SetExistInfo()
    {
        User1 = (User)Session["Admin"];
        if (User1 == null)
        {
            Session["Login"] = null;
            Session["Admin"] = null;
            Response.Redirect("/Admin/Login.aspx");
        }
        else
        {
            var userId = Request.QueryString["UserId"];
            var user2 = new User(userId);
            user2.SetFullInfo();
            Session["User"] = user2;
            txtName.Text = user2.LastName + " " + user2.FirstName;
            txtDateOfBirth.Text = Convert.ToDateTime(user2.DateBirthDay).ToString("dd/MM/yyyy");
            txtPhoneNumber.Text = user2.PhoneNumber;
            txtMaxim.Text = user2.MaximOfLife;
            ThumbImg = user2.ThumImg;

            BindDropDownList(ddlProvine, GetAllProvine(), "ProvinceName", "ProvinceID");
            ddlProvine.SelectedValue = user2.Address.Province.Id;

            BindDropDownList(ddlDistrict, GetAllDistrictInProvince(User1.Address.Province.Id), "DistrictName", "DistrictID");
            ddlDistrict.SelectedValue = user2.Address.District.Id;

            BindDropDownList(ddRaces, GetAllRaces(), "RaceName", "RaceID");
            ddRaces.SelectedValue = user2.Races.RaceId;

            BindDropDownList(ddlJob, GetAllJobs(), "JobIndustryName", "JobIndustryID");
            ddlJob.SelectedValue = user2.JobIndustries.JobIndutriesId;

            BindDropDownList(ddlSex, GetAllSexs(), "SexName", "SexID");
            ddlSex.SelectedValue = user2.Sex.SexId;
        }
    }
 private void LoadImage(string userId)
 {
     var user = new User(userId);
     user.SetFullInfo();
     ThumbImg = user.ThumImg;
 }
 private string BuidRecommendResume(string jobid)
 {
     var buider = new StringBuilder();
     var job = new Jobs(jobid);
     job.SetFullJobInfo();
     //jobs.SetFullJobInfo();
     var list = job.ResumesRanking();
     list.Sort(Comparison);
     buider.AppendLine("<h4>Cám ơn bạn đã đăng tin tuyển dụng của chúng tôi<h4>");
     buider.AppendLine("<p>Dưới đây là danh sách các ứng viên có thể phù hợp với công việc của ban</p>");
     buider.AppendLine("<table id='example1' class='table table-bordered table-striped dataTable' aria-describedby='example1_info'>");
     buider.AppendLine("<thead><tr role='row>");
     buider.AppendLine("<th style='text-align: center'>STT</th>");
     buider.AppendLine("<th style='text-align: center'>Họ Tên</th>");
     buider.AppendLine("<th style='text-align: center'>Tuổi</th>");
     buider.AppendLine("<th style='text-align: center'>Vị Trí Ứng Tuyển</th>");
     buider.AppendLine("<th style='text-align: center'></th>");
     buider.AppendLine(" </tr></thead>");
     buider.AppendLine(" <tbody role='alert' aria-live='polite' aria-relevant='all'>");
     int i = 0;
     foreach (Resume resume in list.Take(10))
     {
         i += 1;
         var u = new User(resume.User.UserId);
         u.SetFullInfo();
         DateTime birtYear = Convert.ToDateTime(u.DateBirthDay);
         var age = DateTime.Now.Year - birtYear.Year;
         buider.AppendLine("<tr>");
         buider.AppendLine("<th style='text-align: center'>"+i+"</th>");
         buider.AppendLine("<th style='text-align: center'>" + u.LastName + " &nbsp;" +u.FirstName+ "</th>");
         buider.AppendLine("<th style='text-align: center'>"+age+"</th>");
         buider.AppendLine("<th style='text-align: center'>"+resume.JobPosition.Position+"</th>");
         buider.AppendLine("<th style='text-align: center'><a href='"+"http://"+Request.Url.Host + ":" + Request.Url.Port +"/ResumeDetail.aspx?resumeid=" + resume.ResumeId+"&userid="+resume.User.UserId);
         buider.AppendLine("'>Xem Chi Tiết</a></th>");
         buider.AppendLine("</tr>");
     }
     buider.AppendLine("</tbody>");
     buider.AppendLine("<tfoot></tfoot></table>");
     return buider.ToString();
 }
    protected void btnUserInfoSubmit_OnClick(object sender, EventArgs e)
    {
        try
        {
            var name = txtName.Text.Split(' ');
            var lastname = name[0];
            var firstname = name[1];
            var birthDay = Convert.ToDateTime(txtDateOfBirth.Text);
            var sex = new Sex(ddlSex.SelectedValue, ddlSex.SelectedItem.Text);
            var phoneNumber = txtPhoneNumber.Text;
            var job = new JobIndustries(ddlJob.SelectedValue,ddlJob.SelectedItem.Text);
            var province = new Province(ddlProvine.SelectedValue,ddlProvine.SelectedItem.Text);
            var district = new District(ddlDistrict.SelectedValue,ddlDistrict.SelectedItem.Text, province);
            var address = new Address(province, district);
            var race = new Races(ddRaces.SelectedValue, ddRaces.SelectedItem.Text);
            var maximOfLife = txtMaxim.Text;
            var photoPath = "";
            if (this.fuResume.HasFile)
            {
                string imgThumb = "E:\\DOCUMENTS\\School\\ASP.NETWorkSpaces\\WebFindingJobsMVCmodel\\Images\\" + this.fuResume.FileName;
                this.fuResume.SaveAs(imgThumb);
                photoPath = "/Images/" + this.fuResume.FileName;
            }
            User1 = (User)Session["User"];
            var returnValue = User1.SetFullInfo(firstname, lastname, birthDay, sex, phoneNumber, job, address, race, maximOfLife,photoPath);
            SetExistInfo();

            if (returnValue)
            {
                Session["User"] = User1;
                SetExistInfo();
                JavaScriptAleart("Thực hiện thành công");
            }
            else
            {
                JavaScriptAleart("Chỉnh sửa không thành công. Vui lòng load lại trang và thử lại");
            }
        }
        catch (Exception exception)
        {
            Response.Write(exception.ToString());
            JavaScriptAleart("Chỉnh sửa không thành công. Vui lòng load lại trang và thử lại");
        }
    }
 private void LoadPersonalInfo()
 {
     User5 = (User)Session["User"];
     if (User5!=null)
     {
         LoadImage(User5.UserId);
         User5.SetFullInfo();
         Session["User"] = User5;
         lbFullName.Text = User5.LastName + " " + User5.FirstName;
         lbGender.Text = User5.Sex.SexName;
         lbDateOfBirth.Text = Convert.ToDateTime(User5.DateBirthDay).ToString("dd/MM/yyyy");
         lbAddress.Text = User5.Address.District.DistrictName + " , " + User5.Address.Province.NameProvince;
     }
     else
     {
         String userId = Request.QueryString["userid"];
         LoadImage(userId);
         divBtnRecruit.Visible = true;
         divBtnUpdate.Visible = false;
         User5=new User(userId);
         User5.SetFullInfo();
         lbFullName.Text = User5.LastName + " " + User5.FirstName;
         lbGender.Text = User5.Sex.SexName;
         lbDateOfBirth.Text = Convert.ToDateTime(User5.DateBirthDay).ToString("dd/MM/yyyy");
         lbAddress.Text = User5.Address.District.DistrictName + " , " + User5.Address.Province.NameProvince;
     }
 }