public static List <MPerson> fnListPerson(int?idPerson, int?PersonType, int?Department = null, bool?PersonStatus = null, int?IdUser = null)
        {
            List <MPerson>        ListPerson = new List <MPerson>();
            MMEnterprisesEntities db         = new MMEnterprisesEntities();

            MUser objUser = new MUser();

            ListPerson = (from result in db.GNListPerson(idPerson, PersonType, PersonStatus, Department, IdUser).ToList()
                          select new MPerson
            {
                IdPerson = result.IdPerson,
                IdPersonType = result.IdPersonType,
                PersonType = result.PersonType,
                IdIdentificationType = result.IdIdentificationType,
                IdentificationType = result.IdentificationType,
                NumIdentification = objUser.Desencriptar(result.NumIdentification),
                Name = result.Name,
                LastName = result.LastName,
                Birthday = result.Birthday,
                Address = objUser.Desencriptar(result.Address),
                Email = result.Email,
                IdContactType = result.IdContactType,
                ContactType = result.ContactType,
                IdPosition = result.IdPosition,
                Position = result.Position,
                ClientPermission = result.ClientPermission,
                Status = result.Status,
                StatusDesc = result.Status == true ? "Activo" : "Inactivo",
                IdDepartment = result.IdDepartment,
                Department = result.Department,
                listPersonContact = (List <MPersonContact>)(from result2 in db.GNListPersonContact(result.IdPerson, result.IdPersonType, null).ToList()
                                                            select new MPersonContact
                {
                    IdContact = result2.IdContact,
                    IdPerson = result2.IdPerson,
                    IdPhoneNumberType = result2.IdPhoneNumberType,
                    PhoneNumberType = result2.PhoneNumberType,
                    IdIsoCountry = result2.IdIsoCountry,
                    CountryAreaCode = result2.CountryAreaCode,
                    PhoneNumber = objUser.Desencriptar(result2.PhoneNumber),
                    Status = result2.Status
                }).ToList()
            }).ToList();



            return(ListPerson);
        }
        /// <summary>
        /// Filtrar por "IdUserOnBehalfOf" para la pantalla "ListConfigTkOnBehalfOf" , la tabla se llena con  IdConfig,IdUser,NumIdentification,Name,LastName.
        /// Filtrar por "IdUser" para la pantalla "AddTask" y para llenar el combobox usar IdUserOnBehalfOf,NumIdentificationOnBehalfOf,NameOnBehalfOf,LastNameOnBehalfOf.
        /// </summary>
        public static List <MConfigTkOnBehalfOf> fnListMConfigTkOnBehalfOf(int?IdUser = null, int?IdUserOnBehalfOf = null, int?IdConfig = null)
        {
            List <MConfigTkOnBehalfOf> ListConfigTkOnBehalfOf = new List <MConfigTkOnBehalfOf>();
            MMEnterprisesEntities      db = new MMEnterprisesEntities();

            MUser objUser = new MUser();

            ListConfigTkOnBehalfOf = (from result in db.GNListConfigTkOnBehalfOf(IdUser, IdUserOnBehalfOf, IdConfig).ToList()
                                      select new MConfigTkOnBehalfOf
            {
                IdConfig = result.IdConfig,
                IdUserOnBehalfOf = result.IdUserOnBehalfOf,
                NumIdentificationOnBehalfOf = objUser.Desencriptar(result.NumIdentificationOnBehalfOf),
                NameOnBehalfOf = result.NameOnBehalfOf,
                LastNameOnBehalfOf = result.LastNameOnBehalfOf,
                IdUser = result.IdUser,
                NumIdentification = objUser.Desencriptar(result.NumIdentification),
                Name = result.Name,
                LastName = result.LastName
            }).ToList();

            return(ListConfigTkOnBehalfOf);
        }
