private void setEntityCurrent()
        {
            bool rowSelected = SelectedRows.Count > 0;

            if (rowSelected)
            {
                SetControlFromEntity.Execute(EntityCurrent, Parent);
            }

            if (buttonNewEntityInstance != null)
            {
                buttonNewEntityInstance.Enabled = rowSelected;
            }

            if (buttonSaveEntityInstance != null)
            {
                buttonSaveEntityInstance.Enabled = rowSelected;
            }

            if (buttonDeleteEntityInstance != null)
            {
                buttonDeleteEntityInstance.Enabled = rowSelected;
            }

            setControlsToValid();
        }
Example #2
0
        protected override void OnClick(EventArgs e)
        {
            EntityEventArgs entityEventArgs = new EntityEventArgs(null, null);

            OnBeforeClick(entityEventArgs);

            if (entityEventArgs.CancelAction)
            {
                return;
            }

            Type type = typeEntity;

            entityNew = getNewEntity();

            SetControlFromEntity.Execute(entityNew, Parent, true);

            if (buttonSaveEntityInstance != null)
            {
                buttonSaveEntityInstance.Enabled = true;
                Enabled = false;
            }

            entityEventArgs.Entity = entityNew;

            if (!string.IsNullOrEmpty(ButtonSaveEntity) && !string.IsNullOrEmpty(buttonSaveEntityInstance.GridViewEntity))
            {
                buttonSaveEntityInstance.GridViewEntityInstance.ClearSelection();
            }

            refreshButtonDeleteEntity();

            OnAfterClick(entityEventArgs);
        }
        protected override void OnRowEditing(GridViewEditEventArgs e)
        {
            EntityWebEventArgs entityEventArgs = new EntityWebEventArgs(null, null, (IList)null);

            entityEventArgs.EntityManager = entityManagerSourceInstance;

            OnBeforeRowEditing(entityEventArgs);

            if (entityEventArgs != null && entityEventArgs.PageName != string.Empty)
            {
                Page.Response.Redirect(entityEventArgs.PageName + "?" + DataKeyNames[0] + typeEntity.Name + "=" + DataKeys[e.NewEditIndex].Value.ToString());

                return;
            }

            if (entityEventArgs == null)
            {
                return;
            }

            IEntityPersistence entity = getEntitySelecionado(entityEventArgs.EntityManager, e.NewEditIndex, entityEventArgs.ListSource);

            if (entity != null)
            {
                SetControlFromEntity.Execute(entity, Page, true);

                if (entityEventArgs != null)
                {
                    entityEventArgs.Entity = entity;
                }

                SelectedIndex = e.NewEditIndex;

                EntityCurrent = entity;

                if (buttonSaveEntityInstance != null)
                {
                    buttonSaveEntityInstance.Enabled = true;
                }
            }

            if (entityEventArgs == null)
            {
                entityEventArgs = new EntityWebEventArgs(null, entity);
            }

            if (buttonSaveEntityInstance != null)
            {
                buttonSaveEntityInstance.Enabled = true;
            }

            if (buttonNewEntityInstance != null)
            {
                buttonNewEntityInstance.Enabled = true;
            }

            OnAfterRowEditing(entityEventArgs);
        }
        private void gridCliente_Click(object sender, EventArgs e)
        {
            if (gridCliente.SelectedRows.Count > 0)
            {
                cliente = gridCliente.SelectedRows[0].DataBoundItem as Cliente;

                SetControlFromEntity.Execute(cliente, this);
            }
        }
        private void setaNovoCliente()
        {
            cliente = new Cliente();

            SetControlFromEntity.Execute(cliente, this);

            gridCliente.TypeEntity = typeof(Cliente);
            gridCliente.SetDataSource(EntityManagerCliente.Instance.List());
        }
Example #6
0
        protected override void OnClick(EventArgs e)
        {
            EntityWebEventArgs entityEventArgs = new EntityWebEventArgs(null, null);

            OnBeforeClick(entityEventArgs);

            if (entityEventArgs.CancelAction)
            {
                return;
            }

            Type type = typeEntity;

            if (entityEventArgs.PageName != string.Empty)
            {
                HttpContext.Current.Server.Transfer(entityEventArgs.PageName);

                return;
            }

            entityEventArgs.Entity = getNewEntity();

            SetControlFromEntity.Execute(entityEventArgs.Entity, Page, true);

            if (buttonSaveEntityInstance != null)
            {
                buttonSaveEntityInstance.Enabled = true;
                Enabled = false;

                if (buttonSaveEntityInstance.GridViewEntityInstance != null)
                {
                    buttonSaveEntityInstance.GridViewEntityInstance.EntityCurrent = entityEventArgs.Entity;

                    buttonSaveEntityInstance.GridViewEntityInstance.SelectedIndex = -1;
                }
            }

            OnAfterClick(entityEventArgs);
        }