Ejemplo n.º 1
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            var register = new ClientRegister();

            if (dtvClient.CurrentRow == null)
            {
                lblMessage.Text = Messages.Empty;
                return;
            }
            var client = (Client)dtvClient.CurrentRow.DataBoundItem;

            if (0 >= (client.Registration))
            {
                client.Registration = Convert.ToInt32(txtMatricula.Text);
            }
            else if (!ValidateUtil.ValidClient(client))
            {
                lblMessage.Text = Messages.RequiredFields;
            }
            else if (!ValidateUtil.ValidFieldState(client.State.ToUpper()))
            {
                lblMessage.Text = Messages.StateError;
            }
            else
            {
                lblMessage.Text      = register.Edit(client);
                dtvClient.DataSource = RefreshGrid();
                CleanFields();
            }
        }