public ActionResult Inbox()
        {
            user userSession = UsersController.getUserSession();

            if (userSession.role == UsersController.NOT_ALLOWED)
            {
                UsersController usersController = new UsersController();
                usersController.SendEmail("ADMIN", "", "permission", "El usuario "+ userSession.name + " solicita permiso", null);
                return View("NotAllowed");
            }

            setContentInbox();
            ViewData["PageActive"] = "Inbox";
            return View();
        }
        private void approveOrNot(String id, String statusType, String observacion="")
        {
            var clients = (from u in sql.clients
                           where u.id == Convert.ToInt64(id)
                           select u);
            String division = "";
            String roles = "";

            if (clients.Count() > 0)
            {
                var client = clients.First();
                String[] status = (!String.IsNullOrEmpty(client.status) ? client.status.Split('|') : new String[2] { "", "" });
                String[] participies = client.participe.Split('|');
                HomeController homeController = new HomeController();
                user userSession = UsersController.getUserSession();
                String nextParticipe = "";

                division = client.division;
                roles = client.participe;

                if (status[0] != "DESAPPROVED")
                {
                    if (userSession.role == "COMERCIAL" && (status[1] == "" || status[0] == "FINISHED"))
                    {
                        client.status = statusType + "|COMERCIAL";
                        nextParticipe = findNext(participies, userSession.role);
                    }
                    else if (userSession.role == "IMPUESTOS" && status[1] == "COMERCIAL")
                    {
                        client.status = statusType + "|IMPUESTOS";
                        nextParticipe = findNext(participies, userSession.role);
                    }
                    else if (userSession.role == "REGULATORIOS" && (status[1] == "COMERCIAL" || status[1] == "IMPUESTOS"))
                    {
                        client.status = statusType + "|REGULATORIOS";
                        nextParticipe = findNext(participies, userSession.role);
                    }
                    else if (userSession.role == "DISTRIBUCION" && (status[1] == "COMERCIAL" || status[1] == "IMPUESTOS" || status[1] == "REGULATORIOS"))
                    {
                        client.status = statusType + "|DISTRIBUCION";
                        nextParticipe = findNext(participies, userSession.role);
                    }
                    else if (userSession.role == "BEX" && (status[1] == "COMERCIAL" || status[1] == "IMPUESTOS" || status[1] == "REGULATORIOS" || status[1] == "DISTRIBUCION"))
                    {
                        client.status = statusType + "|BEX";
                        nextParticipe = "comercial";
                    }
                    else if (userSession.role == "COMERCIAL")
                    {
                        if (statusType == "APPROVED")
                        {
                            client.status = "FINISHED|COMERCIAL";
                            nextParticipe = "all";
                        }
                        else
                        {
                            client.status = statusType + "|COMERCIAL";
                        }
                    }
                }
                else if (userSession.role == "COMERCIAL")
                {
                    client.status = statusType + "|COMERCIAL";
                    nextParticipe = findNext(participies, userSession.role);
                }

                String fileTemplate = "";
                UsersController userController = new UsersController();

                if (statusType == "DESAPPROVED")
                {
                    fileTemplate = "desapproved";
                    client.observacion_desapproved = observacion;
                    nextParticipe = "all";
                }
                else
                {
                    if (userSession.role == "COMERCIAL")
                    {
                        client.approved_comercial = userSession.id;
                    }
                    else if (userSession.role == "IMPUESTOS")
                    {
                        client.approved_impuestos = userSession.id;
                    }
                    else if (userSession.role == "REGULATORIOS")
                    {
                        client.approved_regulatorios = userSession.id;
                    }
                    else if (userSession.role == "DISTRIBUCION")
                    {
                        client.approved_distribucion = userSession.id;
                    }
                    else if (userSession.role == "BEX")
                    {
                        client.approved_bex = userSession.id;
                    }

                    client.observacion_desapproved = "";

                    if (nextParticipe == "all")
                    {
                        fileTemplate = "finished";
                        client.observaciones_bex = "";
                        client.observaciones_comercial = "";
                        client.observaciones_distribucion = "";
                        client.observaciones_impuestos = "";
                        client.observaciones_regulatorios = "";
                    }
                    else
                    {
                        fileTemplate = nextParticipe;
                    }
                }

                if (nextParticipe.ToUpper() == "ALL")
                {
                    String[] rolesEmail = roles.Split('|');

                    foreach (string role in rolesEmail)
                    {
                        userController.SendEmail(role, division, fileTemplate, (statusType == "FINISHED" ? "Finalizado" : (statusType == "APPROVED" ? "Aprobado" : "Desaprobado")) + " - " + userSession.role1.name, client);
                    }

                    userController.SendEmailSolicitante(client);
                }
                else
                {
                    try
                    {
                        userController.SendEmail(nextParticipe.ToUpper(), division, fileTemplate, (statusType == "FINISHED" ? "Finalizado" : (statusType == "APPROVED" ? "Aprobado" : "Desaprobado")) + " - " + userSession.role1.name, client);
                    }
                    catch (Exception ex)
                    {

                    }
                }

                sql.SubmitChanges();
            }
        }