Example #1
0
        public JsonResult GetNotifiers(int id,
                                       [FromServices] IRepository <EmployeeNotify> employeeNotify,
                                       [FromServices] IOrganigramaModelFactory organigramaModelFactory)
        {
            var organigrama = organigramaModelFactory.GetAllData().Employess;
            var row         = employeeNotify.GetElement(id);
            var rows        = employeeNotify.SearhItemsFor(u => u.Area.Equals(row.Area) && u.Centro.Equals(row.Centro) && u.Departamento.Equals(row.Departamento));
            EmployeeNotificationModel model = new EmployeeNotificationModel();

            if (rows.Any())
            {
                var emps = (from apv in rows
                            join org in organigrama on apv.RowGuid.ToString().ToLower() equals org.RowId.ToLower()
                            select new EmployeeNotificationItem()
                {
                    Id = apv.Id,
                    Area = apv.Area,
                    Centro = apv.Centro,
                    Puesto = org.JobTitle,
                    RowGuid = apv.RowGuid.ToString(),
                    Notifier = $"{org.Name}",
                    Email = org.UserName
                }).ToList();

                model.Notifications = emps;
            }


            return(Json(new { area = row.Area, centro = row.Centro, depto = row.Departamento, collection = model.Notifications }));
        }
        public HttpResponseMessage updateNotificaitonStatus([FromBody] EmployeeNotificationModel model) // TODO first & last combine it
        {
            model.LastUpdatedBy = UserName;
            int result = _employeeDetailsService.updateNotificaitonStatus(model);

            if (result > 0)
            {
                return(Request.CreateResponse(HttpStatusCode.Accepted, new { Result = "Success" }));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "error"));
        }
Example #3
0
        public int updateNotificaitonStatus(EmployeeNotificationModel model)
        {
            var employeeDetail = _employeeNotificationRepository.Get(model.NotificationID);

            if (employeeDetail != null)
            {
                employeeDetail.NotificationShownStatus = true;;
                employeeDetail.LastUpdatedBy           = model.LastUpdatedBy;
                employeeDetail.LastUpdatedDate         = DateTime.Now;
                _employeeNotificationRepository.Update(employeeDetail);
                return(_employeeNotificationRepository.SaveChanges());
            }
            return(0);
        }
Example #4
0
        public IActionResult NotifyIndex([FromServices] IRepository <EmployeeNotify> employeeNotifyRepository,
                                         [FromServices] IOrganigramaModelFactory organigramaModelFactory)
        {
            EmployeeNotificationModel model = new EmployeeNotificationModel();
            var notifiers   = employeeNotifyRepository.GetAll();
            var organigrama = organigramaModelFactory.GetAllData().Employess;

            var emps = (from apv in notifiers
                        join org in organigrama on apv.RowGuid.ToString().ToLower() equals org.RowId.ToLower()
                        select new EmployeeNotificationItem()
            {
                Id = apv.Id,
                Area = apv.Area,
                Centro = apv.Centro,
                Puesto = org.JobTitle,
                RowGuid = apv.RowGuid.ToString(),
                Notifier = $"{org.Name}",
                Email = org.UserName
            }).ToList();

            model.Notifications = emps;

            List <SelectListItem> areas = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text  = "Seleccione una opciĆ³n",
                    Value = "0"
                }
            };

            areas.AddRange(organigramaModelFactory.GetAreas().Select(o => new SelectListItem()
            {
                Text  = o.Descripcion,
                Value = o.Id.ToString()
            }).ToList());

            ViewBag.Areas = areas;

            return(View(model));
        }