protected void Button1_Click(object sender, EventArgs e)
        {
            CaptchaBUS buscaptcha = new CaptchaBUS();
            string CaptchaStr = buscaptcha.GetString(CaptchaID);

            if (xacNhanCaptchar.Text.ToString().Equals(CaptchaStr, StringComparison.OrdinalIgnoreCase))
            {
                string strname = username.Text;
                //Begin 'Luu vao data base'
                NhaTuyenDungBUS bus = new NhaTuyenDungBUS();
                NhaTuyenDungDTO dto = new NhaTuyenDungDTO();
                dto.DiaChi = diaChi.Text;
                dto.Email = username.Text;
                dto.LinhVuc = int.Parse(nganhNghe.SelectedValue);
                dto.TenCongTy = tenCongTy.Text;
                dto.MoTa = TextBox1.Text;
                dto.Password = password.Text;

                //End 'Luu vai database'
                int result = bus.Insert(dto);
                if (result!=0)//success
                {
                      //gui mail xac nhan
                        SendMail(sender, e);
                      //redirect den trang bao thanh cong
                        Response.Redirect("../DangKi/DangKiTaiKhoanNhaTuyenDung.aspx?AddUser=" + strname);
                }
                else
                {
                    //redirect den trang bao loi
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //String strEmail = Session["Email"];

            string strEmail = "*****@*****.**";
            NhaTuyenDungDTO nhatuyendung = new NhaTuyenDungDTO();

            NhaTuyenDungBUS ntdBus = new NhaTuyenDungBUS();

            nhatuyendung = ntdBus.SelectByEmail(strEmail);

            TenCongTy.Value = nhatuyendung.TenCongTy;
            TenLienLac.Value = nhatuyendung.TenNguoiDaiDien;
            Email.Value = nhatuyendung.Email;
            DiaChi.Value = nhatuyendung.DiaChi;
            QuocGia.Value = "F4";
            TinhThanh.Value = "F4";
            DienThoai.Value = nhatuyendung.DienThoai;
            Fax.Value = "F4";

            // Lấy thông tin phân loại ứng viên
            List<string> ListBangCap = new List<string>();
            LoaiUngVienBUS bus = new LoaiUngVienBUS();
            ListBangCap = bus.GetBangCap();
            List<string> ListNganhNghe = bus.GetNganhNghe();
            List<string> ListCapBac = bus.GetCapBac();

            for (int i = 0; i < ListBangCap.Count; i++)
            {
                ListItem liBangCap = new ListItem(ListBangCap[i], ListBangCap[i]);
                BangCap.Items.Add(liBangCap);
            }

            for (int i = 0; i < ListCapBac.Count; i++)
            {
                ListItem LiCapBac = new ListItem(ListCapBac[i], ListCapBac[i]);
                CapBac.Items.Add(LiCapBac);
            }

            for (int i = 0; i < ListNganhNghe.Count; i++)
            {
                ListItem LiNganhNghe = new ListItem(ListNganhNghe[i], ListNganhNghe[i]);
                NganhNghe.Items.Add(LiNganhNghe);
            }

            // lấy tỉnh thành, quốc gia

            List<TinhThanhDTO> allrecord = new List<TinhThanhDTO>();
            TinhThanhBUS bustt = new TinhThanhBUS();
            allrecord = bustt.GetAllRecord();
            for (int i = 0; i < allrecord.Count; i++)
            {
                ListItem li = new ListItem(allrecord[i].TenTinhThanh, allrecord[i].ID.ToString());
                TinhThanhList.Items.Add(li);
            }

            List<QuocGiaDTO> allQuocGia = new List<QuocGiaDTO>();
            QuocGiaBUS busqg = new QuocGiaBUS();
            allQuocGia = busqg.GetAllRecord();
            for (int i = 0; i < allQuocGia.Count; i++)
            {
                ListItem li = new ListItem(allQuocGia[i].TenQuocGia, allQuocGia[i].MaQuocGia.ToString());
                QuocGiaList.Items.Add(li);
            }

            // thêm giới tính vào listbox

            GioiTinh.Items.Add(new ListItem("Nam", "0"));
            GioiTinh.Items.Add(new ListItem("Nữ", "1"));
            GioiTinh.Items.Add(new ListItem("Khác", "2"));

            //Thêm số năm kinh nghiệm

            KinhNghiem.Items.Add(new ListItem(" < 1 năm", "1"));
            KinhNghiem.Items.Add(new ListItem(" 1 -> 5 năm", "2"));
            KinhNghiem.Items.Add(new ListItem(" 5 -> 10 năm", "3"));
            KinhNghiem.Items.Add(new ListItem(" > 10 năm", "4"));
        }
예제 #3
0
        public NhaTuyenDungDTO SelectByEmail(string email)
        {
            SqlConnection connect = new SqlConnection(SqlDataAccess.ConnectionString);
                    connect.Open();

                    StringBuilder command = new StringBuilder();
                    command.Append("select * from NHATUYENDUNG where Email='");
                    command.Append(email);
                    command.Append("'");
                    SqlCommand cmd = new SqlCommand(command.ToString(), connect);
                    SqlDataReader r = cmd.ExecuteReader();
                    NhaTuyenDungDTO returnrecord = new NhaTuyenDungDTO();
                    r.Read();
                    object[] obj = new object[11];
                    r.GetValues(obj);

                    returnrecord.TenCongTy = obj[1].ToString();
                    returnrecord.Email = obj[2].ToString().TrimEnd(' ');
                    returnrecord.Password = obj[3].ToString().TrimEnd(' ');
                    returnrecord.DiaChi = obj[4].ToString();
                    returnrecord.DienThoai = obj[5].ToString();
                    returnrecord.LinhVuc = int.Parse(obj[6].ToString());
                    returnrecord.TenNguoiDaiDien = obj[7].ToString();
                    returnrecord.MoTa = obj[8].ToString();
                    returnrecord.MaTKNganHang = obj[9].ToString();
                    returnrecord.TrangThai = int.Parse(obj[10].ToString());

                    connect.Close();
                    return returnrecord;
        }
예제 #4
0
        public int Insert(NhaTuyenDungDTO newrecord)
        {
            int result;
                    try
                    {
                        SqlConnection connect = new SqlConnection(SqlDataAccess.ConnectionString);
                        connect.Open();
                        try
                        {
                            SqlCommand cmd = new SqlCommand("sp_InsertNHATUYENDUNG", connect);
                            cmd.CommandType = System.Data.CommandType.StoredProcedure;
                            SqlParameter tencongty_param = cmd.Parameters.Add("@TenCongTy", System.Data.SqlDbType.NVarChar);
                            tencongty_param.Direction = System.Data.ParameterDirection.Input;
                            tencongty_param.Value = newrecord.TenCongTy;
                            SqlParameter email_param = cmd.Parameters.Add("@Email", System.Data.SqlDbType.VarChar);
                            email_param.Direction = System.Data.ParameterDirection.Input;
                            email_param.Value = newrecord.Email;
                            SqlParameter pass_param = cmd.Parameters.Add("@Password", System.Data.SqlDbType.VarChar);
                            pass_param.Direction = System.Data.ParameterDirection.Input;
                            pass_param.Value = newrecord.Password;
                            SqlParameter diachi_param = cmd.Parameters.Add("@DiaChi", System.Data.SqlDbType.NVarChar);
                            diachi_param.Direction = System.Data.ParameterDirection.Input;
                            diachi_param.Value = newrecord.DiaChi;
                            SqlParameter dienthoai_param = cmd.Parameters.Add("@DienThoai", System.Data.SqlDbType.NChar);
                            dienthoai_param.Direction = System.Data.ParameterDirection.Input;
                            dienthoai_param.Value = newrecord.DienThoai;
                            SqlParameter linhvuc_param = cmd.Parameters.Add("@LinhVuc", System.Data.SqlDbType.Int);
                            linhvuc_param.Direction = System.Data.ParameterDirection.Input;
                            linhvuc_param.Value = newrecord.LinhVuc;
                            SqlParameter tennguoidaidien_param = cmd.Parameters.Add("@TenNguoiDaiDien", System.Data.SqlDbType.NVarChar);
                            tennguoidaidien_param.Direction = System.Data.ParameterDirection.Input;
                            tennguoidaidien_param.Value = newrecord.TenNguoiDaiDien;
                            SqlParameter mota_param = cmd.Parameters.Add("@MoTa", System.Data.SqlDbType.Text);
                            mota_param.Direction = System.Data.ParameterDirection.Input;
                            mota_param.Value = newrecord.MoTa;
                            SqlParameter maTKNH_param = cmd.Parameters.Add("@MaTKNganHang", System.Data.SqlDbType.NChar);
                            maTKNH_param.Direction = System.Data.ParameterDirection.Input;
                            maTKNH_param.Value = newrecord.MaTKNganHang;
                            SqlParameter trangthai_param = cmd.Parameters.Add("@TrangThai", System.Data.SqlDbType.Int);
                            trangthai_param.Direction = System.Data.ParameterDirection.Input;
                            trangthai_param.Value = newrecord.TrangThai;
                            SqlParameter id_param = cmd.Parameters.Add("@ID", System.Data.SqlDbType.Int);
                            id_param.Direction = System.Data.ParameterDirection.Output;

                            result = cmd.ExecuteNonQuery();
                        }
                        catch (System.Exception ex)
                        {
                            throw ex;
                        }
                        finally
                        {
                            connect.Close();
                        }
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }

                    return result;
        }
예제 #5
0
 public int Insert(NhaTuyenDungDTO newrecord)
 {
     NhaTuyenDungDAO dao = new NhaTuyenDungDAO();
     return dao.Insert(newrecord);
 }