Beispiel #3
0
        /// <summary>
        /// Lista usuarios con informacion basica Sin accesos.
        /// Se puede Filtrar por IdUser, Status, IdPerson.
        /// </summary>
        /// <param optional name="IdUser"></param> <param optional name="Status"></param> <param optional name="IdPerson"></param>
        /// <returns>Lista de tipo MUser</returns>
        public List <MUser> fnListUser(int?IdUser = null, bool?Status = null, int?IdPerson = null)
        {
            List <MUser>          ListUser = new List <MUser>();
            MMEnterprisesEntities db       = new MMEnterprisesEntities();

            MUser ObjUser = new MUser();

            ListUser = (from result in db.GNListUser(IdUser, Status, IdPerson).ToList()
                        select new MUser
            {
                IdUser = result.IdUser,
                IdPerson = result.IdPerson,
                Login = result.Login,
                Status = result.Status,
                StatusDesc = result.Status == true ? "Activo" : "Inactivo",
                PersonEmployee = (MPerson)(from result2 in db.GNListPerson(result.IdPerson, 2, null, null, null).ToList()
                                           select new MPerson
                {
                    //IdPerson = result2.IdPerson,
                    //IdPersonType = result2.IdPersonType,
                    //PersonType = result2.PersonType,
                    //IdIdentificationType = result2.IdIdentificationType,
                    //IdentificationType = result2.IdentificationType,
                    NumIdentification = ObjUser.Desencriptar(result2.NumIdentification),
                    Name = result2.Name,
                    LastName = result2.LastName,
                    //Birthday = result2.Birthday,
                    //Address = ObjUser.Desencriptar(result2.Address),
                    //Email = result2.Email,
                    //IdContactType = result2.IdContactType,
                    //ContactType = result2.ContactType,
                    //IdPosition = result2.IdPosition,
                    Position = result2.Position //,
                                                //ClientPermission = result2.ClientPermission,
                                                //Status = result2.Status
                }).ToList().FirstOrDefault(),
                UserRolesNames = String.Join(",", db.GNListUserRole(null, result.IdUser).Select(c => c.NameRole).ToList())
            }).ToList();

            return(ListUser);
        }
Beispiel #4
0
        public static List <MTask> fnListTask(int?IdTask = null, DateTime?dttDateIni = null, DateTime?dttDateEnd = null, int?IdResponsable = null, string strTittle = "", int?IdPriority = null, int?IdStatus = null, int?IdTypeTask = null, int?IdServiceRequest = null, int?IdUser = null, int?IdFatherTask = null, int?IdColaborator = null, int?IdFollower = null)
        {
            List <MTask>          listTask = new List <MTask>();
            MMEnterprisesEntities db       = new MMEnterprisesEntities();

            MUser objUser = new MUser();

            listTask = (List <MTask>)(from tsk in db.GNListTask(IdTask, dttDateIni, dttDateEnd, IdResponsable, strTittle, IdPriority, IdStatus, IdTypeTask, IdServiceRequest, IdUser, IdFatherTask, IdColaborator, IdFollower).ToList()
                                      select new MTask
            {
                IdTask                 = tsk.IdTask,
                IdUser                 = tsk.IdUser,
                UserName               = tsk.UserName,
                UserLastName           = tsk.UserLastName,
                DateIni                = tsk.DateIni,
                DateEnd                = tsk.DateEnd,
                HourIni                = tsk.HourIni,
                HourEnd                = tsk.HourEnd,
                Place                  = tsk.Place,
                Status                 = tsk.Status,
                IdStatus               = tsk.IdStatus,
                IdFatherTask           = tsk.IdFatherTask,
                Tittle                 = tsk.Tittle,
                IdServiceRequest       = tsk.IdServiceRequest,
                IdTypeTask             = tsk.IdTypeTask,
                TypeTask               = tsk.TypeTask,
                IdPriority             = tsk.IdPriority,
                PriorityTask           = tsk.PriorityTask,
                IdPersonEmployee       = tsk.IdResponsable,
                PersonEmployeeName     = tsk.Name,
                PersonEmployeeLastName = tsk.LastName,
                Activity               = tsk.Activity,
                Confidential           = tsk.confidential == null ? false : (bool)tsk.confidential,
                listTaskPerson         = (List <MTaskPerson>)(from tp in db.GNListPersonTask(tsk.IdTask, null).ToList()
                                                              select new MTaskPerson
                {
                    IdPersonEmployee       = tp.IdPersonEmployee,
                    PersonEmployeeName     = tp.PersonEmployeeName,
                    PersonEmployeeLastName = tp.PersonEmployeeLastName,
                    NumIdentification      = objUser.Desencriptar(tp.NumIdentification),
                    Iscolaborator          = tp.Iscolaborator
                }).ToList()
                ,
                listMTaskComment = (List <MTaskComment>)(from tp in db.GNListBitacora(tsk.IdTask).ToList()
                                                         select new MTaskComment
                {
                    IdComment     = tp.IdComment,
                    IdTask        = tp.IdTask,
                    Comment       = tp.Comment,
                    IdUser        = tp.IdUser,
                    UserName      = tp.UserName,
                    DateOperation = tp.DateOperation,
                    Date          = tp.Date,
                    New           = 0,
                }).ToList(),

                Creator = (string)(from tt in db.GNListPerson(null, null, null, null, tsk.IdUser).ToList()
                                   select tt.LastName + " " + tt.Name).FirstOrDefault(),
                Colaborator   = tsk.Colaborator,
                Follower      = tsk.Seguidor,
                OperationDate = tsk.OperationDate,
                CreationDate  = tsk.CreationDate,
                IdCreatedBy   = tsk.IdCreatedBy,
            }).ToList();

            return(listTask);

            //ListUserCreate = (from result in db.GNListConfigTkOnBehalfOf(IdUser, null, null).ToList()
            //                  select new MConfigTkOnBehalfOf
            //                  {
            //                      IdUserOnBehalfOf = result.IdUserOnBehalfOf,
            //                      Name = objUser.Desencriptar(result.NumIdentificationOnBehalfOf) + " - " + result.LastNameOnBehalfOf + (result.NameOnBehalfOf != "" ? " " + result.NameOnBehalfOf : ""),
            //                  }).ToList()
        }
