Beispiel #1
0
        protected void btnChangeNumber_OnClick(object sender, EventArgs e)
        {
            try
            {
                Button btn = (Button)sender;
                switch (btn.CommandArgument)
                {
                case "0":
                    txtNumeroEdit.ReadOnly = false;
                    btn.CssClass           = "btn btn-sm btn-success";
                    btn.Text                    = "Aceptar";
                    btn.CommandArgument         = "1";
                    btnSendNotification.Enabled = false;
                    break;

                case "1":
                    _servicioUsuarios.ActualizarTelefono(int.Parse(lblIdUsuario.Text), int.Parse(lblId.Text), txtNumeroEdit.Text);
                    txtNumeroEdit.ReadOnly = true;
                    btn.CssClass           = "btn btn-sm btn-primary";
                    btn.Text                    = "Cambiar Numero";
                    btn.CommandArgument         = "0";
                    btnSendNotification.Enabled = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                if (_lstError == null)
                {
                    _lstError = new List <string>();
                }
                _lstError.Add(ex.Message);
                AlertaGeneral = _lstError;
            }
        }
Beispiel #2
0
        protected void btnChangeNumber_OnClick(object sender, EventArgs e)
        {
            try
            {
                Button       btn       = (Button)sender;
                RepeaterItem item      = ((RepeaterItem)btn.NamingContainer);
                TextBox      txtNumero = (TextBox)item.FindControl("txtNumeroEdit");
                Button       btnSend   = (Button)item.FindControl("btnSendNotification");
                switch (btn.CommandArgument)
                {
                case "0":
                    txtNumero.ReadOnly  = false;
                    btn.CssClass        = "btn btn-sm btn-success";
                    btn.Text            = "Aceptar";
                    btn.CommandArgument = "1";
                    btnSend.Enabled     = false;
                    break;

                case "1":
                    Label lblId        = (Label)item.FindControl("lblId");
                    Label lblIdUsuario = (Label)item.FindControl("lblIdUsuario");
                    _servicioUsuarios.ActualizarTelefono(int.Parse(lblIdUsuario.Text), int.Parse(lblId.Text), txtNumero.Text);
                    txtNumero.ReadOnly  = true;
                    btn.CssClass        = "btn btn-sm btn-primary";
                    btn.Text            = "Cambiar Numero";
                    btn.CommandArgument = "0";
                    btnSend.Enabled     = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                if (_lstError == null)
                {
                    _lstError = new List <string>();
                }
                _lstError.Add(ex.Message);
                AlertaGeneral = _lstError;
            }
        }