public Result GetRelacionEmpleadoJefe(out List <EmpleadoJefe> lstEmpleadoJefe)
        {
            lstEmpleadoJefe  = null;
            _SpProcedureName = "dbo.Sp_GetRelacionJefeEmpleado";
            Result resultado = new Result();

            try
            {
                List <SqlParameter> parametros = new List <SqlParameter>()
                {
                };
                SqlDataReader reader = _dao.ExecuteReader(parametros, _SpProcedureName);
                if (reader.HasRows)
                {
                    lstEmpleadoJefe = new List <EmpleadoJefe>();
                    while (reader.Read())
                    {
                        EmpleadoJefe empleadoJefe = new EmpleadoJefe();
                        empleadoJefe.EmployeeId     = reader["EmployeeId"] == DBNull.Value ? null : (int?)reader["EmployeeId"];
                        empleadoJefe.NombreEmpleado = reader["Nombre"].ToString();
                        empleadoJefe.ParentID       = reader["ParentID"] == DBNull.Value ? null : (int?)reader["ParentID"];
                        empleadoJefe.Level          = (int)reader["Lvl"];
                        lstEmpleadoJefe.Add(empleadoJefe);
                    }
                }
                reader.Close();
                resultado.Success = true;
            }
            catch (Exception e)
            {
                resultado.Success      = false;
                resultado.ErrorMessage = String.Format("Se ha producido un error al procesar datos de archivo Error {0}", e.Message);
            }

            return(resultado);
        }
        public Result GetCatalogo(out List <Catalogo> lstCatalogo)
        {
            _SpProcedureName = "[dbo].[Sp_GetOneCatalogo]";
            lstCatalogo      = new List <Catalogo>();
            Result resultado = new Result();

            try
            {
                List <SqlParameter> parametros = new List <SqlParameter> {
                    new SqlParameter("@Origen", Convert.ToInt32(_enumCatalogo))
                };

                SqlDataReader reader = _dao.ExecuteReader(parametros, _SpProcedureName);
                if (reader.HasRows)
                {
                    lstCatalogo = new List <Catalogo>();
                    while (reader.Read())
                    {
                        Catalogo catalogo = new Catalogo();
                        catalogo.ID          = (int)reader["ID"];
                        catalogo.DESCRIPTION = reader["DESCRIPTION"].ToString();
                        catalogo.ORIGEN      = reader["ORIGEN"].ToString();
                        lstCatalogo.Add(catalogo);
                    }
                }
                reader.Close();
                resultado.Success = true;
            }
            catch (Exception e)
            {
                resultado.Success      = false;
                resultado.ErrorMessage = String.Format("Se ha producido un error al procesar datos del catálogo {0}", e.Message);
            }

            return(resultado);
        }
        //public EmployeeRepository(string SpProcedureName)
        //{
        //    _dao = new DAO();
        //    _SpProcedureName = SpProcedureName;
        //}


        public Result GetAllEmployess(out List <Employee> lstEmployees, string nombre, int?PositionId, int?AreaId, DateTime?fecha_incial, DateTime?fecha_final, int?BossId, bool activo, int?EmployeeId, int?OperacionId, enumRoles Rol, int EmployeeIdConected, bool FingerPrint)
        {
            lstEmployees     = null;
            _SpProcedureName = "[dbo].[Sp_GetEmployeesByFilter]";
            Result resultado = new Result();

            try
            {
                List <SqlParameter> parametros = new List <SqlParameter> {
                    new SqlParameter("@Nombre", nombre)
                    , new SqlParameter("@PosicionId", PositionId == 0 ? null:PositionId)
                    , new SqlParameter("@AreaId", AreaId == 0 ?null:AreaId)
                    , new SqlParameter("@FechaInicial", fecha_incial)
                    , new SqlParameter("@FechaFinal", fecha_final)
                    , new SqlParameter("@BossId", BossId == 0?null :BossId)
                    , new SqlParameter("@Activo", activo)
                    , new SqlParameter("@EmployeeId", EmployeeId)
                    , new SqlParameter("@OperacionId", OperacionId == 0?null:OperacionId)
                    , new SqlParameter("@FingerPrint", FingerPrint)
                    //,new SqlParameter("@Rol", Convert.ToInt32(Rol))
                    //,new SqlParameter("@EmployeeIdConected", EmployeeIdConected)
                    //,new SqlParameter("@Rol", null)
                    //,new SqlParameter("@EmployeeIdConected", null)
                };
                SqlDataReader reader = _dao.ExecuteReader(parametros, _SpProcedureName);
                if (reader.HasRows)
                {
                    lstEmployees = new List <Employee>();
                    while (reader.Read())
                    {
                        Employee employee = new Employee();
                        employee.EmployeeId = reader["EmployeeId"].ToString();
                        //employee.CardId = reader["CardId"].ToString();
                        employee.CardNumber = reader["CardNumber"].ToString();
                        employee.FirstName  = reader["FirstName"].ToString();
                        employee.LastName   = reader["LastName"].ToString();
                        employee.MiddleName = reader["MiddleName"].ToString();
                        employee.FullName   = reader["FullName"].ToString();
                        //employee.Photo = reader["Photo"].ToString();
                        employee.Rfc                = reader["Rfc"].ToString();
                        employee.Curp               = reader["Curp"].ToString();
                        employee.NSS                = reader["NSS"].ToString();
                        employee.BirthDay           = reader["BirthDay"] == DBNull.Value?null: (DateTime?)reader["BirthDay"];
                        employee.AdmissionDate      = reader["AdmissionDate"] == DBNull.Value ? null : (DateTime?)reader["AdmissionDate"];
                        employee.StreetName         = reader["StreetName"].ToString();
                        employee.NumberExt          = reader["NumberExt"].ToString();
                        employee.NumberInt          = reader["NumberInt"].ToString();
                        employee.Delegation         = reader["Delegation"].ToString();
                        employee.Colony             = reader["Colony"].ToString();
                        employee.CP                 = reader["CP"].ToString();
                        employee.PhoneNumber        = reader["PhoneNumber"].ToString();
                        employee.CellPhoneNumber    = reader["CellPhoneNumber"].ToString();
                        employee.OfficePhone        = reader["OfficePhone"].ToString();
                        employee.OfficeExt          = reader["OfficeExt"].ToString();
                        employee.PersonalEmail      = reader["PersonalEmail"].ToString();
                        employee.CompanyEmail       = reader["CompanyEmail"].ToString();
                        employee.Enabled            = (bool)reader["Enabled"];
                        employee.LocalizationId     = reader["LocalizationId"] == DBNull.Value ?null:  (int?)reader["LocalizationId"];
                        employee.PayRollId          = reader["PayRollId"] == DBNull.Value ? null : (int?)reader["PayRollId"];
                        employee.CompanyId          = reader["CompanyId"] == DBNull.Value ? null : (int?)reader["CompanyId"];
                        employee.NationalityId      = reader["NationalityId"] == DBNull.Value ? null : (int?)reader["NationalityId"];
                        employee.EmployeePositionId = reader["EmployeePositionId"] == DBNull.Value ? null : (int?)reader["EmployeePositionId"];
                        employee.BossId             = reader["BossId"] == DBNull.Value ? null : (int?)reader["BossId"];
                        employee.BossName           = reader["BossName"].ToString();
                        employee.AreaName           = reader["AreaName"].ToString();
                        employee.PositionName       = reader["PositionName"].ToString();
                        employee.FingerPrint        = reader["FingerPrint"] == DBNull.Value?false : Convert.ToBoolean(reader["FingerPrint"])? true:false;
                        employee.ParkingSpace       = reader["ParkingSpace"].ToString();
                        employee.CardId             = reader["CardId"].ToString();

                        lstEmployees.Add(employee);
                    }
                }
                reader.Close();
                resultado.Success = true;
            }
            catch (Exception e)
            {
                resultado.Success      = false;
                resultado.ErrorMessage = String.Format("Se ha producido un error al procesar datos de archivo Error {0}", e.Message);
            }

            return(resultado);
        }
