示例#1
0
        public BE.Cargo Obtener(int idCargo)
        {
            BE.Cargo beCargo = null;
            try
            {
                string sp = "SpTbCargoObtener";

                using (SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal))
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand(sp, cnn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@IDCARGO", idCargo));

                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        beCargo = new BE.Cargo();

                        beCargo.IdCargo     = int.Parse(reader["IdCargo"].ToString());
                        beCargo.Nombre      = reader["Nombre"].ToString();
                        beCargo.Descripcion = reader["Descripcion"].ToString();
                        beCargo.Activo      = bool.Parse(reader["Activo"].ToString());
                        beCargo.Bono        = double.Parse(reader["Bono"].ToString());
                    }
                }

                return(beCargo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public bool Actualizar(BE.Cargo beCargo)
        {
            try
            {
                string sp           = "SpTbCargoActualizar";
                int    rowsAffected = 0;

                using (SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal))
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand(sp, cnn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add(new SqlParameter("@IDCARGO", beCargo.IdCargo));
                    cmd.Parameters.Add(new SqlParameter("@NOMBRE", beCargo.Nombre));
                    cmd.Parameters.Add(new SqlParameter("@DESCRIPCION", beCargo.Descripcion));
                    cmd.Parameters.Add(new SqlParameter("@ACTIVO", beCargo.Activo));
                    cmd.Parameters.Add(new SqlParameter("@BONO", beCargo.Bono));

                    rowsAffected = cmd.ExecuteNonQuery();
                }

                return(rowsAffected > 0 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public List <BE.Cargo> Listar()
        {
            var lstBeCargos = new List <BE.Cargo>();

            try
            {
                string sp = "SpTbCargoListar";

                using (SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal))
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand(sp, cnn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        var beCargo = new BE.Cargo();

                        beCargo.IdCargo     = int.Parse(reader["IdCargo"].ToString());
                        beCargo.Nombre      = reader["Nombre"].ToString();
                        beCargo.Descripcion = reader["Descripcion"].ToString();
                        beCargo.Activo      = bool.Parse(reader["Activo"].ToString());
                        beCargo.Bono        = double.Parse(reader["Bono"].ToString());

                        lstBeCargos.Add(beCargo);
                    }
                }

                return(lstBeCargos);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.ValidacionesFormulario();

                #region General

                var sexo           = (BE.Record) this.CbxSexo.SelectedItem;
                var tipodocumento  = (BE.Record) this.CbxTipoDocumento.SelectedItem;
                var estadocivil    = (BE.Record) this.CbxEstadoCivil.SelectedItem;
                var paisnacimiento = (BE.Pais) this.CbxPaisNacimiento.SelectedItem;

                if (paisnacimiento.Codigo == "PER")
                {
                    int codDepartamentoNacimiento = int.Parse(((BE.Record) this.CbxDepartamentoNacimiento.SelectedItem).Codigo);
                    int codProvinciaNacimiento    = int.Parse(((BE.Record) this.CbxProvinciaNacimiento.SelectedItem).Codigo);
                    int codDistritoNacimiento     = 0;
                    var oBeTbUbigeoNacimiento     = new BE.Ubigeo()
                    {
                        Departamento = codDepartamentoNacimiento,
                        Provincia    = codProvinciaNacimiento,
                        Distrito     = codDistritoNacimiento
                    };
                    new LN.Ubigeo().Obtener(ref oBeTbUbigeoNacimiento);
                    this.beCandidatoGeneral.UbigeoNacimiento = oBeTbUbigeoNacimiento;
                }
                else
                {
                    this.beCandidatoGeneral.UbigeoNacimiento = new BE.Ubigeo()
                    {
                        Codigo = ""
                    };
                }

                this.beCandidatoGeneral.Codigo          = this.TxtCodigo.Text;
                this.beCandidatoGeneral.Nombres         = this.TxtNombres.Text;
                this.beCandidatoGeneral.ApellidoPaterno = this.TxtApellidoPaterno.Text;
                this.beCandidatoGeneral.ApellidoMaterno = this.TxtApellidoMaterno.Text;
                this.beCandidatoGeneral.FechaNacimiento = this.DtpFechaNacimiento.Value;
                this.beCandidatoGeneral.Sexo            = sexo;
                this.beCandidatoGeneral.TipoDocumento   = tipodocumento;
                this.beCandidatoGeneral.NumeroDocumento = this.TxtNumeroDocumento.Text;
                this.beCandidatoGeneral.PaisNacimiento  = paisnacimiento;
                this.beCandidatoGeneral.EstadoCivil     = estadocivil;
                this.beCandidatoGeneral.Activo          = this.CbxActivo.Checked;

                #endregion

                #region Contacto
                if (this.beCandidatoGeneral.Contacto == null)
                {
                    this.beCandidatoGeneral.Contacto = new BE.ClsBeTbCandidatoContacto();
                }

                int codDepartamento = int.Parse(((BE.Record) this.CbxDepartamento.SelectedItem).Codigo);
                int codProvincia    = int.Parse(((BE.Record) this.CbxProvincia.SelectedItem).Codigo);
                int codDistrito     = int.Parse(((BE.Record) this.CbxDistrito.SelectedItem).Codigo);
                var oBeTbUbigeo     = new BE.Ubigeo()
                {
                    Departamento = codDepartamento,
                    Provincia    = codProvincia,
                    Distrito     = codDistrito
                };
                new LN.Ubigeo().Obtener(ref oBeTbUbigeo);
                this.beCandidatoGeneral.Contacto.Ubigeo = oBeTbUbigeo;

                this.beCandidatoGeneral.Contacto.Zona       = this.TxtZona.Text;
                this.beCandidatoGeneral.Contacto.Direccion  = this.TxtDireccion.Text;
                this.beCandidatoGeneral.Contacto.Referencia = this.TxtReferencia.Text;
                this.beCandidatoGeneral.Contacto.Email      = this.TxtEmail.Text;

                //Telefonos
                if (this.beCandidatoGeneral.Telefonos.Count == 1)
                {
                    this.beCandidatoGeneral.Telefonos[0].CodTipoTelefono = this.CbxTelefono.SelectedValue.ToString();
                    this.beCandidatoGeneral.Telefonos[0].Numero          = this.TxtTelefono.Text;
                }
                else
                {
                    this.beCandidatoGeneral.Telefonos.Add(new BE.ClsBeTbCandidatoTelefono()
                    {
                        CodTipoTelefono = this.CbxTelefono.SelectedValue.ToString(),
                        Numero          = this.TxtTelefono.Text,
                        IdCandidato     = beCandidatoGeneral.IdCandidato
                    });
                }
                #endregion

                #region Contratacion
                if (this.beCandidatoGeneral.Contratacion == null)
                {
                    this.beCandidatoGeneral.Contratacion = new BE.ClsBeTbCandidatoContratacion()
                    {
                        IdCandidato = beCandidatoGeneral.IdCandidato
                    }
                }
                ;

                this.beCandidatoGeneral.Contratacion.InduccionFechaInicio = this.DtpInicioInduccion.Value;
                if (this.CbxConcluyoInduccion.Checked)
                {
                    this.beCandidatoGeneral.Contratacion.InduccionFechaFin = this.DtpFinInduccion.Value;
                }
                else
                {
                    this.beCandidatoGeneral.Contratacion.InduccionFechaFin = null;
                }
                this.beCandidatoGeneral.Contratacion.Induccion     = this.CbxAproboInduccion.Checked;
                this.beCandidatoGeneral.Contratacion.Disciplina    = this.CbxAproboDisciplinario.Checked;
                this.beCandidatoGeneral.Contratacion.Informe       = this.CbxAproboAdministrativo.Checked;
                this.beCandidatoGeneral.Contratacion.Documentacion = this.CbxAproboDocumentos.Checked;
                this.beCandidatoGeneral.Contratacion.Observacion   = this.TxtObservacion.Text;

                double sueldo = 0.0;
                if (double.TryParse(this.txtSueldo.Text, out sueldo) == false)
                {
                    sueldo = 0.0;
                }
                this.beCandidatoGeneral.Contratacion.Sueldo = sueldo;

                if (this.cboCargo.SelectedIndex > 0)
                {
                    var uiCargo = (BE.UI.Cargo) this.cboCargo.SelectedItem;

                    var beCargo = new BE.Cargo();
                    beCargo.IdCargo     = uiCargo.Id;
                    beCargo.Nombre      = uiCargo.Nombre;
                    beCargo.Descripcion = uiCargo.Descripcion;
                    beCargo.Activo      = uiCargo.Activo;
                    beCargo.Bono        = uiCargo.Bono;
                    uiCargo             = null;

                    this.beCandidatoGeneral.Contratacion.Cargo = beCargo;
                }

                #endregion

                int idUsuarioSesion = ((MdiMain)this.MdiParent).uiUsuario.ID;

                bool rpta = false;

                var lnCanditato = new LN.Candidato();
                if (beCandidatoGeneral.IdCandidato == 0)
                {
                    beCandidatoGeneral.IdUsuarioCreador = idUsuarioSesion;
                    rpta = lnCanditato.Insertar(ref beCandidatoGeneral);

                    if (rpta)
                    {
                        if (this.contratarPostulante == true)
                        {
                            rpta = new LN.Postulante().Contratar(beCandidatoGeneral.IdPostulante);
                        }
                    }
                }
                else
                {
                    beCandidatoGeneral.IdUsuarioModificador = idUsuarioSesion;
                    rpta = lnCanditato.Actualizar(beCandidatoGeneral);
                }

                if (rpta)
                {
                    Util.InformationMessage("Se guardo los datos del candidato");
                    this.frmList.CargarCandidatos();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }
示例#5
0
 public ClsBeTbPlantillaHorario()
 {
     Sala  = new Sala();
     Cargo = new Cargo();
 }