Пример #1
0
        public ActionResult Detalle(string id = null)
        {
            ManagerUser mang = new ManagerUser();
            dto_login dto_login = new dto_login();
            dto_login.listadoDto_login = new List<dto_login>();
            dto_login.ListRoles = new List<Roles>();
            var log = new dto_login
            {
                cod_agente = string.Empty,
                pass = string.Empty,
                correo = string.Empty
            };
            var ret = mang.ConsultaUsuarios(log);
            var ret1 = mang.GetUserRoles();
            var ret2 = mang.GetUserAgencias();
            if (ret.Any())
            {
                dto_login.listadoDto_login = ret;
                dto_login.ListRoles = ret1;
                dto_login.ListaAgencias = ret2;
            }

            return Json(dto_login.listadoDto_login, JsonRequestBehavior.AllowGet);

        }
Пример #2
0
        public ActionResult Login(LoginModels _login)
        {
            if (ModelState.IsValid) //validating the user inputs
            {
                var loginUser = new dto_login
                {
                    nombre     = string.Empty,
                    pass       = Cryption.Encrypt(_login.Password, ConfigurationManager.AppSettings["claveEncriptacion"]),
                    vendedor   = string.Empty,
                    cod_agente = _login.Cedula.ToString(),
                    estado     = string.Empty,
                    correo     = string.Empty
                };


                //Manager.ClientPostRequest(loginUser, AppSettings.urlApi, AppSettings.controladorLogin);
                //Manager.SendRequestAsync(AppSettings.urlApi , AppSettings.controladorLogin, loginUser);

                ManagerUser mang = new ManagerUser();


                var dto_retorno = mang.Login(loginUser);

                // var result = await _signInManager.PasswordSignInAsync(Input.Cedula, Input.Password, Input.RememberMe, lockoutOnFailure: true);

                if (dto_retorno.Any())
                {
Пример #3
0
		public ActionResult Crear(dto_login dto_login)
		{
			if (ModelState.IsValid)
			{

				ManagerUser mang = new ManagerUser();
				dto_login.ListRoles = new List<Roles>();
Пример #4
0
        public IHttpActionResult LoginUser(dto_login dto)
        {
            var _loginService = _ServiceFactory.GetService <ILoginService>();

            _loginService.controller_key = _controller_key;
            var _user = _loginService.Login(dto).Result;

            if (!this.ModelState.IsValid)
            {
                return(BadRequest(this.ModelState));
            }
            return(Ok(_user));
        }
Пример #5
0
        //public ActionResult CargaRoles()
        //{
        //	ManagerUser mang = new ManagerUser();
        //	List<Roles> Roles = new List<Roles>();
        //	var ret = mang.GetUserRoles();
        //	if (ret.Any())
        //	{
        //		Roles = ret;

        //	}
        //	return Json(Roles, JsonRequestBehavior.AllowGet);

        //}
        //
        // GET: /User/Create

        public ActionResult Create()
        {
			ManagerUser mang = new ManagerUser();
			dto_login dto_login = new dto_login();			
			dto_login.ListRoles = new List<Roles>();
            dto_login.ListaAgencias = new List<UserAgencias>();
			Limpiar();
			var ret = mang.GetUserRoles();
            var ret2 = mang.GetUserAgencias();
			if (ret.Any())
			{				
				dto_login.ListRoles = ret;
                dto_login.ListaAgencias = ret2;
			}
			return View(dto_login);
        }
Пример #6
0
        public ActionResult Edit(string id, string configuracion)
        {
            int         result = 0;
            ManagerUser manage = new ManagerUser();
            var         login  = new dto_login
            {
                cod_agente          = id,
                ConfiguracionBucket = configuracion
            };

            try
            {
                if (string.IsNullOrEmpty(id))
                {
                    return(RedirectToAction("Buckets", "Details"));
                }
                else
                {
                    try
                    {
                        result = manage.UpdateBuckets(login);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        // Provide for exceptions.
                    }

                    if (result > 0)
                    {
                        return(Json(data: true));
                    }
                    else
                    {
                        return(Json(data: false));
                    }
                }
                //return View("Edit");
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #7
0
        public ActionResult Delete(string id)
        {
            var login = new dto_login
            {
                cod_agente = id,
                estado     = "Inactivo"
            };
            ManagerUser manage = new ManagerUser();

            try
            {
                int result = 0;

                if (string.IsNullOrEmpty(id))
                {
                    return(RedirectToAction("Buckets", "Details"));
                }

                try
                {
                    result = manage.UpdateBuckets(login);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    // Provide for exceptions.
                }

                if (result > 0)
                {
                    return(Json(data: true));
                }
                else
                {
                    return(Json(data: false));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #8
0
        public ActionResult Create(dto_login dto_login)
        {
            if (ModelState.IsValid)
            {

                ManagerUser mang = new ManagerUser();						
				dto_login.ListRoles = new List<Roles>();				
				dto_login.pass = TwoFunTwoMe_DataAccess.Utility.Encrypt(dto_login.pass);

                mang.Registrar(dto_login);
				dto_login = Limpiar();

				var ret = mang.GetUserRoles();
				if (ret.Any())
				{
					dto_login.ListRoles = ret;
				}
			}			
			return View(dto_login);
		}
        public ActionResult Detalle(string id = null)
        {
            ManagerUser mang       = new ManagerUser();
            AgenteMenu  agentemenu = new AgenteMenu();

            agentemenu.ListAgenteMenuAsig    = new List <AgenteMenu>();
            agentemenu.ListAgenteMenuDesAsig = new List <AgenteMenu>();
            agentemenu.Listdto_Login         = new List <dto_login>();
            var age = new AgenteMenu
            {
                COD_AGENTE = id,
                IDSUBMENU  = null,
                ACCION     = "CONSULTAR"
            };
            var log = new dto_login
            {
                cod_agente = id,
                pass       = string.Empty,
                correo     = string.Empty
            };
            var agentasig     = mang.ConsultaSubmenusAsignados(age);
            var agentedesasig = mang.ConsultaSubmenusDesAsignados(age);
            var Usuario       = mang.ConsultaUsuarios(log);

            if (agentasig.Any())
            {
                agentemenu.ListAgenteMenuAsig = agentasig;
            }
            if (agentedesasig.Any())
            {
                agentemenu.ListAgenteMenuDesAsig = agentedesasig;
            }
            if (Usuario.Any())
            {
                agentemenu.Listdto_Login = Usuario;
            }

            return(Json(agentemenu, JsonRequestBehavior.AllowGet));
        }
Пример #10
0
 public IHttpActionResult _LoginUser(dto_login _dto)
 {
     try
     {
         var _service = _ServiceFactory.GetService <ILoginService>();
         if (_service == null)
         {
             return(BadRequest("null serveice"));
         }
         _service.controller_key = _controller_key;
         var _resp = _service.LoginAdmin(_dto).Result;
         if (!this.ModelState.IsValid)
         {
             return(BadRequest(this.ModelState));
         }
         return(Ok(_resp));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Пример #11
0
        protected void Session_End(Object sender, EventArgs e)
        {
            try
            {
                ManagerUser mang = new ManagerUser();
                if (Session.IsNewSession && Session["LoginCredentials"] == null)
                {
                    var loginUser = new dto_login
                    {
                        cod_agente          = string.Empty,
                        IdCatDisponibilidad = 0
                    };

                    var dto_retorno = (List <TwoFunTwoMeFintech.Models.dto_login>)Session["LoginCredentials"];

                    var dto_Config = new Tab_ConfigSys
                    {
                        llave_Config1 = "CONFIGURACION",
                        llave_Config2 = "FENIX",
                        llave_Config3 = "VENTAS",
                        llave_Config4 = "CIERRE_SESION",
                        llave_Config5 = "CIERR_SES"
                    };

                    var dto_ret_config = mang.GetConfigSys(dto_Config);
                    loginUser.cod_agente          = dto_retorno[0].cod_agente;
                    loginUser.IdCatDisponibilidad = dto_ret_config.FirstOrDefault().Dato_Int1;
                    var StsAsesor = mang.usp_EjeStatusDisp(loginUser);
                    // Remove user from HashTable
                    Session.Abandon();
                    Session.Clear();
                    Session.RemoveAll();
                }
            }
            catch { }
        }
Пример #12
0
        public ActionResult Agente()
        {
            ManagerUser mnage = new ManagerUser();

            try
            {
                var draw  = HttpContext.Request.Form["draw"];
                var start = Request.Form["start"];
                // Paging Length 10,20
                var length = Request.Form["length"];
                // Sort Column Name
                var sortColumn = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"];
                // Sort Column Direction ( asc ,desc)
                var sortColumnDirection = Request.Form["order[0][dir]"];
                // Search Value from (Search box)
                var searchValue = Request.Form["search[value]"];

                //Paging Size (10,20,50,100)
                int pageSize = length != null?Convert.ToInt32(length) : 0;

                int skip = start != null?Convert.ToInt32(start) : 0;

                int recordsTotal = 0;

                if (Session["LoginCredentials"] != null)
                {
                    var agenteSession = Session["LoginCredentials"] as List <dto_login>;
                    var log           = new dto_login
                    {
                        cod_agente = string.Empty,
                        pass       = string.Empty,
                        correo     = string.Empty
                    };
                    var agente = mnage.LoginRol(log);


                    // Getting all Customer data
                    var customerData = (from tempcustomer in agente
                                        select new
                    {
                        fechamodificacion = tempcustomer.FEC_MODIFICACION.ToString(),
                        fechacreacion = tempcustomer.FEC_MODIFICACION.ToString(),
                        cod_agente = tempcustomer.cod_agente.ToString(),
                        estado = tempcustomer.estado.ToString(),
                        nombre = tempcustomer.nombre.ToString(),
                        configuraciones1 = tempcustomer.ConfiguracionBucket.Substring(0, 1).ToString(),
                        configuraciones2 = tempcustomer.ConfiguracionBucket.Substring(2, 1).ToString(),
                        configuraciones3 = tempcustomer.ConfiguracionBucket.ToString().Substring(4, 1),
                        configuraciones4 = tempcustomer.ConfiguracionBucket.ToString().Substring(6, 1),
                        configuraciones5 = tempcustomer.ConfiguracionBucket.ToString().Substring(8, 1),
                        configuraciones6 = tempcustomer.ConfiguracionBucket.ToString().Substring(10, 1),
                        configuraciones7 = tempcustomer.ConfiguracionBucket.ToString().Substring(12, 1),
                        configuraciones8 = tempcustomer.ConfiguracionBucket.ToString().Substring(14, 1),
                    });

                    if (!(string.IsNullOrEmpty(sortColumn) && string.IsNullOrEmpty(sortColumnDirection)))
                    {
                        switch (sortColumn)
                        {
                        case "cod_agente":
                            if (sortColumnDirection == "desc")
                            {
                                customerData = (from foobars in customerData
                                                orderby foobars.cod_agente descending
                                                select foobars
                                                );
                            }
                            else
                            {
                                customerData = (from foobars in customerData
                                                orderby foobars.cod_agente ascending
                                                select foobars
                                                );
                            }
                            break;

                        case "nombre":
                            if (sortColumnDirection == "desc")
                            {
                                customerData = (from foobars in customerData
                                                orderby foobars.nombre descending
                                                select foobars
                                                );
                            }
                            else
                            {
                                customerData = (from foobars in customerData
                                                orderby foobars.nombre ascending
                                                select foobars
                                                );
                            }
                            break;

                        case "estado":
                            if (sortColumnDirection == "desc")
                            {
                                customerData = (from foobars in customerData
                                                orderby foobars.estado descending
                                                select foobars
                                                );
                            }
                            else
                            {
                                customerData = (from foobars in customerData
                                                orderby foobars.estado ascending
                                                select foobars
                                                );
                            }
                            break;
                        }
                        //customerData = customerData.OrderBy(x =>x.cod_agente);
                    }
                    //Search
                    if (!string.IsNullOrEmpty(searchValue))
                    {
                        customerData = customerData.Where(m => m.cod_agente.ToLower().Contains(searchValue.ToLower()) || m.nombre.ToLower().Contains(searchValue.ToLower()) || m.estado.ToLower().Contains(searchValue.ToLower()));
                    }

                    //total number of rows count
                    recordsTotal = customerData.Count();
                    //Paging
                    var data = customerData.Skip(skip).Take(pageSize).ToList();

                    return(Json(new { draw = draw, recordsFiltered = customerData.Count(), recordsTotal = customerData.Count(), data = data }));
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #13
0
        public Task <dto_pc_userC> LoginAdmin(dto_login _dto)
        {
            dto_pc_userC _ret_dto_obj = null;

            return(Task.FromResult(_ret_dto_obj));
        }