Beispiel #1
0
        public ActionResult AjaxRequest(palabra b)
        {
            //Prueba DB, ya no lo uso en este ejemplo
            // var alimento = db.alimento.Where(a => a.Nombre == b.Name)
            SL.Utils utils = new SL.Utils();
            BIZ.BIZCorreo correo = new BIZ.BIZCorreo();
            correo.Body = "Cuerpo";
            correo.To = "*****@*****.**";
            correo.Subject = "subjectttt";
            utils.sendMail(correo);

            return Json(b, JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        public ActionResult RegisterOut(Models.RegisterModel U)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                    BIZUsuario User = new BIZUsuario();
                    User = AutoMapper.Mapper.Map<Models.RegisterModel, BIZUsuario>(U);
                    User.IDEstado = 12;
                    User.IDTipoUsuario = 2;
                    UsuarioWorker.InsertarUsuario(User);
                    TempData["OKNormal"] = Resources.Language.OKNormal;
                    SL.Utils util = new SL.Utils();
                    var UserEncoded = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(User.Usuario1));
                    BIZ.BIZCorreo correo = new BIZCorreo();
                    correo.Subject = "Please Validate IID Account";
                    correo.To = User.Email;
                    string link = "<a href='http://" + Request.Url.Host.ToLower() + ":" + Request.Url.Port + "/Account/validateUser?k=" + UserEncoded + "'>Link</a>";
                    string body = String.Format(Language.MailValidationLink, User.Nombre, link);
                    //correo.Body = "Hi " + User.Nombre + ", <p>Plese validate your IID account with the following link</p> <a href='http://" + Request.Url.Host.ToLower() +":" + Request.Url.Port + "/Account/validateUser?k=" + UserEncoded + "'>Link</a>";
                    correo.Body = body;
                    util.sendMail(correo);
                    string _ip = "Unknown";
                    try
                    {
                        _ip = (string)Session["_ip"];
                    }
                    catch (Exception) { }

                    Bita.guardarBitacora(new BIZBitacora("Informativo", "Se ha creado el usuario " + User.Usuario1, null, _ip));
                    return RedirectToAction("EmailConfirm");
                //}
                //throw new ArgumentNullException("value");
            }
            catch (Exception ex2)
            {
                Nullable<int> idUser = null;
                string ip = "Unknown";
                try
                {
                    idUser = (int)Session["userID"];
                }
                catch (Exception ex) { }
                try
                {
                    ip = Session["_ip"].ToString();
                }
                catch (Exception ex) { }
                Bita.guardarBitacora(new BIZBitacora("Error", "Error en el registro", idUser, ip));

                TempData["ErrorNormal"] = Resources.Language.ErrorNormal;
                ViewBag.IDClienteEmpresa = new SelectList(ClienteWorker.ObtenerClienteEmpresas(), "IDClienteEmpresa", "Nombre");
                return View(U);
            }
            //}
            //catch(Exception err)
            //{
            //TempData["ErrorNormal"] = Resources.Language.ErrorNormal;
            //ViewBag.IDClienteEmpresa = new SelectList(DCliente.getAllClienteEmpresa(), "IDClienteEmpresa", "Nombre");
            //return View(U);
            //}
        }
Beispiel #3
0
        public ActionResult ForgetPassword(string NombreUsuario)
        {
            try
            {
                BIZUsuario user = UsuarioWorker.ObtenerUserByUsuario(NombreUsuario);
                if (user != null)
                {
                    SL.Utils util = new SL.Utils();
                    var UserEncoded = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(user.Usuario1));
                    BIZ.BIZCorreo correo = new BIZCorreo();
                    correo.Subject = "Access this link to change your password";
                    correo.To = user.Email;
                    string link = "<a href='http://" + Request.Url.Host.ToLower() + ":" + Request.Url.Port + "/Login/resetPassword/?k=" + UserEncoded + "'>Link</a>";
                    string body = String.Format(link);
                    correo.Body = body;
                    util.sendMail(correo);
                    TempData["OKNormal"] = Resources.Language.OKNormal;
                    try
                    {
                        Bita.guardarBitacora(new BIZBitacora("Informativo", "Se ha enviado mail de recupero de password usuario con id: " + user.IDUsuario, (int)Session["userID"], Session["_ip"].ToString()));
                    }
                    catch (Exception ex) { }
                }
                else
                {
                    TempData["ErrorNormal"] = Resources.Language.ErrorNormal;
                }
            }
            catch (Exception ex2)
            {
                Nullable<int> idUser = null;
                string ip = "Unknown";
                try
                {
                    idUser = (int)Session["userID"];
                }
                catch (Exception ex) { }
                try
                {
                    ip = Session["_ip"].ToString();
                }
                catch (Exception ex) { }
                try
                {
                    Bita.guardarBitacora(new BIZBitacora("Error", "Error intentar recuperar password", idUser, ip));
                }
                catch (Exception ex) { }

                TempData["ErrorNormal"] = Resources.Language.ErrorNormal;
            }
            return View();
            //return Json(new { status = "", message = result });
        }