Exemplo n.º 4
0
        public Result GetAllEmployessValidador(out List <EmployeeValidador> lstEmployees, string nombre, string no_empleado, string Rfc, string Nss)
        {
            lstEmployees     = null;
            _SpProcedureName = "[dbo].[Sp_GetEmployeesValidadorByFilter]";
            Result resultado = new Result();

            try
            {
                List <SqlParameter> parametros = new List <SqlParameter> {
                    new SqlParameter("@Nombre", string.IsNullOrEmpty(nombre) ?null:nombre)
                    , new SqlParameter("@NoEmpleado", string.IsNullOrEmpty(no_empleado) ?null:no_empleado)
                    , new SqlParameter("@Rfc", string.IsNullOrEmpty(Rfc) ?null:Rfc)
                    , new SqlParameter("@Nss", string.IsNullOrEmpty(Nss) ?null:Nss)
                };
                SqlDataReader reader = _dao.ExecuteReader(parametros, _SpProcedureName);
                if (reader.HasRows)
                {
                    lstEmployees = new List <EmployeeValidador>();
                    while (reader.Read())
                    {
                        EmployeeValidador employee = new EmployeeValidador();
                        employee.EmployeeId = reader["PK_TEMP"].ToString();
                        //employee.CardId = reader["CardId"].ToString();
                        employee.CardNumber = reader["NO_EMPLEADO"].ToString();
                        employee.FirstName  = reader["NOMBRE"].ToString();
                        employee.LastName   = reader["PATERNO"].ToString();
                        employee.MiddleName = reader["MATERNO"].ToString();
                        employee.FullName   = reader["FULLNAME"].ToString();
                        employee.Rfc        = reader["Rfc"].ToString();
                        employee.Curp       = reader["Curp"].ToString();
                        employee.NSS        = reader["NSS"].ToString();
                        employee.BirthDay   = reader["F_NACIMIENTO"] == DBNull.Value ? null : (DateTime?)reader["F_NACIMIENTO"];
                        //employee.AdmissionDate = reader["F_INGRESO"] == DBNull.Value ? null : (DateTime?)reader["F_INGRESO"];
                        //employee.EntryDate = reader["F_ANTIGUEDAD"] == DBNull.Value ? null : (DateTime?)reader["F_ANTIGUEDAD"];
                        //employee.LeavingDate = reader["F_BAJA"] == DBNull.Value ? null : (DateTime?)reader["F_BAJA"];
                        employee.StreetName      = reader["CALLE"].ToString();
                        employee.NumberExt       = reader["NUM EXT"].ToString();
                        employee.NumberInt       = reader["NO_INT"].ToString();
                        employee.Delegation      = reader["DELEGACION"].ToString();
                        employee.Colony          = reader["COLONIA"].ToString();
                        employee.CP              = reader["CP"].ToString();
                        employee.PhoneNumber     = reader["TEL_CASA"].ToString();
                        employee.CellPhoneNumber = reader["CELULAR"].ToString();
                        //employee.OfficePhone = reader["OfficePhone"].ToString();
                        //employee.OfficeExt = reader["OfficeExt"].ToString();
                        employee.PersonalEmail = reader["EMAIL"].ToString();
                        //employee.CompanyEmail = reader["CompanyEmail"].ToString();
                        //employee.Enabled = (bool)reader["Enabled"];
                        //employee.LocalizationId = reader["LocalizationId"] == DBNull.Value ? null : (int?)reader["LocalizationId"];
                        //employee.PayRollId = reader["PayRollId"] == DBNull.Value ? null : (int?)reader["PayRollId"];
                        //employee.CompanyId = reader["CompanyId"] == DBNull.Value ? null : (int?)reader["CompanyId"];
                        //employee.NationalityId = reader["NationalityId"] == DBNull.Value ? null : (int?)reader["NationalityId"];
                        //employee.EmployeePositionId = reader["EmployeePositionId"] == DBNull.Value ? null : (int?)reader["EmployeePositionId"];
                        //employee.BossId = reader["BossId"] == DBNull.Value ? null : (int?)reader["BossId"];
                        //employee.BossName = reader["BossName"].ToString();
                        //employee.AreaName = reader["AreaName"].ToString();
                        //employee.PositionName = reader["PUESTO"].ToString();
                        //employee.FingerPrint = reader["FingerPrint"] == DBNull.Value ? false : Convert.ToBoolean(reader["FingerPrint"]) ? true : false;
                        //employee.ParkingSpace = reader["ParkingSpace"].ToString();
                        //employee.CardId = reader["CardId"].ToString();
                        //employee.Compania = reader["COMPANIA"].ToString();
                        employee.Banco            = reader["BANCO"].ToString();
                        employee.Clabe            = reader["CLABE"].ToString();
                        employee.CreditoInfonavit = reader["CREDITO_INFONAVIT"].ToString();
                        employee.LugarNacimiento  = reader["LUGAR_NAC"].ToString();
                        employee.EdoCivil         = reader["EDO_CIVIL"].ToString();
                        employee.EstadoEmpleado   = reader["ESTADO"].ToString();
                        employee.LstDocumentos    = new List <Documentacion>()
                        {
                            new Documentacion()
                            {
                                TipoDocto = "Acta Nacimiento", NombreDocto = "ACTA_NACIMIENTO.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Curp", NombreDocto = "CURP.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Comprobante Domicilio", NombreDocto = "DOMICILIO.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Identificación", NombreDocto = "DOMICILIO.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Comprobante Domicilio", NombreDocto = "DOMICILIO.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Imss", NombreDocto = "DOMICILIO.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Rfc", NombreDocto = "DOMICILIO.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Carta de Recomendación", NombreDocto = "DOMICILIO.pdf"
                            }
                            , new Documentacion()
                            {
                                TipoDocto = "Estado de cuenta", NombreDocto = "DOMICILIO.pdf"
                            }
                        };

                        employee.Sexo                 = reader["SEXO"].ToString();
                        employee.TRAMITE_INF_SN       = reader["TRAMITE_INF_SN"].ToString();
                        employee.Etapa                = reader["ETAPA"].ToString();
                        employee.Estudios             = reader["ESTUDIOS"].ToString();
                        employee.Nivel_Estudios       = reader["NIVEL ESTUDIOS"].ToString();
                        employee.Universidad          = reader["UNIVERSIDAD"].ToString();
                        employee.Id_Jefe              = reader["ID JEFE"].ToString();
                        employee.Nombre_jefe          = reader["NOMBRE JEFE"].ToString();
                        employee.Ultimo_GradoEstudios = reader["ULT_GRADO_ESTUDIOS"].ToString();
                        employee.Estatus              = reader["ESTATUS"] == DBNull.Value ? false : Convert.ToBoolean(reader["ESTATUS"]);


                        lstEmployees.Add(employee);
                    }
                }
                reader.Close();
                resultado.Success = true;
            }
            catch (Exception e)
            {
                resultado.Success      = false;
                resultado.ErrorMessage = String.Format("Se ha producido un error al procesar datos de archivo Error {0}", e.Message);
            }

            return(resultado);
        }