public int Insert(CV_ViecLamMongMuonDTO record)
        {
            SqlConnection connect = new SqlConnection(SqlDataAccess.ConnectionString);
            connect.Open();
            try
            {
                string strcmd = "insert into "
                +"CV_VIEC_LAM_MONG_MUON(NganhNgheMongMuon,ViTriMongMuon,MucLuong,HinhThucLamViec,LoaiHinhCongViec,NoiLamVIec)"
                +" values(@NganhNgheMongMuon,@ViTriMongMuon,@MucLuong,@HinhThucLamViec,@LoaiHinhCongViec,@NoiLamVIec)"
                +" SET @ID = SCOPE_IDENTITY()";
                SqlCommand cmd = new SqlCommand(strcmd, connect);
                SqlParameter nganhngheParam = new SqlParameter("@NganhNgheMongMuon", SqlDbType.NVarChar, 50);
                nganhngheParam.Value = record.NganhNgheMongMuon;
                SqlParameter vitriParam = new SqlParameter("@ViTriMongMuon", SqlDbType.NVarChar, 50);
                vitriParam.Value = record.ViTriMongMuon;
                SqlParameter mucluongParam = new SqlParameter("@MucLuong", SqlDbType.NVarChar, 50);
                mucluongParam.Value = record.MucLuong;
                SqlParameter hinhthucParam = new SqlParameter("@HinhThucLamViec", SqlDbType.NVarChar, 50);
                hinhthucParam.Value = record.HinhThucLamViec;
                SqlParameter loaihinhParam = new SqlParameter("@LoaiHinhCongViec", SqlDbType.NVarChar, 50);
                loaihinhParam.Value = record.LoaiHinhCongViec;
                SqlParameter noilamviecParam = new SqlParameter("@NoiLamVIec", SqlDbType.NVarChar, 50);
                noilamviecParam.Value = record.NoiLamViec;

                SqlParameter IDParam = new SqlParameter("@ID", SqlDbType.Int);
                IDParam.Direction = ParameterDirection.Output;
                //MoTaParam.Value = record.MoTa;
                cmd.Parameters.Add(nganhngheParam);
                cmd.Parameters.Add(vitriParam);
                cmd.Parameters.Add(mucluongParam);
                cmd.Parameters.Add(hinhthucParam);
                cmd.Parameters.Add(loaihinhParam);
                cmd.Parameters.Add(noilamviecParam);
                cmd.Parameters.Add(IDParam);
                cmd.ExecuteNonQuery();
                int id = (int)IDParam.Value;
                return id;
            }
            catch (System.Exception ex)
            {
                return -1;
                throw ex;
            }
            finally
            {
                connect.Close();
            }
        }
