Example #1
0
 public string setAdministrarPosiblesClientesController(Logica.Models.clsPosiblesClientes obclsPosiblesClientesModels, int inOpcion)
 {
     try
     {
         Logica.BL.clsPosiblesClientes obclsPosiblesClientes = new Logica.BL.clsPosiblesClientes();
         return(obclsPosiblesClientes.setAdministrarPosiblesClientes(obclsPosiblesClientesModels, inOpcion));
     }
     catch (Exception ex) { throw ex; }
 }
        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>");
            }
        }
        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";
                    //accede a un control web dentro de un grid
                    txtIdentificacion.Text  = ((Label)gvwDatos.Rows[inIndice].FindControl("lblIdentificacion")).Text;
                    txtEmpresa.Text         = gvwDatos.Rows[inIndice].Cells[1].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[1].Text;
                    txtPrimerNombre.Text    = gvwDatos.Rows[inIndice].Cells[2].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[2].Text;
                    txtSegundoNombre.Text   = gvwDatos.Rows[inIndice].Cells[3].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[3].Text;
                    txtPrimerApellido.Text  = gvwDatos.Rows[inIndice].Cells[4].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[4].Text;
                    txtSegundoApellido.Text = gvwDatos.Rows[inIndice].Cells[5].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[5].Text;
                    txtDireccion.Text       = gvwDatos.Rows[inIndice].Cells[6].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[6].Text;
                    txtTelefono.Text        = gvwDatos.Rows[inIndice].Cells[7].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[7].Text;
                    txtCorreo.Text          = gvwDatos.Rows[inIndice].Cells[8].Text.Equals("&nbsp;") ? string.Empty : gvwDatos.Rows[inIndice].Cells[8].Text;
                }
                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.PosiblesClientesController obPosiblesClientesController = new Controllers.PosiblesClientesController();

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

                    lblOpcion.Text = string.Empty;
                    getPosiblesClientes();
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script> swal('Error!', '" + ex.Message + "!', 'error') </script>");
            }
        }
        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>");
            }
        }
Example #5
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string stMensaje = string.Empty;
                if (string.IsNullOrEmpty(txtIdentificacion.Text))
                {
                    stMensaje += "Ingrese identificacion,";
                }
                if (!string.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

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

                Controllers.PosiblesClientesController obposiblesClientesController = new Controllers.PosiblesClientesController();

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

                ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> alert('" + obposiblesClientesController.setAdministrarPosiblesClientesControllet(obclsPosiblesClientes, Convert.ToInt32(lblOpcion.Text)) + "')</script>");
                lblOpcion.Text = txtIdentificacion.Text = txtEmpresa.Text = txtPrimerNombre.Text = txtSegundoNombre.Text = txtPrimerApellido.Text = txtSegundoApellido.Text = txtDireccion.Text = txtTelefono.Text = txtCorreo.Text = string.Empty;

                getPosiblesClientes();
            }
            catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> alert('" + ex.Message + "')</script>"); }
        }
