Ejemplo n.º 1
0
        /// <summary>
        /// Executa ao iniciar o Form
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                foreach (var groupUser in GlobalUser.User.GroupUsers)
                {
                    foreach (var groupPermission in groupUser.GroupAccess.GroupPermissions)
                    {
                        if (groupPermission.Permission.TypeComponent != TypeComponent.Screen)
                        {
                            continue;
                        }
                        if (groupPermission.Permission.NamePermission != Name)
                        {
                            continue;
                        }
                        if (groupPermission.Permission.Visible)
                        {
                            continue;
                        }
                        MessageBox.Show(@"Você não tem acesso a está tela", @"ESR Softwares", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        StateForm = StateForm.Waiting;
                        Close();
                    }
                }

                var text = "ESR Softwares";

                text = GetAttribute <DisplayNameAttribute>()?.DisplayName ?? Name;

                if (!GlobalUser.Forms.Any(t => t.TableName == Name))
                {
                    var table = new Domain.Catalog.Table()
                    {
                        Status          = Status.Confirmed,
                        TableName       = Name,
                        DescriptionForm = text
                    };
                    _tableApp.InsertOrUpdate(table);
                    if (FactoryConnection.Save())
                    {
                        GlobalUser.Forms.Add(table);
                    }
                }

                Text = text;

                RefreshControls();
            }
            catch (Exception)
            {
            }
            base.OnLoad(e);
        }
Ejemplo n.º 2
0
 public bool Save(Table Table)
 {
     _TableApp.InsertOrUpdate(Table);
     return(_connection.Save());
 }