Ejemplo n.º 1
0
        private void OnCommit(DBItemEventArgs arg)
        {
            var item = arg.Item;

            if (!(item is UserReg) && !(item is DBLogItem) && item.Table.Type == DBTableType.Table && item.Table.IsLoging)
            {
                var type = DBLogType.None;
                if ((arg.State & DBUpdateState.Delete) == DBUpdateState.Delete)
                {
                    type = DBLogType.Delete;
                }
                else if ((arg.State & DBUpdateState.Insert) == DBUpdateState.Insert)
                {
                    type = DBLogType.Insert;
                }
                else
                {
                    type = DBLogType.Update;
                }
                buffer.Add(new NotifyMessageItem()
                {
                    Table  = item.Table,
                    ItemId = item.PrimaryId,
                    Type   = type,
                    UserId = arg.User?.Id ?? 0
                });
            }
        }
Ejemplo n.º 2
0
 private async void OnRowUpdated(object sender, DBItemEventArgs arg)
 {
     if (User != null && arg.Item.PrimaryId.Equals(User.Id))
     {
         if (arg.Columns != null && arg.Columns.Contains(User.DBTable.ParseProperty(nameof(User.Password))))
         {
             await UserReg.LogUser(User, UserRegType.Password, "Temporary Password");
         }
     }
 }
Ejemplo n.º 3
0
 private async void FlowEnvirRowLoged(object sender, DBItemEventArgs e)
 {
     if (e.Item == userGroup && changes.Count > 0)
     {
         e.Transaction.UserLog = sender as UserReg;
         foreach (var item in changes)
         {
             if (item != userGroup)
             {
                 await item.Save(GuiEnvironment.User);
             }
         }
         changes.Clear();
     }
 }
Ejemplo n.º 4
0
        public static async void OnDBItemLoging(DBItemEventArgs arg)
        {
            if (arg.Item.Table == UserReg.DBTable || arg.Item.Table is IDBLogTable)
            {
                return;
            }
            var user = arg.User as User;

            RowLoging?.Invoke(null, arg);
            if (user != null && user.LogStart == null)
            {
                await Common.User.StartSession(user);
            }
            var userLog = user?.LogStart;

            if (LogStrategy == UserRegStrategy.ByTransaction)
            {
                if (arg.Transaction != null)
                {
                    if (arg.Transaction.UserLog == null)
                    {
                        arg.Transaction.UserLog = new UserReg {
                            User = user, Parent = userLog, RegType = UserRegType.Transaction
                        };
                        await arg.Transaction.UserLog.Save(arg.Transaction);
                    }
                    userLog = (UserReg)arg.Transaction.UserLog;
                }
            }
            else if (LogStrategy == UserRegStrategy.ByItem)
            {
                userLog = new UserReg {
                    User = user, Parent = userLog, RegType = UserRegType.Transaction
                };
                await userLog.Save(arg.Transaction);
            }
            if (arg.LogItem != null)
            {
                arg.LogItem.UserReg = userLog;
            }
            RowLoged?.Invoke(null, arg);
        }
Ejemplo n.º 5
0
        public static void OnDBRowChanged(DBItemEventArgs arg)
        {
            if (arg.Item.Table == UserReg.DBTable) //|| arg.Row.Table == FlowEnvir.Config.Document.Table)
            {
                return;
            }

            if (!(arg.Item.Table is IDBVirtualTable))
            {
                var cols = arg.Item.Table.Columns.GetByReference(Document.DBTable);

                foreach (DBColumn col in cols)
                {
                    var document = arg.Item.GetReference <Document>(col, DBLoadParam.None);
                    if (document != null)
                    {
                        document.OnReferenceChanged(arg.Item);
                    }
                }
            }
        }