public ActionResult ChangeRole(Int32 IdRole)
        {
            Commons.User  user = (Commons.User)Session["USERINFO"];
            Commons.Role  role = (Commons.Role)Session["ROLEINFO"];
            IRestResponse WSR  = Task.Run(() => apiClient.getJArray("Rol/ListarPorUsuario", "UserName="******"ROLEINFO");
                    Session.Remove("MENUINFO");
                    Session["ROLEINFO"] = item;
                    Session["MENUINFO"] = new MenuController().Get(item.Name, user.UserName);


                    return(Json(true, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(false, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
0
        public static Commons.User MobileLogin(Commons.UserLogin model)
        {
            Commons.User obj = new Commons.User();
            using (IndexEntities db = new IndexEntities())
            {
                sp_MobileLogin_Result result = db.sp_MobileLogin(model.Username, Functionalities.Security.Cryptography.Encrypt(model.Password)).FirstOrDefault();

                if (result != null)
                {
                    obj.Id            = result.IdPerson;
                    obj.FirstName     = result.FirstName;
                    obj.LastName      = result.LastName;
                    obj.Nit           = result.Nit;
                    obj.SitePassword  = result.SitePassword;
                    obj.PasswordReset = result.PasswordReset;
                    obj.OAuthSite     = result.OAuthSite;
                    obj.OAuthMobile   = result.OAuthMobile;
                    obj.Active        = result.Active;
                    obj.UserName      = result.UserName;
                    obj.Roles         = Role.Get(result.UserName);
                }
                else
                {
                    obj = null;
                }
            }

            return(obj);
        }
        public ActionResult ChangeAccount(Int32 IdAccount)
        {
            Commons.User  user = (Commons.User)Session["USERINFO"];
            IRestResponse WSR  = Task.Run(() => apiClient.getJArray("Cliente/Listar/Cuentas", "UserName="******"ACCOUNTINFO");
                    Session["ACCOUNTINFO"] = item;
                    Session.Remove("CUSTOMERINFO");
                    Session.Remove("IDFILEHEADER");
                    TempData.Clear();

                    return(Json(true, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(false, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 4
0
        public HttpResponseMessage MobileLogin(String UserName, String Password)
        {
            HttpResponseMessage respuesta = null;

            try
            {
                Commons.UserLogin model = new Commons.UserLogin()
                {
                    Username = UserName, Password = Functionalities.Security.Cryptography.Decrypt(Password)
                };
                Commons.User user = Dal.User.MobileLogin(model);

                if (user != null)
                {
                    respuesta = Request.CreateResponse(HttpStatusCode.OK, user);
                }
                else
                {
                    respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, "Credenciales incorrectas");
                }
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }
Ejemplo n.º 5
0
        public static Boolean Delete(Commons.User model)
        {
            using (IndexEntities db = new IndexEntities())
            {
                db.spd_user(model.UserName);
            }

            return(true);
        }
        public ActionResult EvaluteAssigned()
        {
            Commons.User user = (Commons.User)Session["USERINFO"];
            Commons.Role role = (Commons.Role)Session["ROLEINFO"];

            List <Account> accounts    = new List <Account>();
            IRestResponse  wsrAccounts = Task.Run(() => apiClient.getJArray("Cliente/Listar/Cuentas", "UserName="******"ACCOUNTINFO"] = cuenta;
                ChangeAccount(cuenta.Id);

                List <Customer> customers    = new List <Customer>();
                IRestResponse   wsrCustomers = Task.Run(() => apiClient.getJArray("Cliente/ListarAsignados", "UserName="******"&IdAccount=" + cuenta.Id)).Result;
                if (wsrCustomers.StatusCode == HttpStatusCode.OK)
                {
                    customers = JArray.Parse(wsrCustomers.Content).ToObject <List <Customer> >().ToList();
                }

                if (customers.Count == 1)
                {
                    Customer cliente = customers.FirstOrDefault();
                    @Session["CUSTOMERINFO"] = cliente;
                    ChangeCustomer(cliente.Id);
                }

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (accounts.Count == 0)
                {
                    if (new PermisosController().Validate(user.UserName, null, "Asignar Clientes") == true)
                    {
                        return(RedirectToAction("Index", "Cliente"));
                    }
                    else
                    {
                        TempData["ERRORMESSAGE"] = "No cuenta con clientes asignados a su usuario. Comuníquese con el administrador de seguridad del sistema.";
                        TempData["CLEARDATA"]    = true;
                        return(RedirectToAction("Index", "Error"));
                    }
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
        }
Ejemplo n.º 7
0
        public static Boolean Add(Commons.User model)
        {
            using (IndexEntities db = new IndexEntities()) {
                db.spi_User(model.FirstName, model.LastName, model.Nit, model.UserName,
                            model.SitePassword, model.MobilePassword, model.PasswordReset, model.OAuthSite,
                            model.OAuthMobile, model.Active, model.RegisterUser);
            }

            return(true);
        }
Ejemplo n.º 8
0
        public ActionResult Index(Int32 IdFileDetailStock, Int32 IdFileDetailSubstract, Decimal Stock)
        {
            Commons.User user = (Commons.User)Session["USERINFO"];
            Commons.Role role = (Commons.Role)Session["ROLEINFO"];

            Session["IdFileDetailStock"]     = IdFileDetailStock;
            Session["IdFileDetailSubstract"] = IdFileDetailSubstract;
            ViewBag.Stock = Stock;
            ViewBag.DeleteTransmitedPremission = new PermisosController().Validate(user.UserName, role.Name, "Ajustes");

            return(View());
        }
        public ActionResult GetComboRoles()
        {
            Commons.User  user = (Commons.User)Session["USERINFO"];
            IRestResponse WSR  = Task.Run(() => apiClient.getJArray("Rol/ListarPorUsuario", "UserName=" + user.UserName)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <PhoneType> >().Select(x => new { Id = x.Id, Name = x.Description }).ToList(), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 10
0
        public JsonResult DetalleExportacionData(DateTime StartDate, DateTime EndDate, Boolean?GetTransmited, String FileHeaderList, String FileDetailList)
        {
            String response = null;

            Commons.Customer customer = new ClienteController().GetCustomer(((Commons.Customer)Session["CUSTOMERINFO"]).Id);
            Commons.User     user     = (Commons.User)Session["USERINFO"];
            Commons.Account  cuenta   = (Commons.Account)Session["ACCOUNTINFO"];

            Functionalities.Reportes.ExportationDetail data = new Functionalities.Reportes.ExportationDetail(Server.MapPath("~\\CRfiles\\DetalleExportacion.rpt"),
                                                                                                             Server.MapPath("~\\ReportFiles\\DetalleExportacion"), user.UserName, customer.EnterpriseName, Url.Content("~\\ReportFiles\\DetalleExportacion"));
            response = data.Generate(customer.Id, cuenta.Id, StartDate, EndDate, GetTransmited, FileHeaderList, FileDetailList);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 11
0
        public HttpResponseMessage Delete(Commons.User model)
        {
            HttpResponseMessage respuesta = null;

            try
            {
                Boolean result = Dal.User.Delete(model);
                respuesta = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }
Ejemplo n.º 12
0
        public JsonResult ListaItemData(Boolean?IsProduct)
        {
            String            response           = null;
            ClienteController customerController = new ClienteController();

            Commons.Customer            customer = customerController.GetCustomer(((Commons.Customer)Session["CUSTOMERINFO"]).Id);
            Commons.User                user     = (Commons.User)Session["USERINFO"];
            Commons.Account             cuenta   = (Commons.Account)Session["ACCOUNTINFO"];
            Commons.CustomerAccountData cadata   = customerController.GetCustomerAccountData(((Commons.Customer)Session["CUSTOMERINFO"]).Id, cuenta.Id).FirstOrDefault();

            Functionalities.Reportes.ItemReport data = new Functionalities.Reportes.ItemReport(Server.MapPath("~\\CRfiles\\ListaItem.rpt"),
                                                                                               Server.MapPath("~\\ReportFiles\\ListaItem"), user.UserName, customer.EnterpriseName, Url.Content("~\\ReportFiles\\ListaItem"));
            response = data.Generate(customer.Id, cuenta.Id, IsProduct);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
        public ActionResult RemoveCustomerAssignment([DataSourceRequest] DataSourceRequest request, CustomerUser model)
        {
            if (model != null && ModelState.IsValid)
            {
                IRestResponse WSR = Task.Run(() => apiClient.postObject("Cliente/Usuarios/Eliminar", model)).Result;
                if (WSR.StatusCode != HttpStatusCode.OK)
                {
                    ModelState.AddModelError("errorGeneral", JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString());
                }
            }

            Commons.User user = (Commons.User)Session["USERINFO"];
            Session["GOTCUSTOMER"] = GotUserAssigned(user.UserName);

            return(Json(new[] { model }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult ReadByUser([DataSourceRequest] DataSourceRequest request)
        {
            Commons.User  user = (Commons.User)Session["USERINFO"];
            IRestResponse WSR  = Task.Run(() => apiClient.getJArray("Rol/ListarAsignados", "UserName=" + user.UserName)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <Role> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Ejemplo n.º 15
0
        public JsonResult SaveToQueue(Int32 IdPriority, DateTime StartDate, DateTime EndDate, String FileItemDischargeIds)
        {
            Customer CustomerInfo = (Customer)Session["CUSTOMERINFO"];
            Account  AccountInfo  = (Account)Session["ACCOUNTINFO"];

            Commons.User UserInfo = (Commons.User)Session["USERINFO"];
            Commons.Transmition.OpaQueue model = new Commons.Transmition.OpaQueue();
            model.data       = new List <Commons.Transmition.OpaDetail>();
            model.IdCustomer = CustomerInfo.Id;
            model.IdAccount  = AccountInfo.Id;
            model.UserName   = UserInfo.UserName;
            model.IdPriority = IdPriority;
            model.StartDate  = StartDate;
            model.EndDate    = EndDate;
            model.data       = new List <Commons.Transmition.OpaDetail>();

            if (!string.IsNullOrEmpty(FileItemDischargeIds) && !string.IsNullOrWhiteSpace(FileItemDischargeIds))
            {
                List <String> data    = FileItemDischargeIds.Split(',').ToList();
                IRestResponse WSRDATA = Task.Run(() => apiClient.postObject("Transmision/FiltrarDataPorIds", data)).Result;
                if (WSRDATA.StatusCode == HttpStatusCode.OK)
                {
                    model.data = JArray.Parse(WSRDATA.Content).ToObject <List <Commons.Transmition.OpaDetail> >();
                }
                else
                {
                    return(Json(JObject.Parse(WSRDATA.Content).ToObject <Error>().Message.ToString(), JsonRequestBehavior.AllowGet));
                }
            }

            if (model.data.Count == 0)
            {
                return(Json("Debe seleccionar un registro por lo menos.", JsonRequestBehavior.AllowGet));
            }
            else
            {
                IRestResponse WSR = Task.Run(() => apiClient.postObject("Transmision/GuardarEnCola", model)).Result;
                if (WSR.StatusCode != HttpStatusCode.OK)
                {
                    return(Json(JObject.Parse(WSR.Content).ToObject <Error>().Message, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(true, JsonRequestBehavior.AllowGet));
                }
            }
        }
Ejemplo n.º 16
0
        public HttpResponseMessage Update(Commons.User model)
        {
            HttpResponseMessage respuesta = null;

            try
            {
                model.MobilePassword = Functionalities.Security.Cryptography.Encrypt(model.MobilePassword);
                model.SitePassword   = Functionalities.Security.Cryptography.Encrypt(model.SitePassword);
                Boolean result = Dal.User.Update(model);
                respuesta = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }
Ejemplo n.º 17
0
        public JsonResult DeclaracionJuradaGerencialData(DateTime StartDate, DateTime EndDate, Boolean?GetTransmited, String FileHeaderList, String FileDetailList, Boolean UseFreeze)
        {
            String            response           = null;
            ClienteController customerController = new ClienteController();

            Commons.Customer            customer = customerController.GetCustomer(((Commons.Customer)Session["CUSTOMERINFO"]).Id);
            Commons.User                user     = (Commons.User)Session["USERINFO"];
            Commons.Account             cuenta   = (Commons.Account)Session["ACCOUNTINFO"];
            Commons.CustomerAccountData cadata   = customerController.GetCustomerAccountData(((Commons.Customer)Session["CUSTOMERINFO"]).Id, cuenta.Id).FirstOrDefault();

            Functionalities.Reportes.SwornDeclarationTwo data = new Functionalities.Reportes.SwornDeclarationTwo(Server.MapPath("~\\CRfiles\\DeclaracionJuradaGerencial.rpt"),
                                                                                                                 Server.MapPath("~\\ReportFiles\\DeclaracionJuradaGerencial"), user.UserName, customer.EnterpriseName, Url.Content("~\\ReportFiles\\DeclaracionJuradaGerencial"));
            response = data.Generate(customer.Id, cuenta.Id, StartDate, EndDate, null, null, GetImpExpCode(customer), customer.Nit,
                                     cadata.ResolutionRate, cadata.ResolutionStartDate, cadata.ResolutionEndDate, GetTransmited, FileHeaderList, FileDetailList, UseFreeze);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 18
0
        public JsonResult ListaCongeladosData(DateTime?StartDate, DateTime?EndDate)
        {
            String            response           = null;
            ClienteController customerController = new ClienteController();

            Commons.Customer            customer = new ClienteController().GetCustomer(((Commons.Customer)Session["CUSTOMERINFO"]).Id);
            Commons.User                user     = (Commons.User)Session["USERINFO"];
            Commons.Account             cuenta   = (Commons.Account)Session["ACCOUNTINFO"];
            Commons.CustomerAccountData cadata   = customerController.GetCustomerAccountData(((Commons.Customer)Session["CUSTOMERINFO"]).Id, cuenta.Id).FirstOrDefault();

            Functionalities.Reportes.FrozenReport data = new Functionalities.Reportes.FrozenReport(Server.MapPath("~\\CRfiles\\ListaCongelados.rpt"),
                                                                                                   Server.MapPath("~\\ReportFiles\\ListaCongelados"), user.UserName, customer.EnterpriseName, Url.Content("~\\ReportFiles\\ListaCongelados"));
            response = data.Generate(customer.Id, cuenta.Id, StartDate, EndDate, null, null, GetImpExpCode(customer), customer.Nit, customer.LegalRepresentative,
                                     cadata.ResolutionRate, cadata.ResolutionStartDate, cadata.ResolutionEndDate);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 19
0
        public JsonResult ValidateEmail()
        {
            Commons.User UserInfo = (Commons.User)Session["USERINFO"];

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Transmision/ValidarEmail", "UserName=" + UserInfo.UserName)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                Commons.Transmition.EmailResponse data = JObject.Parse(WSR.Content).ToObject <Commons.Transmition.EmailResponse>();

                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString(), JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult ReadByAssignment([DataSourceRequest] DataSourceRequest request)
        {
            Commons.Account AccountInfo = (Commons.Account)Session["ACCOUNTINFO"];
            Commons.User    user        = (Commons.User)Session["USERINFO"];

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Cliente/ListarAsignados", "UserName="******"&IdAccount=" + AccountInfo.Id)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <Customer> >().ToList().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Ejemplo n.º 21
0
        public ActionResult Index()
        {
            Commons.User user = (Commons.User)Session["USERINFO"];
            Commons.Role role = (Commons.Role)Session["ROLEINFO"];
            ViewBag.Freeze = new PermisosController().Validate(user.UserName, role.Name, "Congelar Saldos");

            if (TempData["ITSOK"] != null)
            {
                Boolean ExecResult = Convert.ToBoolean(TempData["ITSOK"]);
                ViewBag.ItsOk = ExecResult;

                if (!ExecResult)
                {
                    ViewBag.ErrorMsg  = TempData["ERRORMSG"].ToString();
                    ViewBag.DataModel = (FileHeader)TempData["DATA"];
                }
            }

            return(View());
        }
Ejemplo n.º 22
0
        public ActionResult Detalle()
        {
            if (Session["IDFILEHEADER"] == null)
            {
                return(RedirectToAction("Index", "Transaccion"));
            }
            else
            {
                FileHeader data         = new FileHeader();
                Customer   cliente      = (Customer)Session["CUSTOMERINFO"];
                Account    cuenta       = (Account)Session["ACCOUNTINFO"];
                Int32      IdFileHeader = Convert.ToInt32(Session["IDFILEHEADER"].ToString());
                ViewBag.IdFileHeader = IdFileHeader;
                Commons.User user = (Commons.User)Session["USERINFO"];
                Commons.Role role = (Commons.Role)Session["ROLEINFO"];

                IRestResponse WSR = Task.Run(() => apiClient.getJArray("Detalle/Encabezado", "IdFileHeader=" + IdFileHeader
                                                                       + "&IdFileInfoConfig=null")).Result;
                if (WSR.StatusCode == HttpStatusCode.OK)
                {
                    ViewBag.Header = JArray.Parse(WSR.Content).ToObject <List <FileHeaderDetail> >();
                }

                IRestResponse WSRPARAMS = Task.Run(() => apiClient.getJArray("Encabezado/Listar", "IdFileHeader=" + IdFileHeader
                                                                             + "&IdCustomer=null&IdAccount=null&IdFileInfoConfig=null")).Result;
                if (WSRPARAMS.StatusCode == HttpStatusCode.OK)
                {
                    data = JArray.Parse(WSRPARAMS.Content).ToObject <List <FileHeader> >().FirstOrDefault();
                    ViewBag.HeaderParams = data;
                }

                ViewBag.AdjustmentPremission = new PermisosController().Validate(user.UserName, role.Name, "Eliminar Transmitidos");
                ViewBag.Freeze = new PermisosController().Validate(user.UserName, role.Name, "Congelar Saldos");

                List <Field> fields = getDetailObj(data.IdFileInfoConfig);
                ViewBag.Fields    = fields;
                Session["FIELDS"] = fields;

                return(View());
            }
        }
Ejemplo n.º 23
0
        public ActionResult ReadQueue([DataSourceRequest] DataSourceRequest request)
        {
            Customer CustomerInfo = (Customer)Session["CUSTOMERINFO"];
            Account  AccountInfo  = (Account)Session["ACCOUNTINFO"];

            Commons.User UserInfo = (Commons.User)Session["USERINFO"];

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Transmision/FiltrarCola", "IdCustomer=" + CustomerInfo.Id
                                                                   + "&IdAccount=" + AccountInfo.Id
                                                                   + "&UserName=" + UserInfo.UserName)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                List <Commons.Transmition.OpaHeader> data = JArray.Parse(WSR.Content).ToObject <List <Commons.Transmition.OpaHeader> >();

                return(Json(data.ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
        public ActionResult Login(UserLogin model)
        {
            Commons.User response = new Commons.User();
            if (ModelState.IsValid)
            {
                IRestResponse result = Task.Run(() => apiClient.getJArray("Seguridad/Autenticar/Web",
                                                                          "UserName="******"&Password="******"null")
                    {
                        response = Newtonsoft.Json.JsonConvert.DeserializeObject <Commons.User>(result.Content);
                        if (response.Active)
                        {
                            FormsAuthentication.SetAuthCookie(model.Username, true);
                            Session["USERINFO"]    = response;
                            Session["STRUSERNAME"] = response.UserName;

                            List <Role>   roles       = new List <Role>();
                            IRestResponse wsrAssigned = Task.Run(() => apiClient.getJArray("Rol/ListarPorUsuario", "UserName="******"", "Su usuario no cuenta no cuenta con roles asignados en el sistema. Comuníquese con el administrador de seguridad de la aplicación.");
                                return(View(model));
                            }
                            else if (response.PasswordReset)
                            {
                                if (response.OAuthMobile == true && response.OAuthSite == true)
                                {
                                    TempData["USERNAME"] = response.UserName;
                                    if (roles.Count == 1)
                                    {
                                        Session["ROLEINFO"] = roles[0];
                                        Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                    }
                                    Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                    Session.Timeout        = 30;
                                    return(RedirectToAction("Cambio", "Seguridad"));
                                }
                                else
                                {
                                    if (response.OAuthMobile)
                                    {
                                        TempData["USERNAME"] = response.UserName;
                                        if (roles.Count == 1)
                                        {
                                            Session["ROLEINFO"] = roles[0];
                                            Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                        }
                                        Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                        Session.Timeout        = 30;
                                        return(RedirectToAction("CambioMovil", "Seguridad"));
                                    }
                                    else if (response.OAuthSite)
                                    {
                                        TempData["USERNAME"] = response.UserName;
                                        if (roles.Count == 1)
                                        {
                                            Session["ROLEINFO"] = roles[0];
                                            Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                        }
                                        Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                        Session.Timeout        = 30;
                                        return(RedirectToAction("CambioWeb", "Seguridad"));
                                    }
                                    else
                                    {
                                        if (roles.Count == 1)
                                        {
                                            Session["ROLEINFO"] = roles[0];
                                            Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                        }
                                        Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                        Session.Timeout        = 30;
                                        return(RedirectToAction("EvaluteAssigned"));
                                    }
                                }
                            }
                            else
                            {
                                if (roles.Count == 1)
                                {
                                    Session["ROLEINFO"] = roles[0];
                                    Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                }
                                Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                Session.Timeout        = 30;
                                return(RedirectToAction("EvaluteAssigned"));
                            }
                        }
                        else
                        {
                            ModelState.AddModelError("", "Credenciales incorrectas");
                            return(View(model));
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Credenciales incorrectas");
                        return(View(model));
                    }
                }
                else
                {
                    ModelState.AddModelError("", JObject.Parse(result.Content).ToObject <Commons.Error>().Message.ToString());
                    return(View(model));
                }
            }
            else
            {
                return(View(model));
            }
        }