Exemple #2
0
        protected void butCV_Click(object sender, EventArgs e)
        {
            CV_KinhNghiemLamViecBUS busKNLV = new CV_KinhNghiemLamViecBUS();
            CV_NewBUS busCV = new CV_NewBUS();
            CV_QuaTrinhHocVanBUS busQTHV = new CV_QuaTrinhHocVanBUS();
            CV_ThongTinBoSungBUS busTTBS = new CV_ThongTinBoSungBUS();
            CV_ThongTinUngDungBUS busTTUD = new CV_ThongTinUngDungBUS();
            CV_ViecLamMongMuonBUS busVLMM = new CV_ViecLamMongMuonBUS();

            int idNTV = CurrentUser.ID;

            CV_ThongTinUngDungDTO dtoTTUD = new CV_ThongTinUngDungDTO();
            dtoTTUD.KinhNghiem = cbxTTUngDung_KinhNghiem.Value;
            dtoTTUD.BangCap = cbxTTUngDung_BangCap.Value;
            dtoTTUD.CapBac = cbxTTUngDung_CapBac.Value;
            dtoTTUD.NgoaiNgu = cbxTTUngDung_LoaiNgoaiNgu.Value;
            if (rbTTUngDung_ChuyenCho_Option.Checked)
            {
                dtoTTUD.ChuyenChoO = "Tùy trường hợp";
            }
            else if (rbTTUngDung_ChuyenCho_Yes.Checked)
            {
                dtoTTUD.ChuyenChoO = "Có";
            }
            else if (rdTTUngDung_ChuyenCho_No.Checked)
            {
                dtoTTUD.ChuyenChoO = "Không";
            }

            if (rdTTUngDung_CongTac_No.Checked)
            {
                dtoTTUD.DiCongtac = "Không";
            }
            else if (rdTTUngDung_CongTac_Yes.Checked)
            {
                dtoTTUD.DiCongtac = "Có";
            }
            else if (rdTTUngDung_CongTac_Option.Checked)
            {
                dtoTTUD.DiCongtac = "Tùy trường hợp";
            }

            if (rdTTUngDung_LamNgoaiGio_No.Checked)
            {
                dtoTTUD.LamNgoaiGio = "Không";
            }
            else if (rdTTUngDung_LamNgoaigio_Yes.Checked)
            {
                dtoTTUD.LamNgoaiGio = "Có";
            }
            else if (rdTTUngDung_LamNgoaiGio_Option.Checked)
            {
                dtoTTUD.LamNgoaiGio = "Tùy trường hợp";
            }
            int idTTUD = busTTUD.Insert(dtoTTUD);

            CV_ViecLamMongMuonDTO dtoVLMM = new CV_ViecLamMongMuonDTO();
            dtoVLMM.MucLuong = cbxVLMongMuon_MucLuongDeNghi.Value;
            dtoVLMM.NoiLamViec = cbxVLMongMuon_NoiLamViec.Value;
            dtoVLMM.NganhNgheMongMuon = cbxVLMongMuon_NganhNghe.Value;
            dtoVLMM.ViTriMongMuon = tbxVLMongMuon_ViTri.Value;
            if (cbVLMongMuon_HinhThucCongViec_ChinhThuc.Checked)
            {
                dtoVLMM.HinhThucLamViec = "Nhân viên chính thức";
            }
            else if (cbVLMongMuon_HinhThucCongViec_TuDo.Checked)
            {
                dtoVLMM.HinhThucLamViec = "Tự do";
            }
            else if (cbVLMongMuon_HinhThucCongViec_ThoiVu.Checked)
            {
                dtoVLMM.HinhThucLamViec = "Nhân viên thời vụ";
            }

            if (cbVLMongMuon_LaiCongViec_Parttime.Checked)
            {
                dtoVLMM.LoaiHinhCongViec = "Part-time";
            }
            else if (cbVLMongMuon_LoaiCongViec_Fulltime.Checked)
            {
                dtoVLMM.LoaiHinhCongViec = "Full-time";
            }
            int idVLMM = busVLMM.Insert(dtoVLMM);

            CV_QuaTrinhHocVanDTO dtoQTHV = new CV_QuaTrinhHocVanDTO();
            dtoQTHV.TenTruong = tbxQuaTrinhHocTap_TenTruong.Value;
            dtoQTHV.ChuyenNganh = tbxQuaTrinhHocTap_ChuyenNganh.Value;
            dtoQTHV.BangCap = cbxQuaTrinhHocTap_BangCap.Value;
            dtoQTHV.NamTotNghiep = DateTime.Parse(tbxNgayTotNghiep.Text).Year;
            int idQTHV = busQTHV.Insert(dtoQTHV);

            CV_KinhNghiemLamViecDTO dtoKNLV = new CV_KinhNghiemLamViecDTO();
            dtoKNLV.MoTa = tbxKNLV_MoTa.Value;
            dtoKNLV.TenCongTy = tbxKNLV_TenCongTy.Value;
            dtoKNLV.TinhTP = cbxKNLV_TinhTP.Value;
            dtoKNLV.ViTri = tbxKNLV_ViTriCongViec.Value;
            dtoKNLV.ThoiGianBatDau = new DateTime(int.Parse(cbxKNLV_Begin_Year.Value), int.Parse(cbxKNLV_Begin_Month.Value), 1);
            dtoKNLV.ThoiGianKetThuc = new DateTime(int.Parse(cbxKNLV_End_Year.Value), int.Parse(cbxKNLV_End_Month.Value), 1);
            int idKNLV = busKNLV.Insert(dtoKNLV);

            CV_ThongTinBoSungDTO dtoTTBS = new CV_ThongTinBoSungDTO();
            dtoTTBS.KyNang = tbxKynang.Value;
            dtoTTBS.MucTieuNgheNghiep = tbxMucTieu.Value;
            dtoTTBS.NangKhieuSoThich = tbxNangKhieuSoThich.Value;
            dtoTTBS.UuDiemKhuyetDiem = tbxUuDiemNhuocDiem.Value;
            int idTTBS = busTTBS.Insert(dtoTTBS);

            CV_NewDTO newCV = new CV_NewDTO();
            newCV.IDKinhNghiem = idKNLV;
            newCV.IDNguoiTimViec = CurrentUser.ID;
            newCV.IDQuaTrinhHocTap = idQTHV;
            newCV.IDThongTinBoSung = idTTBS;
            newCV.IDThongTinUngDung = idTTUD;
            newCV.IDViecLamMongMuon = idVLMM;
            int kq = busCV.Insert(newCV);
        }
 public int Insert(CV_ViecLamMongMuonDTO record)
 {
     CV_ViecLamMongMuonDAO dao = new CV_ViecLamMongMuonDAO();
     return dao.Insert(record);
 }