Ejemplo n.º 1
0
 public void setEmailController(Logica.Models.clsCorreo obclsCorreo)
 {
     try
     {
         Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
         obclsGeneral.setEmail(obclsCorreo);
     }
     catch (Exception ex) { throw ex; }
 }
Ejemplo n.º 2
0
        protected void gvwDatos_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            try
            {
                int inIndice = Convert.ToInt32(e.CommandArgument);

                if (e.CommandName.Equals("Editar"))
                {
                    lblOpcion.Text            = "2";
                    txtIdentificacion.Enabled = false;

                    //ACCEDE A UN CONTROL WEB DENTRO DE UN GRID
                    txtIdentificacion.Text = ((Label)gvwDatos.Rows[inIndice].FindControl("lblIdentificacion")).Text;

                    //ACCEDE A UNA CELDE DENTRO DE UN GRID
                    txtEmpresa.Text         = gvwDatos.Rows[inIndice].Cells[1].Text.Replace(" ", "");
                    txtPrimerNombre.Text    = gvwDatos.Rows[inIndice].Cells[2].Text.Replace(" ", "");
                    txtSegundoNombre.Text   = gvwDatos.Rows[inIndice].Cells[3].Text.Replace(" ", "");
                    txtPrimerApellido.Text  = gvwDatos.Rows[inIndice].Cells[4].Text.Replace(" ", "");
                    txtSegundoApellido.Text = gvwDatos.Rows[inIndice].Cells[5].Text.Replace(" ", "");
                    txtDirecion.Text        = gvwDatos.Rows[inIndice].Cells[6].Text.Replace(" ", "");
                    txtTelefono.Text        = gvwDatos.Rows[inIndice].Cells[7].Text.Replace(" ", "");
                    txtCorreo.Text          = gvwDatos.Rows[inIndice].Cells[8].Text.Replace(" ", "");
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    lblOpcion.Text = "3";

                    Logica.Models.clsPosiblesClientes obclsPosiblesClientes = new Logica.Models.clsPosiblesClientes
                    {
                        lnIdentificacion  = Convert.ToInt64(((Label)gvwDatos.Rows[inIndice].FindControl("lblIdentificacion")).Text),
                        stEmpresa         = string.Empty,
                        stPrimerNombre    = string.Empty,
                        stSegundoNombre   = string.Empty,
                        stPrimerApellido  = string.Empty,
                        stSegundoApellido = string.Empty,
                        stDireccion       = string.Empty,
                        stTelefono        = string.Empty,
                        stCorreo          = string.Empty
                    };

                    Controllers.PosiblesClientesControllers obposiblesClientesControllers = new Controllers.PosiblesClientesControllers();

                    ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Mensaje!', '" + obposiblesClientesControllers.setAdministrarPosiblesClientesController(obclsPosiblesClientes, Convert.ToInt32(lblOpcion.Text)) + "', 'success')</script>");

                    getPosiblesClientess();
                    LimpiaCampos();
                    txtIdentificacion.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 3
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string stMensaje = string.Empty;
                if (string.IsNullOrEmpty(txtCodigo.Text))
                {
                    stMensaje += "Ingrese codigo, ";
                }

                if (!string.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                Logica.Models.clsTareas obclsTareas = new Logica.Models.clsTareas
                {
                    inCodigo           = Convert.ToInt32(txtCodigo.Text),
                    stTitular          = txtTitularTarea.Text,
                    stAsunto           = txtAsunto.Text,
                    stFechaVencimiento = txtFechaVencimiento.Text,
                    stContacto         = txtContacto.Text,
                    stCuenta           = txtCuenta.Text,
                    obclsEstadoTareas  = new Logica.Models.clsEstadoTareas
                    {
                        inCodigo = Convert.ToInt32(ddlEstadoTarea.SelectedValue),
                    },
                    obclsPrioridad = new Logica.Models.clsPrioridad
                    {
                        inCodigo = Convert.ToInt32(ddlPrioridad.SelectedValue)
                    },
                    stEnviarMensaje = chkEnviarMensaje.Checked ? "S" : "N",
                    stRepetir       = chkRepetir.Checked ? "S" : "N",
                    stDescripcion   = txtDescripcion.Text
                };

                Controllers.TareasControllers obTareasControllers = new Controllers.TareasControllers();
                if (string.IsNullOrEmpty(lblOpcion.Text))//adicionar
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Mensaje!', '" + obTareasControllers.addTareasController(obclsTareas) + "', 'success')</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Mensaje','" + obTareasControllers.updateTareasController(obclsTareas) + "','success') </script>");
                }
                LimpiarCampos();
                getTareas();
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 4
0
 protected void btnCancelar_Click(object sender, EventArgs e)
 {
     try
     {
         LimpiaCampos();
     }
     catch (Exception ex)
     {
         Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
         string stError = obclsGeneral.Log(ex.Message.ToString());
         ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
     }
 }
Ejemplo n.º 5
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string stMensaje = string.Empty;

                if (string.IsNullOrEmpty(txtIdentificacion.Text))
                {
                    stMensaje += "Ingrese identificación, ";
                }

                if (!string.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                Logica.Models.clsPosiblesClientes obclsPosiblesClientes = new Logica.Models.clsPosiblesClientes
                {
                    lnIdentificacion  = Convert.ToInt64(txtIdentificacion.Text),
                    stEmpresa         = txtEmpresa.Text,
                    stPrimerNombre    = txtPrimerNombre.Text,
                    stSegundoNombre   = txtSegundoNombre.Text,
                    stPrimerApellido  = txtPrimerApellido.Text,
                    stSegundoApellido = txtSegundoApellido.Text,
                    stDireccion       = txtDirecion.Text,
                    stTelefono        = txtTelefono.Text,
                    stCorreo          = txtCorreo.Text
                };

                Controllers.PosiblesClientesControllers obposiblesClientesControllers = new Controllers.PosiblesClientesControllers();

                if (string.IsNullOrEmpty(lblOpcion.Text))
                {
                    lblOpcion.Text = "1";
                }

                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Mensaje!', '" + obposiblesClientesControllers.setAdministrarPosiblesClientesController(obclsPosiblesClientes, Convert.ToInt32(lblOpcion.Text)) + "', 'success')</script>");

                getPosiblesClientess();
                LimpiaCampos();
                txtIdentificacion.Enabled = true;
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 6
0
        protected void gvwDatos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                int inIndice = Convert.ToInt32(e.CommandArgument);

                if (e.CommandName.Equals("Editar"))
                {
                    lblOpcion.Text    = "2";
                    txtCodigo.Enabled = false;

                    //ACCEDE A UN CONTROL WEB DENTRO DE UN GRID
                    txtCodigo.Text = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text;

                    //ACCEDE A UNA CELDE DENTRO DE UN GRID
                    txtTitularTarea.Text         = gvwDatos.Rows[inIndice].Cells[1].Text.Replace("&nbsp;", "");
                    txtAsunto.Text               = gvwDatos.Rows[inIndice].Cells[2].Text.Replace("&nbsp;", "");
                    txtFechaVencimiento.Text     = gvwDatos.Rows[inIndice].Cells[3].Text.Replace("&nbsp;", "");
                    txtContacto.Text             = gvwDatos.Rows[inIndice].Cells[4].Text.Replace("&nbsp;", "");
                    txtCuenta.Text               = gvwDatos.Rows[inIndice].Cells[5].Text.Replace("&nbsp;", "");
                    ddlEstadoTarea.SelectedValue = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigoEstadoTarea")).Text;
                    ddlPrioridad.SelectedValue   = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigoPrioridad")).Text;
                    chkEnviarMensaje.Checked     = gvwDatos.Rows[inIndice].Cells[8].Text.Equals("S") ? true : false;
                    chkRepetir.Checked           = gvwDatos.Rows[inIndice].Cells[9].Text.Equals("S") ? true : false;
                    txtDescripcion.Text          = gvwDatos.Rows[inIndice].Cells[10].Text.Replace("&nbsp;", "");
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    Logica.Models.clsTareas obclsTareas = new Logica.Models.clsTareas
                    {
                        inCodigo = Convert.ToInt32(((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text)
                    };

                    Controllers.TareasControllers obTareasControllers = new Controllers.TareasControllers();
                    ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Mensaje!', '" + obTareasControllers.deleteTareasController(obclsTareas) + "', 'success')</script>");

                    LimpiarCampos();
                    getTareas();
                    txtCodigo.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 7
0
        protected void btnCrear_Click(object sender, EventArgs e)
        {
            try
            {
                //validamos la seleccion de una imagen
                if (fulImagen.HasFile)
                {
                    if (!Path.GetExtension(fulImagen.FileName).Equals(".jpg"))
                    {
                        throw new Exception("Solo se admiten formatos .JPG");
                    }

                    //guardo imagen en carpeta temporal
                    string stRuta = Server.MapPath(@"~\tmp\") + fulImagen.FileName;                                              //ruta temporal
                    fulImagen.PostedFile.SaveAs(stRuta);                                                                         //guardo el archivo dentro del proyecto

                    string stRutaDestino = Server.MapPath(@"~\Images\") + txtLogin.Text + Path.GetExtension(fulImagen.FileName); //ruta destino + nombre archivo + extension

                    if (File.Exists(stRutaDestino))
                    {
                        File.SetAttributes(stRutaDestino, FileAttributes.Normal);
                        File.Delete(stRutaDestino);
                    }

                    File.Copy(stRuta, stRutaDestino);
                    File.SetAttributes(stRuta, FileAttributes.Normal);
                    File.Delete(stRuta);

                    Logica.Models.clsUsuarios obclsUsuarios = new Logica.Models.clsUsuarios
                    {
                        stLogin    = txtLogin.Text,
                        stPassword = txtPassword.Text,
                        stImagen   = stRutaDestino
                    };

                    Controllers.CrearCuentaController obCrearCuentaController = new Controllers.CrearCuentaController();
                    ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script> swal('Mensaje!', '" + obCrearCuentaController.setCrearCuentaController(obclsUsuarios, 1) + "', 'success') </script>");
                    LimpiarCampos();
                }
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// OBTIENE CONSULTA TODAS LAS TAREAS
        /// </summary>
        void getTareas()
        {
            try
            {
                Controllers.TareasControllers  obTareasControllers = new Controllers.TareasControllers();
                List <Logica.Models.clsTareas> lstclsTareas        = obTareasControllers.getTareasController();

                if (lstclsTareas.Count > 0)
                {
                    gvwDatos.DataSource = lstclsTareas;
                }
                else
                {
                    gvwDatos.DataSource = null;
                }
                gvwDatos.DataBind();
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 9
0
        void getEventosXML()
        {
            try
            {
                Controllers.EventosController obEventosController = new Controllers.EventosController();
                var lstclsEventos = obEventosController.getEventosXMLController();

                if (lstclsEventos != null)
                {
                    gvwDatosXML.DataSource = lstclsEventos;
                }
                else
                {
                    gvwDatosXML.DataSource = null;
                }
                gvwDatosXML.DataBind();
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 10
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string stMensaje = string.Empty;
                if (string.IsNullOrEmpty(txtEmail.Text))
                {
                    stMensaje += "Ingrese email, ";
                }
                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    stMensaje += " Ingrese password,";
                }

                if (!string.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                //Defino objeto con propiedades
                Logica.Models.clsUsuarios obclsUsuarios = new Logica.Models.clsUsuarios
                {
                    stLogin    = txtEmail.Text,
                    stPassword = txtPassword.Text
                };

                //Instalcio controlador
                Controllers.LoginControllers obloginController = new Controllers.LoginControllers();
                bool blBandera = obloginController.getValidarUsuariosController(obclsUsuarios);

                //Valido respuesta
                if (blBandera)
                {
                    Session["sessionEmail"] = txtEmail.Text;

                    if (chkRecordar.Checked)
                    {
                        //creo un objetocookie
                        HttpCookie cookie = new HttpCookie("cookieEmail", txtEmail.Text);
                        //adicciono el tiempo de vida
                        cookie.Expires = DateTime.Now.AddDays(2);
                        //agrego a la coleccion de cookies
                        Response.Cookies.Add(cookie);
                    }
                    else
                    {
                        HttpCookie cookie = new HttpCookie("cookieEmail", txtEmail.Text);
                        //la cookie expira el dia de ayer
                        cookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(cookie);
                    }

                    Response.Redirect("../Index/Index.aspx");
                }
                else
                {
                    throw new Exception("Email o Password incorrecto");
                }
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Ejemplo n.º 11
0
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                string stMensaje = string.Empty;
                if (string.IsNullOrEmpty(txtEmail.Text))
                {
                    stMensaje += "Ingrese email";
                }

                if (!string.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                //armo obojeto de tipo obclsUsuarios
                Controllers.RecuperarPasswordControllers obRecuperarPasswordControllers = new Controllers.RecuperarPasswordControllers();
                Logica.Models.clsUsuarios obclsUsuarios = new Logica.Models.clsUsuarios
                {
                    stLogin = txtEmail.Text
                };

                //envio el objeto obclsUsuarios como parametro de consultar
                DataSet dsConsulta = obRecuperarPasswordControllers.getConsultaPaswordController(obclsUsuarios);

                //valido si la consulta devuelve informacion
                if (dsConsulta.Tables[0].Rows.Count > 0)
                {
                    //capturo el nombre del usuario
                    string[] stLogin = dsConsulta.Tables[0].Rows[0]["usuaLogin"].ToString().Split('@');

                    //armo el cuerpo del correo
                    string stCuerpoHTML = "<!DOCTYPE html>";
                    stCuerpoHTML += "<html lang='es'>";
                    stCuerpoHTML += "<head>";
                    stCuerpoHTML += "<meta charset='utf - 8'>";
                    stCuerpoHTML += "<title>Recuperacion de correo</title>";
                    stCuerpoHTML += "</head>";
                    stCuerpoHTML += "<body style='background - color: black '>";
                    stCuerpoHTML += "<table style='max - width: 600px; padding: 10px; margin: 0 auto; border - collapse: collapse; '>	";
                    stCuerpoHTML += "<tr>";
                    stCuerpoHTML += "<td style='padding: 0'>";
                    stCuerpoHTML += "<img style='padding: 0; display: block' src='cid:Fondo' width='100%' height='10%'>";
                    stCuerpoHTML += "</td>";
                    stCuerpoHTML += "</tr>";
                    stCuerpoHTML += "<tr>";
                    stCuerpoHTML += "<td style='background - color: #ecf0f1'>";
                    stCuerpoHTML += "<div style='color: #34495e; margin: 4% 10% 2%; text-align: justify;font-family: sans-serif'>";
                    stCuerpoHTML += "<h2 style='color: #e67e22; margin: 0 0 7px'>Hola " + stLogin[0] + "</h2>";
                    stCuerpoHTML += "<p style='margin: 2px; font - size: 15px'>";
                    stCuerpoHTML += "Hemos recibido una solicitud para restablecer el password de su cuenta asociada con ";
                    stCuerpoHTML += "esta dirección de correo electrónico. Si no ha realizado esta solicitud, puede ignorar este ";
                    stCuerpoHTML += "correo electrónico y le garantizamos que su cuenta es completamente segura.";
                    stCuerpoHTML += "<br/>";
                    stCuerpoHTML += "<br/>";
                    stCuerpoHTML += "Su password es: " + dsConsulta.Tables[0].Rows[0]["usuaPassword"].ToString();
                    stCuerpoHTML += "</p>";
                    stCuerpoHTML += "<p style='color: #b3b3b3; font-size: 12px; text-align: center;margin: 30px 0 0'>Copyright © CRM 2020</p>";
                    stCuerpoHTML += "</div>";
                    stCuerpoHTML += "</td>";
                    stCuerpoHTML += "</tr>";
                    stCuerpoHTML += "</table>";
                    stCuerpoHTML += "</body>";
                    stCuerpoHTML += "</html>";

                    //armo el objeto de tipo obclsCorreo
                    Logica.Models.clsCorreo obclsCorreo = new Logica.Models.clsCorreo
                    {
                        stServidor        = ConfigurationManager.AppSettings["stServidor"].ToString(),
                        stUsuario         = ConfigurationManager.AppSettings["stUsuario"].ToString(),
                        stPassword        = ConfigurationManager.AppSettings["stPassword"].ToString(),
                        stPuerto          = ConfigurationManager.AppSettings["stPuerto"].ToString(),
                        blAutenticacion   = true,
                        bolConexionSegura = true,
                        inPrioridad       = 0, //prioridad normal
                        inTipo            = 1, //html
                        stAsunto          = "Recuperacion de password",
                        stFrom            = ConfigurationManager.AppSettings["stUsuario"].ToString(),
                        stTo       = txtEmail.Text,
                        stImagen   = Server.MapPath("~") + @"\Resources\Images\Fondo.gif",
                        stIdImagen = "Fondo",
                        stMensaje  = stCuerpoHTML
                    };

                    //envio el objeto de tipo obclsCorreo para el envio de correo
                    obRecuperarPasswordControllers.setEmailController(obclsCorreo);
                    txtEmail.Text = string.Empty;
                    ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script> swal('Mensaje!', 'Se realizo proceso con exito!', 'success') </script>");
                }
                else
                {
                    throw new Exception("No se encontro informacion asociada a esa direccion de correo");
                }
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }