コード例 #1
0
    public static Models.Recursos establecerUsuarioIAP(string sUsuario)
    {
        DBConn DBConn = new DBConn();

        IB.sqldblib.SqlServerSP cDblib = DBConn.dblibclass;

        BLL.Recursos     oRecursos     = new BLL.Recursos(cDblib);
        BLL.FestivosCals oFestivosCals = new BLL.FestivosCals(cDblib);
        Models.Recursos  oRecursoModel = new Models.Recursos();

        try
        {
            Models.Recursos cProfesionalIap = new Models.Recursos();
            oRecursoModel           = oRecursos.establecerUsuarioIAP("", int.Parse(sUsuario));
            oRecursoModel.aFestivos = oFestivosCals.CatalogoFestivosString(oRecursoModel.IdCalendario, Fechas.AnnomesAFecha((int)oRecursoModel.t303_ultcierreIAP).AddMonths(1).AddDays(-1));

            HttpContext.Current.Session["NUM_EMPLEADO_IAP"]   = oRecursoModel.t314_idusuario;
            HttpContext.Current.Session["DES_EMPLEADO_IAP"]   = oRecursoModel.NOMBRE + " " + oRecursoModel.APELLIDO1 + " " + oRecursoModel.APELLIDO2;
            HttpContext.Current.Session["IDFICEPI_IAP"]       = oRecursoModel.t001_IDFICEPI;
            HttpContext.Current.Session["IDRED_IAP"]          = oRecursoModel.t001_codred;
            HttpContext.Current.Session["JORNADA_REDUCIDA"]   = oRecursoModel.t314_jornadareducida;
            HttpContext.Current.Session["CONTROLHUECOS"]      = oRecursoModel.t314_controlhuecos;
            HttpContext.Current.Session["IDCALENDARIO_IAP"]   = oRecursoModel.IdCalendario;
            HttpContext.Current.Session["DESCALENDARIO_IAP"]  = oRecursoModel.desCalendario;
            HttpContext.Current.Session["COD_CENTRO"]         = oRecursoModel.T009_IDCENTRAB;
            HttpContext.Current.Session["DES_CENTRO"]         = oRecursoModel.T009_DESCENTRAB;
            HttpContext.Current.Session["FEC_ULT_IMPUTACION"] = (!oRecursoModel.fUltImputacion.Equals(null)) ? ((DateTime)oRecursoModel.fUltImputacion).ToShortDateString() : null;
            HttpContext.Current.Session["FEC_ALTA"]           = oRecursoModel.t314_falta.ToShortDateString();
            HttpContext.Current.Session["FEC_BAJA"]           = (!Convert.IsDBNull(oRecursoModel.t314_fbaja)) ? ((DateTime)oRecursoModel.t314_fbaja).ToShortDateString() : null;
            HttpContext.Current.Session["UMC_IAP"]            = (!Convert.IsDBNull(oRecursoModel.t303_ultcierreIAP)) ? (int?)oRecursoModel.t303_ultcierreIAP : DateTime.Now.AddMonths(-1).Year * 100 + DateTime.Now.AddMonths(-1).Month;
            HttpContext.Current.Session["NHORASRED"]          = oRecursoModel.t314_horasjor_red;
            HttpContext.Current.Session["FECDESRED"]          = (!Convert.IsDBNull(oRecursoModel.t314_fdesde_red)) ? ((DateTime)oRecursoModel.t314_fdesde_red).ToShortDateString() : null;
            HttpContext.Current.Session["FECHASRED"]          = (!Convert.IsDBNull(oRecursoModel.t314_fhasta_red)) ? ((DateTime)oRecursoModel.t314_fhasta_red).ToShortDateString() : null;
            HttpContext.Current.Session["aSemLab"]            = oRecursoModel.t066_semlabL + "," + oRecursoModel.t066_semlabM + "," + oRecursoModel.t066_semlabX + "," + oRecursoModel.t066_semlabJ + "," + oRecursoModel.t066_semlabV + "," + oRecursoModel.t066_semlabS + "," + oRecursoModel.t066_semlabD;
            HttpContext.Current.Session["SEXOUSUARIO"]        = oRecursoModel.t001_sexo;
            HttpContext.Current.Session["TIPORECURSO"]        = oRecursoModel.tipo;

            return(oRecursoModel);
        }
        catch (Exception ex)
        {
            throw new Exception(System.Uri.EscapeDataString("Error al establecer el usuario." + ex.Message));
        }
        finally
        {
            oFestivosCals.Dispose();
            oRecursos.Dispose();
            DBConn.Dispose();
        }
    }