Ejemplo n.º 1
0
        public List <listarAreaCargoxPersonaVM> listarAreaCargoxPersona(string codPersona)
        {
            List <listarAreaCargoxPersonaVM> lista = new List <listarAreaCargoxPersonaVM>();
            Database  db  = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings["conecion"].ToString());
            DbCommand cmd = db.GetStoredProcCommand("RRHH_SP_LISTAR_AREA_CARGO_X_PERSONA");

            db.AddInParameter(cmd, "C_COD_PERSONA", DbType.String, codPersona);
            using (IDataReader lee = db.ExecuteReader(cmd))
            {
                while (lee.Read())
                {
                    listarAreaCargoxPersonaVM entity = new listarAreaCargoxPersonaVM();
                    entity.clsPeopleCharge.I_COD_PERSONA_CARGO = Convert.ToInt32(lee["I_COD_PERSONA_CARGO"].ToString());
                    entity.clsInstancia.V_DES_INSTANCIA        = lee["V_DES_INSTANCIA"].ToString();
                    entity.clsArea.V_ABREV_FUNCIONES           = lee["V_ABREV_FUNCIONES"].ToString();
                    entity.clsCargo.V_DES_CARGO           = lee["V_DES_CARGO"].ToString();
                    entity.clsPeopleCharge.D_FEC_REGISTRO = lee["D_FEC_REGISTRO"].ToString();
                    entity.clsPeopleCharge.D_FEC_INGRESO  = lee["D_FEC_INGRESO"].ToString() == "" ? null : (DateTime?)Convert.ToDateTime(lee["D_FEC_INGRESO"].ToString());
                    entity.clsPeopleCharge.D_FEC_BAJA     = lee["D_FEC_BAJA"].ToString() == "" ? DateTime.MinValue : Convert.ToDateTime(lee["D_FEC_BAJA"].ToString());
                    entity.clsPeopleCharge.C_ACTIVO       = lee["C_ACTIVO"].ToString();
                    lista.Add(entity);
                }
            }

            return(lista);
        }
Ejemplo n.º 2
0
        public listarAreaCargoxPersonaVM detailsChargeForPeople(int codPeopleCharge)
        {
            listarAreaCargoxPersonaVM entity = new listarAreaCargoxPersonaVM();
            Database  db  = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings["conecion"]);
            DbCommand cmd = db.GetStoredProcCommand("RRHH_SP_DETALLE_AREA_CARGO_X_PERSONA", codPeopleCharge);

            using (IDataReader lee = db.ExecuteReader(cmd))
            {
                lee.Read();
                entity.clsPeopleCharge.I_COD_PERSONA_CARGO = Convert.ToInt32(lee["I_COD_PERSONA_CARGO"].ToString());
                entity.clsInstancia.I_COD_INSTANCIA        = lee["I_COD_INSTANCIA"].ToString();
                entity.clsInstancia.V_DES_INSTANCIA        = lee["V_DES_INSTANCIA"].ToString();
                //entity.clsInstancia.V_GEO_LOCALIZACION = DbGeography.FromText(lee["V_GEO_LOCALIZACION"].ToString());
                entity.clsInstancia.V_GEO_LOCALIZACION = lee["V_GEO_LOCALIZACION"].ToString();
                entity.clsArea.C_COD_AREA                    = lee["C_COD_AREA"].ToString();
                entity.clsArea.V_DES_FUNCIONES               = lee["V_DES_FUNCIONES"].ToString();
                entity.clsArea.V_ABREV_FUNCIONES             = lee["V_ABREV_FUNCIONES"].ToString();
                entity.clsCargo.I_COD_CARGO                  = Convert.ToInt32(lee["I_COD_CARGO"].ToString());
                entity.clsCargo.V_DES_CARGO                  = lee["V_DES_CARGO"].ToString();
                entity.clsPeopleCharge.D_FEC_REGISTRO        = lee["D_FEC_REGISTRO"].ToString();
                entity.clsPeopleCharge.D_FEC_INGRESO         = lee["D_FEC_INGRESO"].ToString() == "" ? null : (DateTime?)Convert.ToDateTime(lee["D_FEC_INGRESO"].ToString());
                entity.clsPeopleCharge.V_OBSERVACION_INGRESO = lee["V_OBSERVACION_INGRESO"].ToString();
                entity.clsPeopleCharge.V_OBSERVACION_ANULADO = lee["V_OBSERVACION_ANULADO"].ToString();
                entity.clsPeopleCharge.D_FEC_BAJA            = lee["D_FEC_BAJA"].ToString() == "" ? DateTime.MinValue : Convert.ToDateTime(lee["D_FEC_BAJA"].ToString());
                entity.clsPeopleCharge.C_ACTIVO              = lee["C_ACTIVO"].ToString();
            }
            return(entity);
        }