private void CargarDatosCandidato(string IdCandidato) { try { DataSet dsCartera = new DataSet(); CarteraCandidatoBE CarteraCandidatoBE = new CarteraCandidatoBE() { OPCION = 1, USUARIO = General.General.GetCodigoUsuario, IdCartera = IdCandidato, }; dsCartera = new CarteraCandidatoBL().ProcesarCarteraCandidato(CarteraCandidatoBE); if (dsCartera.Tables[0].Rows.Count > 0) { //txtvApePaterno.Text = dsCartera.Tables[0].Rows[0]["vApePaterno"].ToString(); //txtvApeMaterno.Text = dsCartera.Tables[0].Rows[0]["vApeMaterno"].ToString(); //txtvNombre.Text = dsCartera.Tables[0].Rows[0]["vNombre"].ToString(); //cboIdTipoDocumento_tt.SelectedValue = dsCartera.Tables[0].Rows[0]["IdTipoDocumento_tt"].ToString(); //txtvNroDocumento.Text = dsCartera.Tables[0].Rows[0]["vNroDocumento"].ToString(); //cboIdTipoPersona_tt.SelectedValue = dsCartera.Tables[0].Rows[0]["IdTipoPersona_tt"].ToString(); //txtvContacto.Text = dsCartera.Tables[0].Rows[0]["vContacto"].ToString(); //txtvCargo.Text = dsCartera.Tables[0].Rows[0]["vCargo"].ToString(); //txtvTelefono1.Text = dsCartera.Tables[0].Rows[0]["vTelefono1"].ToString(); //txtvTelefono2.Text = dsCartera.Tables[0].Rows[0]["vTelefono2"].ToString(); //txtvTelefono3.Text = dsCartera.Tables[0].Rows[0]["vTelefono3"].ToString(); //txtvCorreo.Text = dsCartera.Tables[0].Rows[0]["vCorreo"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnBuscar_Click(object sender, EventArgs e) { try { DataSet ds = new DataSet(); CarteraCandidatoBE CarteraCandidatoBE = new CarteraCandidatoBE() { OPCION = 1, USUARIO = General.General.GetUsuario, vApePaterno = TextBoxX1.Text.ToString().Trim(), IdTipoDocumento_tt = cboIdTipoDocumento_tt.SelectedValue.ToString(), vNroDocumento = txtvNroDocumento.Text, IdTipoPersona_tt = cboIdTipoPersona_tt.SelectedValue.ToString(), UsuarioID = cboUsuarioID.SelectedValue.ToString().Equals("--Seleccionar--") ? string.Empty : cboUsuarioID.SelectedValue.ToString(), FlgPagadora = _FlgPagadora }; ds = new CarteraCandidatoBL().ProcesarCarteraCandidato(CarteraCandidatoBE); dgvCarteraCantidato.DataSource = ds.Tables[0]; lblRegistros.Text = ds.Tables[0].Rows.Count.ToString() + " registro(s)"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DataSet ProcesarCarteraCandidato(CarteraCandidatoBE BE) { DataSet dsResult; try { cmd = db.GetStoredProcCommand("CarteraCandidato_Mnt"); db.AddInParameter(cmd, "OPCION", DbType.Int32, BE.OPCION); db.AddInParameter(cmd, "USUARIO", DbType.String, BE.USUARIO); db.AddInParameter(cmd, "IdCartera", DbType.String, BE.IdCartera); db.AddInParameter(cmd, "cRucPagadora", DbType.String, BE.cRucPagadora); db.AddInParameter(cmd, "vApePaterno", DbType.String, BE.vApePaterno); db.AddInParameter(cmd, "vApeMaterno", DbType.String, BE.vApeMaterno); db.AddInParameter(cmd, "vNombre", DbType.String, BE.vNombre); db.AddInParameter(cmd, "IdTipoDocumento_tt", DbType.String, BE.IdTipoDocumento_tt); db.AddInParameter(cmd, "vNroDocumento", DbType.String, BE.vNroDocumento); db.AddInParameter(cmd, "IdTipoPersona_tt", DbType.String, BE.IdTipoPersona_tt); db.AddInParameter(cmd, "cGlobal_TipoRiesgo", DbType.Int32, BE.cGlobal_TipoRiesgo); db.AddInParameter(cmd, "cGlobal_TipoEmpresa", DbType.Int32, BE.cGlobal_TipoEmpresa); db.AddInParameter(cmd, "vContacto", DbType.String, BE.vContacto); db.AddInParameter(cmd, "vCargo", DbType.String, BE.vCargo); db.AddInParameter(cmd, "vTelefono1", DbType.String, BE.vTelefono1); db.AddInParameter(cmd, "vTelefono2", DbType.String, BE.vTelefono2); db.AddInParameter(cmd, "vTelefono3", DbType.String, BE.vTelefono3); db.AddInParameter(cmd, "vCorreo", DbType.String, BE.vCorreo); db.AddInParameter(cmd, "FlgPagadora", DbType.Int32, BE.FlgPagadora); db.AddInParameter(cmd, "UsuarioID", DbType.String, BE.UsuarioID); dsResult = db.ExecuteDataSet(cmd); } catch (Exception ex) { throw new Exception(ex.Message); } return(dsResult); }
private void btnEliminar_Click(object sender, EventArgs e) { DialogResult dialogResult = 0; try { if (dgvCarteraCantidato.RowCount > 0) { dialogResult = MessageBox.Show("Seguro de eliminar al candidato: " + dgvCarteraCantidato.CurrentRow.Cells["vApePaterno"].Value.ToString().Trim(), "Confirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { CarteraCandidatoBE CarteraCandidatoBE = new CarteraCandidatoBE() { OPCION = 3, USUARIO = General.General.GetUsuario, IdCartera = dgvCarteraCantidato.CurrentRow.Cells["IdCartera"].Value.ToString(), }; new CarteraCandidatoBL().ProcesarCarteraCandidato(CarteraCandidatoBE); MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); btnBuscar.PerformClick(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CargarDatos() { try { DataSet dsCartera = new DataSet(); CarteraCandidatoBE CarteraCandidatoBE = new CarteraCandidatoBE() { OPCION = 1, USUARIO = General.General.GetCodigoUsuario, IdCartera = txtIdCartera.Text, }; dsCartera = new CarteraCandidatoBL().ProcesarCarteraCandidato(CarteraCandidatoBE); if (dsCartera.Tables[0].Rows.Count > 0) { txtdtRegistro.Text = dsCartera.Tables[0].Rows[0]["strdtRegistro"].ToString(); txtvApePaterno.Text = dsCartera.Tables[0].Rows[0]["vApePaterno"].ToString(); txtvApeMaterno.Text = dsCartera.Tables[0].Rows[0]["vApeMaterno"].ToString(); txtvNombre.Text = dsCartera.Tables[0].Rows[0]["vNombre"].ToString(); cboIdTipoDocumento_tt.SelectedValue = dsCartera.Tables[0].Rows[0]["IdTipoDocumento_tt"].ToString(); txtvNroDocumento.Text = dsCartera.Tables[0].Rows[0]["vNroDocumento"].ToString(); cboIdTipoPersona_tt.SelectedValue = dsCartera.Tables[0].Rows[0]["IdTipoPersona_tt"].ToString(); cbocGlobal_TipoEmpresa.SelectedValue = dsCartera.Tables[0].Rows[0]["cGlobal_TipoEmpresa"].ToString(); cbocGlobal_TipoRiesgo.SelectedValue = dsCartera.Tables[0].Rows[0]["cGlobal_TipoRiesgo"].ToString(); txtvContacto.Text = dsCartera.Tables[0].Rows[0]["vContacto"].ToString(); txtvCargo.Text = dsCartera.Tables[0].Rows[0]["vCargo"].ToString(); txtvTelefono1.Text = dsCartera.Tables[0].Rows[0]["vTelefono1"].ToString(); txtvTelefono2.Text = dsCartera.Tables[0].Rows[0]["vTelefono2"].ToString(); txtvTelefono3.Text = dsCartera.Tables[0].Rows[0]["vTelefono3"].ToString(); txtvCorreo.Text = dsCartera.Tables[0].Rows[0]["vCorreo"].ToString(); cboUsuarioID.SelectedValue = !string.IsNullOrEmpty(dsCartera.Tables[0].Rows[0]["UsuarioID"].ToString()) ? dsCartera.Tables[0].Rows[0]["UsuarioID"].ToString() : "--Seleccionar--"; } else { MessageBox.Show("Este candidato no existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnImportar_Click(object sender, EventArgs e) { string srutaArchivo = string.Empty; openFileDialog1.InitialDirectory = @"C:\"; openFileDialog1.Filter = "Archivos de Excel (*.xls) |*.xlsx"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; openFileDialog1.FileName = ""; LstCarteraCandidatoTmp = new BindingList <CarteraCandidatoBE>(); if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { srutaArchivo = openFileDialog1.FileName; try { msgHelper.Wait("Cargando registros, espere un momento ..."); cnExcel = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + srutaArchivo + ";Extended Properties='Excel 12.0 Xml;HDR=YES';"); if (cnExcel.State == ConnectionState.Closed) { cnExcel.Open(); } if (!System.IO.File.Exists(srutaArchivo)) { MessageBox.Show("No se encontró el Libro: " + srutaArchivo, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } OleDbDataAdapter daExcel = new OleDbDataAdapter("Select * " + "From [Candidatos$A1:T20000] ", cnExcel); DataTable dtTable = new DataTable(); daExcel.Fill(dtTable); int CountNuevos = 0; int CountExistentes = 0; foreach (DataRow row in dtTable.Rows) { if (!string.IsNullOrEmpty(row["UsuarioID"].ToString().Trim())) { CarteraCandidatoBE oCarteraCandidatoBE = new CarteraCandidatoBE() { OPCION = 2, USUARIO = General.General.GetUsuario, cRucPagadora = row["RucPagadora"].ToString().Trim(), vApePaterno = row["ApePaterno"].ToString().Trim(), vApeMaterno = row["ApeMaterno"].ToString().Trim(), vNombre = row["Nombre"].ToString().Trim(), IdTipoDocumento_tt = row["IdTipoDocumento_tt"].ToString().Trim(), IdTipoDocumento_tt_Dsc = row["Documento"].ToString().Trim(), vNroDocumento = row["NroDocumento"].ToString().Trim(), IdTipoPersona_tt = row["IdTipoPersona_tt"].ToString().Trim(), cGlobal_TipoEmpresa = string.IsNullOrEmpty(row["TipoProveedor"].ToString().Trim()) ? 0 : int.Parse(row["cGlobal_TipoEmpresa"].ToString()), cGlobal_TipoRiesgo = string.IsNullOrEmpty(row["CalificacionExterna"].ToString().Trim()) ? 0 : int.Parse(row["cGlobal_TipoRiesgo"].ToString()), IdTipoPersona_tt_Dsc = row["TipoPersona"].ToString().Trim(), vContacto = row["Contacto"].ToString().Trim(), vCargo = row["Cargo"].ToString().Trim(), vTelefono1 = row["Telefono1"].ToString().Trim(), vTelefono2 = row["Telefono2"].ToString().Trim(), vTelefono3 = row["Telefono3"].ToString().Trim(), vCorreo = row["Correo"].ToString().Trim(), FlgPagadora = _FlgPagadora, UsuarioID = row["UsuarioID"].ToString().Trim(), }; DataSet ds = new CarteraCandidatoBL().ProcesarCarteraCandidato(oCarteraCandidatoBE); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Status"].ToString().Equals("E")) { CountExistentes = CountExistentes + 1; LstCarteraCandidatoExitsTmp.Add(oCarteraCandidatoBE); } else { CountNuevos = CountNuevos + 1; LstCarteraCandidatoTmp.Add(oCarteraCandidatoBE); } } } else { break; } } lblProspectosNuevos.Text = "Prospectos que subieron correctamente " + CountNuevos.ToString(); lblExistentes.Text = "Prospectos que ya existen en la cartera " + CountExistentes.ToString(); dgvCandidatosExistentes.DataSource = LstCarteraCandidatoExitsTmp; dgvCargaCandidato.DataSource = LstCarteraCandidatoTmp; cnExcel.Close(); btnImportar.Enabled = false; msgHelper.Wait(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cnExcel.Close(); msgHelper.Wait(); } } }
private void btnAceptar_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtvApePaterno.Text.Trim())) { MessageBox.Show("Ingresar un apellido paterno", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtvApePaterno.Focus(); return; } if (string.IsNullOrEmpty(cboIdTipoDocumento_tt.SelectedValue.ToString())) { MessageBox.Show("Se debe seleccionar un tipo de documento", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); cboIdTipoDocumento_tt.Focus(); return; } if (string.IsNullOrEmpty(txtvNroDocumento.Text.Trim())) { MessageBox.Show("Ingresar un número de documento", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtvNroDocumento.Focus(); return; } if (cboUsuarioID.SelectedValue.ToString().Equals("--Seleccionar--")) { MessageBox.Show("Seleccione un usuario.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtvContacto.Focus(); return; } //if (string.IsNullOrEmpty(txtvTelefono1.Text.Trim())) //{ // MessageBox.Show("Ingresar un número de teléfono", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // txtvTelefono1.Focus(); // return; //} CarteraCandidatoBE CarteraCandidatoBE = new CarteraCandidatoBE() { USUARIO = General.General.GetCodigoUsuario, OPCION = 2, IdCartera = txtIdCartera.Text, vApePaterno = txtvApePaterno.Text, vApeMaterno = txtvApeMaterno.Text, vNombre = txtvNombre.Text, IdTipoDocumento_tt = cboIdTipoDocumento_tt.SelectedValue.ToString(), vNroDocumento = txtvNroDocumento.Text, IdTipoPersona_tt = cboIdTipoPersona_tt.SelectedValue.ToString(), cGlobal_TipoEmpresa = int.Parse(cbocGlobal_TipoEmpresa.SelectedValue.ToString()), cGlobal_TipoRiesgo = int.Parse(cbocGlobal_TipoRiesgo.SelectedValue.ToString()), vContacto = txtvContacto.Text, vCargo = txtvCargo.Text, vTelefono1 = txtvTelefono1.Text, vTelefono2 = txtvTelefono2.Text, vTelefono3 = txtvTelefono3.Text, vCorreo = txtvCorreo.Text, FlgPagadora = _FlgPagadora, UsuarioID = cboUsuarioID.SelectedValue.ToString(), }; new CarteraCandidatoBL().ProcesarCarteraCandidato(CarteraCandidatoBE); MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DataSet ProcesarCarteraCandidato(CarteraCandidatoBE BE) { return(CarteraCandidatoDA.ProcesarCarteraCandidato(BE)); }