コード例 #1
0
ファイル: HomeController.cs プロジェクト: juancastingo/TFI
        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);
        }
コード例 #2
0
ファイル: Utils.cs プロジェクト: juancastingo/TFI
        public void sendMail(BIZCorreo pCorreo)
        {
            try
            {
                MailMessage mail = new MailMessage();

                mail.To.Add(pCorreo.To);
                if (pCorreo.cc != null)
                {
                    mail.CC.Add(pCorreo.cc);
                }
                mail.From = new MailAddress("*****@*****.**");
                mail.Subject = pCorreo.Subject;
                mail.Body = pCorreo.Body + "<br><br><hr><span>Atte.</span><br><span><img src='http://iid.somee.com/Content/images/Logo2.png' width='50' height='50'> </span>";

                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
                smtp.Port = 587;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = new System.Net.NetworkCredential
                ("*****@*****.**", "socrates321");// Enter senders User name and password
                smtp.EnableSsl = true;
                smtp.Send(mail);
            }
            catch (Exception ex) {
                //nada
            }
        }
コード例 #3
0
ファイル: AccountController.cs プロジェクト: juancastingo/TFI
        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);
            //}
        }
コード例 #4
0
ファイル: LoginController.cs プロジェクト: juancastingo/TFI
        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 });
        }
コード例 #5
0
ファイル: PedidoController.cs プロジェクト: juancastingo/TFI
        public ActionResult AprobarRechazarPedido(string Pedido, string tipoActualizacion, string justif)
        {
            try
            {

                int IDPedido = int.Parse(Pedido);
                int idUser = (int)Session["userID"];
                int Tstatus = int.Parse(tipoActualizacion);
                int status;
                if (Tstatus == 1)
                {
                    status = 6;
                }
                else
                {
                    status = 22;
                }

                BIZDocumento doc = new BIZDocumento();
                if (justif != "")
                    DocWorker.ActualizarStatusDoc(IDPedido, status, idUser, justif);
                else
                    DocWorker.ActualizarStatusDoc(IDPedido, status, idUser);

                Nullable<int> idU = null;
                string ip = "Unknown";
                try { idU = (int)Session["userID"]; }
                catch (Exception ex) { }
                try { ip = Session["_ip"].ToString(); }
                catch (Exception ex) { }
                string inf = "";
                if (status == 6)
                    inf = "Se ha aprobado el pedido nr ";
                else
                    inf = "Se ha rechazado el pedido nr ";

                //bitacora
                try
                {
                    Bita.guardarBitacora(new BIZBitacora("Informativo", inf + IDPedido, idU, ip));
                }
                catch (Exception ex) { }

                //mail
                var EstePedido = DocWorker.ObtenerDocXID(IDPedido);
                BIZ.BIZCorreo correo = new BIZCorreo();
                correo.Subject = @Language.actualizacion;
                correo.To = EstePedido.ClienteEmpresa.Email;
                correo.cc = EstePedido.Usuario.Email;
                if (status == 6)
                {
                    correo.Body = "<span>" + EstePedido.Usuario.Nombre + ",</span><br><span>" + @Language.pedidoAprobado + IDPedido + @Language.ingreseAct + "</span>";
                }
                else
                {
                    correo.Body = "<span>" + EstePedido.Usuario.Nombre + ",</span><br><span>" + @Language.pedidoRechazado  + IDPedido + @Language.ingreseAct+"</span>";

                }
                util.sendMail(correo);
                TempData["OKNormal"] = Resources.Language.OKNormal;
                return Json(new { Result = "" }, JsonRequestBehavior.AllowGet);

            }
            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 al intentar aprobar/rechazar pedido", idUser, ip));
                }
                catch (Exception ex) { }

                return Json(new { Result = "Error" }, JsonRequestBehavior.AllowGet);
            }
        }
コード例 #6
0
ファイル: PedidoController.cs プロジェクト: juancastingo/TFI
        public ActionResult facturarPedido(string Pedido, string fecha)
        {
            try
            {
                int IDPedido = int.Parse(Pedido);
                int idUser = (int)Session["userID"];
                DateTime FechaFac = DateTime.Parse(fecha);
                BIZDocumento pedido = DocWorker.ObtenerDocXID(IDPedido);

                BIZDocumento factura = new BIZDocumento();
                if (pedido.ClienteEmpresa.TipoIVA.Detalle == "Responsable Inscripto")
                {
                    factura.IDDocumentoTipo = 1; //tipo 1 es factura A.
                }
                else
                {
                    factura.IDDocumentoTipo = 13; // tipo 13 es factura B. Osea != de responsable inscripto. monotributista, exento, no categorizado, no responsable, consumidor final
                }
                factura.FechaEmision = FechaFac;
                factura.FechaUltimaModificacion = DateTime.Now;
                factura.IDClienteEmpresa = pedido.ClienteEmpresa.IDClienteEmpresa;
                factura.IDEstado = 9; //estado generada de factura 9
                factura.IDUsuarioCreacion = idUser;
                factura.IDUsuarioUltimaModificacion = idUser;
                factura.IDEmpresaLocal = 1;
                factura.IDDocumentoRef = IDPedido;
                //factura.NrDocumento = DocWorker.getLastNumberAndUpdate
                BIZDocumentoDetalle detalle;
                foreach (BIZDocumentoDetalle det in pedido.DocumentoDetalle)
                {
                    detalle = new BIZDocumentoDetalle();
                    detalle.Cantidad = det.Cantidad;
                    detalle.IDPrecioDetalle = det.IDPrecioDetalle;
                    factura.DocumentoDetalle.Add(det);
                }
                int IDDocNuevo = DocWorker.GuardarDocumentoFac(factura, pedido);

                //DocWorker.GuardarDocumento(factura);
                //DocWorker.ActualizarStatusDoc(IDPedido, 8, idUser); //8 es cancelado de pedido
                Nullable<int> idU = null;
                string ip = "Unknown";
                try { idU = (int)Session["userID"]; }
                catch (Exception ex) { }
                try { ip = Session["_ip"].ToString(); }
                catch (Exception ex) { }
                try
                {
                    Bita.guardarBitacora(new BIZBitacora("Informativo", "Factura nr#" + IDDocNuevo + " Generada. pedido nr#" + IDPedido, idU, ip));
                }
                catch (Exception ex) { }

                //mail
                BIZ.BIZCorreo correo = new BIZCorreo();
                correo.Subject = @Language.actualizacion;
                correo.To = pedido.ClienteEmpresa.Email;
                correo.cc = pedido.Usuario.Email;
                string link = "<a href='http://" + Request.Url.Host.ToLower() + ":" + Request.Url.Port + "/home/PDFMaker?odwidji32i324mu32u83257fm3209v5m320m392=u32hrwqduwqhdwqudhwqduwqdhwqduhwqudhwqudhwqud32hr32hrhf932hrn928v5u208m3f47&fghjhtyuighj=" + IDDocNuevo +"&32m3204c32094mqwdqwdwqdwqdwqd32=d4023123213213m'>Link</a>";
                string body = String.Format("<span>" + pedido.Usuario.Nombre + ",</span><br><span>" + @Language.facturaInfo + IDPedido + @Language.ingreseFact + link + "</span>");
                correo.Body = body;
                util.sendMail(correo);

                TempData["OKNormal"] = Resources.Language.OKNormal;
                return Json(new { Result = "" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                try
                {
                    Bita.guardarBitacora(new BIZBitacora("Error", "Error al originar la factura", null, null));
                }
                catch { }
                return Json(new { Result = "Error" }, JsonRequestBehavior.AllowGet);
            }
        }