Пример #1
0
        protected void btnAplicar_Click(object sender, EventArgs e)
        {
            if (radioIP.Checked)
            {
                if (conZoProduct.VerificarIpExistente(txtValorModificar.Text))
                {
                    if (conZoProduct.VerificarIpExistente(txtNuevoValor.Text))
                    {
                        conZoProduct.ModificarAlteraIp(txtValorModificar.Text, txtNuevoValor.Text, User.Usu_id);

                        lblMensage.Text = "Se realizo el cambio " + txtValorModificar.Text + " -> por " + txtNuevoValor.Text;
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                    }
                    else
                    {
                        lblMensage.Text = "El neumático " + txtNuevoValor.Text + " no existe";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                    }
                }
                else
                {
                    lblMensage.Text = "El neumático " + txtValorModificar.Text + " no existe";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                }
            }
            else
            {
                if (conClientes.VerificarClienteExistente(txtValorModificar.Text))
                {
                    if (conClientes.VerificarClienteExistente(txtNuevoValor.Text))
                    {
                        conClientes.ModificarAlteraCliente(txtValorModificar.Text, txtNuevoValor.Text, User.Usu_id);
                        lblMensage.Text = "Se realizo el cambio " + txtValorModificar.Text + " -> por " + txtNuevoValor.Text;
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                    }
                    else
                    {
                        lblMensage.Text = "El cliente " + txtNuevoValor.Text + " no existe";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                    }
                }
                else
                {
                    lblMensage.Text = "El cliente " + txtValorModificar.Text + " no existe";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                }
            }
        }
Пример #2
0
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            lblCodigo.Text = CODIGO.Value;

            if (!string.IsNullOrEmpty(txtMatriz.Text) && !conClientes.VerificarClienteExistente(txtMatriz.Text))
            {
                lblMensaje2.Text = "Cliente Matriz no existe";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                return;
            }
            if (!string.IsNullOrEmpty(txtRefil.Text) && !conClientes.VerificarClienteExistente(txtRefil.Text))
            {
                lblMensaje2.Text = "Cliente refil no existe";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                return;
            }

            if ((txtLongitud.Text.Length > 0 && txtLatitud.Text.Length == 0) || (txtLatitud.Text.Length > 0 && txtLongitud.Text.Length == 0))
            {
                lblMensaje2.Text = "Si completa la latitud o longitud ambos campos deben estar completados";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                return;
            }

            ArrayList parametos = new ArrayList();

            parametos.Add(CODIGO.Value);
            parametos.Add(txtMatriz.Text);
            parametos.Add(txtRefil.Text);
            parametos.Add(txtRazonSocial.Text);
            parametos.Add(txtDireccion.Text);
            parametos.Add(txtEmail.Text);
            parametos.Add(txtWeb.Text);

            if (txtLatitud.Text.Length > 0)
            {
                parametos.Add(Convert.ToDouble(txtLatitud.Text.Replace(".", ",")));
            }
            else
            {
                parametos.Add(DBNull.Value);
            }
            if (txtLongitud.Text.Length > 0)
            {
                parametos.Add(Convert.ToDouble(txtLongitud.Text.Replace(".", ",")));
            }
            else
            {
                parametos.Add(DBNull.Value);
            }

            parametos.Add(chkBajaLogica.Checked ? '1' : '0');

            conClientes.ModificarAlteraCliente(parametos);

            gvListadoClientes.DataSource = conClientes.ListadoClientes();
            gvListadoClientes.DataBind();

            lblMensaje.Text = "El cliente " + CODIGO.Value + "se ha modificado correctamente";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalMensaje();", true);

            lblMensaje2.Text = string.Empty;
            CODIGO.Value     = "";
        }