public int Insert(CV_KinhNghiemLamViecDTO record) { SqlConnection connect = new SqlConnection(SqlDataAccess.ConnectionString); connect.Open(); try { string strcmd = "insert into CV_KINH_NGHIEM_LAM_VIEC(TenCongTy,ViTri,ThoiGianBatDau,ThoiGianKetThuc,TinhTP,MoTa) values(@TenCongTy,@ViTri,@ThoiGianBatDau,@ThoiGianKetThuc,@TinhTP,@MoTa) SET @ID = SCOPE_IDENTITY()"; SqlCommand cmd = new SqlCommand(strcmd, connect); SqlParameter congtyParam = new SqlParameter("@TenCongTy", SqlDbType.NVarChar, 50); congtyParam.Value = record.TenCongTy; SqlParameter vitriParam = new SqlParameter("@ViTri", SqlDbType.NVarChar, 50); vitriParam.Value = record.ViTri; SqlParameter BeginTimeParam = new SqlParameter("@ThoiGianBatDau", SqlDbType.DateTime); BeginTimeParam.Value = record.ThoiGianBatDau; SqlParameter EndTimeParam = new SqlParameter("@ThoiGianKetThuc", SqlDbType.DateTime); EndTimeParam.Value = record.ThoiGianKetThuc; SqlParameter TinhTPParam = new SqlParameter("@TinhTP", SqlDbType.NVarChar,50); TinhTPParam.Value = record.TinhTP; SqlParameter MoTaParam = new SqlParameter("@MoTa", SqlDbType.NText); MoTaParam.Value = record.MoTa; SqlParameter IDParam = new SqlParameter("@ID", SqlDbType.Int); IDParam.Direction = ParameterDirection.Output; //MoTaParam.Value = record.MoTa; cmd.Parameters.Add(congtyParam); cmd.Parameters.Add(vitriParam); cmd.Parameters.Add(BeginTimeParam); cmd.Parameters.Add(EndTimeParam); cmd.Parameters.Add(TinhTPParam); cmd.Parameters.Add(MoTaParam); cmd.Parameters.Add(IDParam); cmd.ExecuteNonQuery(); int id = (int)IDParam.Value; return id; } catch (System.Exception ex) { return -1; throw ex; } finally { connect.Close(); } }
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_KinhNghiemLamViecDTO record) { CV_KinhNghiemLamViecDAO dao = new CV_KinhNghiemLamViecDAO(); return dao.Insert(record); }