Пример #1
0
        private void Bind()
        {
            List <Framework.DataManager.RbacLog> logs = Rbac.GetLogs(false);

            foreach (Framework.DataManager.RbacLog log in logs)
            {
                ListViewItem item = new ListViewItem(log.DateTime.ToString());
                item.SubItems.Add(log.Query);
                item.SubItems.Add(log.ParsedQuery);
                item.SubItems.Add(log.Errors);
                item.SubItems.Add(log.RbacRole.Name);
                item.SubItems.Add(log.RbacUser.UserName);
                item.SubItems.Add(GetTotalTime(log).ToString());
                if (log.ElapsedTimeParseQuery != null)
                {
                    item.SubItems.Add(TimeSpan.FromTicks((long)log.ElapsedTimeParseQuery).ToString());
                }
                else
                {
                    item.SubItems.Add(string.Empty);
                }

                if (log.ElapsedTimeConditionsNRelations != null)
                {
                    item.SubItems.Add(TimeSpan.FromTicks((long)log.ElapsedTimeConditionsNRelations).ToString());
                }
                else
                {
                    item.SubItems.Add(string.Empty);
                }

                if (log.ElapsedTimeApplyPermission != null)
                {
                    item.SubItems.Add(TimeSpan.FromTicks((long)log.ElapsedTimeApplyPermission).ToString());
                }
                else
                {
                    item.SubItems.Add(string.Empty);
                }

                if (log.ElapsedTimeApplyParameters != null)
                {
                    item.SubItems.Add(TimeSpan.FromTicks((long)log.ElapsedTimeApplyParameters).ToString());
                }
                else
                {
                    item.SubItems.Add(string.Empty);
                }

                lvwLogs.Items.Add(item);
            }
        }