Example #6
0
        /// <summary>
        /// ADMINISTRAR POSIBLES CLIENTES
        /// </summary>
        /// <param name="obclsPosiblesClientes">OBJETO</param>
        /// <param name="inOpcion">OPCION DE EJECUCION</param>
        /// <returns>MENSAJE DE OPERACION</returns>
        public string getAdministrarPosiblesClientes(Logica.Models.clsPosiblesClientes obclsPosiblesClientes,
                                                     int inOpcion)
        {
            try
            {
                _SqlConnection = new SqlConnection(stConexion);
                _SqlConnection.Open();

                _SqlCommand             = new SqlCommand("spAdministrarPosiblesClientes", _SqlConnection);
                _SqlCommand.CommandType = CommandType.StoredProcedure;

                _SqlCommand.Parameters.Add(new SqlParameter("@nIdentificacion", obclsPosiblesClientes.lnIdentificacion));
                _SqlCommand.Parameters.Add(new SqlParameter("@cEmpresa", obclsPosiblesClientes.stEmpresa));
                _SqlCommand.Parameters.Add(new SqlParameter("@cPrimerNombre", obclsPosiblesClientes.stPrimerNombre));
                _SqlCommand.Parameters.Add(new SqlParameter("@cSegundoNombre", obclsPosiblesClientes.stSegundoNombre));
                _SqlCommand.Parameters.Add(new SqlParameter("@cPrimerApellido", obclsPosiblesClientes.stPrimerApellido));
                _SqlCommand.Parameters.Add(new SqlParameter("@cSegundoApellido", obclsPosiblesClientes.stSegundoApellido));
                _SqlCommand.Parameters.Add(new SqlParameter("@cDireccion", obclsPosiblesClientes.stDireccion));
                _SqlCommand.Parameters.Add(new SqlParameter("@cTelefono", obclsPosiblesClientes.stTelefono));
                _SqlCommand.Parameters.Add(new SqlParameter("@cCorreo", obclsPosiblesClientes.stCorreo));
                _SqlCommand.Parameters.Add(new SqlParameter("@nOpcion", inOpcion));

                _SqlParameter = new SqlParameter();
                _SqlParameter.ParameterName = "@cMensaje";
                _SqlParameter.Direction     = ParameterDirection.Output;
                _SqlParameter.SqlDbType     = SqlDbType.VarChar;
                _SqlParameter.Size          = 50;

                _SqlCommand.Parameters.Add(_SqlParameter);
                _SqlCommand.ExecuteNonQuery();

                return(_SqlParameter.Value.ToString());
            }
            catch (Exception ex) { throw ex; }
            finally { _SqlCommand.Clone(); }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string stMensaje = string.Empty;
                if (string.IsNullOrEmpty(txtCodigo.Text))
                {
                    stMensaje += "Ingresa Codigo,";
                }
                if (!string.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                Logica.Models.clsPosiblesClientes obclsPosiblesClientes = new Logica.Models.clsPosiblesClientes
                {
                    lnCodigo           = Convert.ToInt64(txtCodigo.Text),
                    stEmpresa          = txtempresa.Text,
                    stNombre           = txtNombre.Text,
                    stApellidos        = txtApellidos.Text,
                    stTitulo           = txtTitulo.Text,
                    stCorreElectronico = txtcorreo.Text,
                    stTelefono         = txtTelefono.Text,
                    stFax      = txtFax.Text,
                    stMovil    = txtMovil.Text,
                    stSitioWeb = txtSitio.Text,
                    obclsFuentePosibleCliente = new Logica.Models.clsFuentePosibleCliente()
                    {
                        stDescripcion = ddlFuente.Text
                    },
                    obclsEstadoPosibleCliente = new Logica.Models.clsEstadoPosibleCliente()
                    {
                        stDescripcion = ddlEstado.Text
                    },
                    obclsSectorPosibleCliente = new Logica.Models.clsSectorPosibleCliente()
                    {
                        stDescripcion = ddlSector.Text
                    },
                    inCantidad = Convert.ToInt32(txtCantidad.Text),
                    flIngresos = Convert.ToInt64(txtingresos.Text),
                    obclsCalificacionPosibleCliente = new Logica.Models.clsCalificacionPosibleCliente()
                    {
                        stDescripcion = ddlCalificacion.Text
                    },
                    stIdSkype         = txtIdSkype.Text,
                    stTwitter         = txtTwitter.Text,
                    stCorreoSecundrio = txtCorreoSecundario.Text
                };

                Controllers.PosiblesClientesController obPosiblesClientesController = new Controllers.PosiblesClientesController();

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

                ClientScript.RegisterStartupScript(GetType(), "mensaje", "<script> alert('" + obPosiblesClientesController.setAdministrarPosiblesClientesController(obclsPosiblesClientes, Convert.ToInt32(lblOpcion.Text)) + "') </script>");
                lblOpcion.Text = txtCodigo.Text = txtempresa.Text = txtNombre.Text = txtApellidos.Text = txtTitulo.Text = txtcorreo.Text
                                                                                                                              = txtTelefono.Text = txtFax.Text = txtMovil.Text = txtSitio.Text = ddlFuente.Text = ddlEstado.Text = ddlSector.Text
                                                                                                                                                                                                                                       = txtCantidad.Text = txtingresos.Text = ddlCalificacion.Text = txtIdSkype.Text = txtTwitter.Text = txtCorreoSecundario.Text = string.Empty;
                getPosiblesClientes();
            }
            catch (Exception ex) { ClientScript.RegisterStartupScript(GetType(), "mensaje", "<script> alert('" + ex.Message + "') </script>"); }
        }
        protected void gvrDatos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                int inIndice = Convert.ToInt32(e.CommandArgument);
                if (e.CommandName.Equals("Editar"))
                {
                    lblOpcion.Text = "2";

                    txtCodigo.Text           = ((Label)gvrDatos.Rows[inIndice].FindControl("lblCodigo")).Text;
                    txtempresa.Text          = gvrDatos.Rows[inIndice].Cells[1].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[1].Text;
                    txtNombre.Text           = gvrDatos.Rows[inIndice].Cells[2].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[2].Text;
                    txtApellidos.Text        = gvrDatos.Rows[inIndice].Cells[3].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[3].Text;
                    txtTitulo.Text           = gvrDatos.Rows[inIndice].Cells[4].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[4].Text;
                    txtcorreo.Text           = gvrDatos.Rows[inIndice].Cells[5].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[5].Text;
                    txtTelefono.Text         = gvrDatos.Rows[inIndice].Cells[6].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[6].Text;
                    txtFax.Text              = gvrDatos.Rows[inIndice].Cells[7].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[7].Text;
                    txtMovil.Text            = gvrDatos.Rows[inIndice].Cells[8].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[8].Text;
                    txtSitio.Text            = gvrDatos.Rows[inIndice].Cells[9].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[9].Text;
                    ddlFuente.Text           = gvrDatos.Rows[inIndice].Cells[10].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[10].Text;
                    ddlEstado.Text           = gvrDatos.Rows[inIndice].Cells[11].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[11].Text;
                    ddlSector.Text           = gvrDatos.Rows[inIndice].Cells[12].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[12].Text;
                    txtCantidad.Text         = gvrDatos.Rows[inIndice].Cells[13].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[13].Text;
                    txtingresos.Text         = gvrDatos.Rows[inIndice].Cells[14].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[14].Text;
                    ddlCalificacion.Text     = gvrDatos.Rows[inIndice].Cells[15].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[15].Text;
                    txtIdSkype.Text          = gvrDatos.Rows[inIndice].Cells[16].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[16].Text;
                    txtTwitter.Text          = gvrDatos.Rows[inIndice].Cells[17].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[17].Text;
                    txtCorreoSecundario.Text = gvrDatos.Rows[inIndice].Cells[18].Text.Equals("&nbsp;") ? string.Empty : gvrDatos.Rows[inIndice].Cells[18].Text;
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    lblOpcion.Text = "3";

                    Logica.Models.clsPosiblesClientes obclsPosiblesClientes = new Logica.Models.clsPosiblesClientes
                    {
                        lnCodigo           = Convert.ToInt64(((Label)gvrDatos.Rows[inIndice].FindControl("lblCodigo")).Text),
                        stEmpresa          = string.Empty,
                        stNombre           = string.Empty,
                        stApellidos        = string.Empty,
                        stTitulo           = string.Empty,
                        stCorreElectronico = string.Empty,
                        stTelefono         = string.Empty,
                        stFax      = string.Empty,
                        stMovil    = string.Empty,
                        stSitioWeb = string.Empty,
                        obclsFuentePosibleCliente = new Logica.Models.clsFuentePosibleCliente()
                        {
                            stDescripcion = ddlFuente.Text
                        },
                        obclsEstadoPosibleCliente = new Logica.Models.clsEstadoPosibleCliente()
                        {
                            stDescripcion = ddlEstado.Text
                        },
                        obclsSectorPosibleCliente = new Logica.Models.clsSectorPosibleCliente()
                        {
                            stDescripcion = ddlSector.Text
                        },
                        inCantidad = Convert.ToInt32(string.Empty),
                        flIngresos = Convert.ToInt64(string.Empty),
                        obclsCalificacionPosibleCliente = new Logica.Models.clsCalificacionPosibleCliente()
                        {
                            stDescripcion = ddlCalificacion.Text
                        },
                        stIdSkype         = string.Empty,
                        stTwitter         = string.Empty,
                        stCorreoSecundrio = string.Empty
                    };

                    Controllers.PosiblesClientesController obPosiblesClientesController = new Controllers.PosiblesClientesController();


                    ClientScript.RegisterStartupScript(GetType(), "mensaje", "<script> alert('" + obPosiblesClientesController.setAdministrarPosiblesClientesController(obclsPosiblesClientes, Convert.ToInt32(lblOpcion.Text)) + "') </script>");
                    lblOpcion.Text = string.Empty;

                    getPosiblesClientes();
                }
            }catch (Exception ex) { ClientScript.RegisterStartupScript(GetType(), "mensaje", "<script> alert('" + ex.Message + "') </script>"); }
        }