Beispiel #5
0
        /// <summary>
        /// Busca informacion completa de un usuario Con sus accesos.
        /// Se puede buscar Usuario por IdUser o por IdPerson
        /// </summary>
        /// <param optional name="IdUser"></param> <param optional name="Status"></param> <param optional name="IdPerson"></param>
        /// <returns>Objeto de tipo MUser</returns>
        public MUser fnSearchUser(int?IdUser = null, bool?Status = null, int?IdPerson = null)
        {
            MUser objMUser           = new MUser();
            MMEnterprisesEntities db = new MMEnterprisesEntities();
            string listIdRoles       = String.Join(",", db.GNListUserRole(null, IdUser).Select(c => c.IdRole).ToList());

            objMUser = (from result in db.GNListUser(IdUser, Status, IdPerson).ToList()
                        select new MUser
            {
                IdUser = result.IdUser,
                IdPerson = result.IdPerson,
                Login = result.Login,
                Password = objMUser.Desencriptar(result.Password),
                Status = result.Status,
                StatusDesc = result.Status == true ? "Activo" : "Inactivo",
                PersonEmployee = (MPerson)(from result2 in db.GNListPerson(result.IdPerson, 2, null, null, null).ToList()
                                           select new MPerson
                {
                    IdPerson = result2.IdPerson,
                    IdPersonType = result2.IdPersonType,
                    PersonType = result2.PersonType,
                    IdIdentificationType = result2.IdIdentificationType,
                    IdentificationType = result2.IdentificationType,
                    NumIdentification = objMUser.Desencriptar(result2.NumIdentification),
                    Name = result2.Name,
                    LastName = result2.LastName,
                    Birthday = result2.Birthday,
                    Address = objMUser.Desencriptar(result2.Address),
                    Email = result2.Email,
                    IdContactType = result2.IdContactType,
                    ContactType = result2.ContactType,
                    IdPosition = result2.IdPosition,
                    Position = result2.Position,
                    ClientPermission = result2.ClientPermission,
                    Status = result2.Status
                }).ToList().First(),
                Roles = (from resultRoles in db.GNListUserRole(null, result.IdUser).ToList()
                         select new MRole
                {
                    IdRole = resultRoles.IdRole,
                    NameRole = resultRoles.NameRole
                }).ToList(),
                UserAcces = (from result3 in db.GNListUserAcces(result.IdUser, null, listIdRoles).ToList()
                             select new MUserAcces
                {
                    IdOption = result3.IdOption,
                    OptionName = result3.OptionName,
                    Visible = result3.Visible == null ? false : (bool)result3.Visible,
                    Create = result3.Create == null ? false : (bool)result3.Create,
                    Search = result3.Search == null ? false : (bool)result3.Search,
                    Edit = result3.Edit == null ? false : (bool)result3.Edit,
                    Delete = result3.Edit == null ? false : (bool)result3.Delete,
                    IdAssociated = result3.IdAssociated,
                    Action = result3.Action,
                    Controller = result3.Controller
                }).ToList(),

                UserAccesPadre = (from result3 in db.GNListUserAcces(null, null, null).ToList()
                                  select new MUserAcces
                {
                    IdOption = result3.IdOption,
                    OptionName = result3.OptionName,
                    Visible = result3.Visible == null ? false : (bool)result3.Visible,
                    Create = result3.Create == null ? false : (bool)result3.Create,
                    Search = result3.Search == null ? false : (bool)result3.Search,
                    Edit = result3.Edit == null ? false : (bool)result3.Edit,
                    Delete = result3.Edit == null ? false : (bool)result3.Delete,
                    IdAssociated = result3.IdAssociated,
                    Action = result3.Action,
                    Controller = result3.Controller
                }).ToList()
            }).First();

            return(objMUser);
        }