Exemplo n.º 1
0
        public void MyTestInitialize()
        {
            m_Container = StructureMapContainerInit();
            BaseReportTests.InitDBAndLogin();
            using (PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm()))
            {
                m_LayoutDB = new WinLayout_DB(PresenterFactory.SharedPresenter.SharedModel);
            }
            lock (m_LayoutDB.Connection)
            {
                OpenConnection();
                using (var command = new SqlCommand(GetQueryIdSQL))
                {
                    command.Connection = (SqlConnection)m_LayoutDB.Connection;
                    m_TestQueryId      = (long)command.ExecuteScalar();
                }
                CloseConnection();
            }

            m_PivotDB = new BaseAvrDbService();
            m_LayoutDB.AddLinkedDbService(m_PivotDB, null, RelatedPostOrder.SkipPost);

            m_ChartDB = new BaseAvrDbService();
            m_LayoutDB.AddLinkedDbService(m_ChartDB, null, RelatedPostOrder.SkipPost);

            LookupManager.AddObject("Query", null, AvrQueryLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            LookupManager.AddObject("LayoutFolder", null, AvrFolderLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            LookupManager.AddObject("Layout", null, AvrLayoutLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");

            m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm());
        }
Exemplo n.º 2
0
 public static List <AvrTreeElement> ReLoadQueries(bool readOnly = false)
 {
     LookupManager.AddObject("Query", null, AvrQueryLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
     LookupManager.ClearByTable("Query");
     LookupManager.ClearAndReloadOnIdle();
     return(LoadQueries(readOnly));
 }
Exemplo n.º 3
0
 public static List <AvrTreeElement> ReLoadLayouts(bool readOnly = false, long?queryId = null)
 {
     LookupManager.AddObject("Layout", null, AvrLayoutLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
     LookupManager.ClearByTable("Layout");
     LookupManager.ClearAndReloadOnIdle();
     return(LoadLayouts(readOnly, queryId));
 }
Exemplo n.º 4
0
 internal void LookupCasheRefreshTimerTick(object stateInfo)
 {
     try
     {
         LookupManager.AddObject("Query", null, AvrQueryLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
         LookupManager.AddObject("LayoutFolder", null, AvrFolderLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
         LookupManager.AddObject("Layout", null, AvrLayoutLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
         LookupManager.ClearAndReloadOnIdle();
     }
     catch (Exception ex)
     {
         m_Trace.TraceError(ex);
     }
 }
Exemplo n.º 5
0
        public static AvrQueryLookup GetAvrQueryLookupById(long queryId)
        {
            AvrQueryLookup foundQuery;

            LookupManager.AddObject("Query", null, Accessor.Instance(null).GetType(), "_SelectListInternal");
            using (var manager = DbManagerFactory.Factory.Create())
            {
                var accessor = Accessor.Instance(null);
                var lookup   = accessor.SelectLookupList(manager, queryId);
                foundQuery = lookup.SingleOrDefault();
            }

            return(foundQuery);
        }
Exemplo n.º 6
0
        public static AvrLayoutLookup GetAvrLayoutLookupById(long layoutId)
        {
            AvrLayoutLookup foundLayout;

            LookupManager.AddObject("Layout", null, Accessor.Instance(null).GetType(), "_SelectListInternal");
            using (var manager = DbManagerFactory.Factory.Create())
            {
                var accessor = Accessor.Instance(null);
                var lookup   = accessor.SelectLookupList(manager, layoutId, null);
                foundLayout = lookup.SingleOrDefault();
            }

            return(foundLayout);
        }
Exemplo n.º 7
0
        public static AvrTreeElement ReloadQuery(long queryId)
        {
            LookupManager.AddObject("Query", null, AvrQueryLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            LookupManager.ClearByTable("Query");
            LookupManager.ClearAndReloadOnIdle();
            using (var manager = DbManagerFactory.Factory.Create())
            {
                var accessor = AvrQueryLookup.Accessor.Instance(null);
                var lookup   = accessor.SelectLookupList(manager, queryId);

                var foundQuery = lookup.FirstOrDefault();
                return(foundQuery != null
                    ? (AvrTreeElement)foundQuery
                    : null);
            }
        }
Exemplo n.º 8
0
        public static AvrTreeElement ReloadFolder(long folderId)
        {
            LookupManager.AddObject("LayoutFolder", null, AvrFolderLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            LookupManager.ClearByTable("LayoutFolder");
            LookupManager.ClearAndReloadOnIdle();
            using (var manager = DbManagerFactory.Factory.Create())
            {
                var accessor = AvrFolderLookup.Accessor.Instance(null);
                var lookup   = accessor.SelectLookupList(manager, folderId, null);

                var foundFolder = lookup.FirstOrDefault();
                return(foundFolder != null
                    ? (AvrTreeElement)foundFolder
                    : null);
            }
        }
Exemplo n.º 9
0
 public static List <AvrTreeElement> LoadFolders(bool readOnly = false, long?queryId = null)
 {
     LookupManager.AddObject("LayoutFolder", null, AvrFolderLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
     using (var manager = DbManagerFactory.Factory.Create())
     {
         var accessor     = AvrFolderLookup.Accessor.Instance(null);
         var lookup       = accessor.SelectLookupList(manager, null, queryId);
         var eidssUser    = (EidssUser)ModelUserContext.Instance.CurrentUser;
         var treeElements = lookup
                            .Where(
             f =>
             (!readOnly || f.blnReadOnly) &&
             (!f.idfsSearchObject.HasValue || eidssUser.IsAvrSearchObjectAvailable(f.idfsSearchObject.Value)))
                            .Select(f => (AvrTreeElement)f)
                            .ToList();
         return(treeElements);
     }
 }
Exemplo n.º 10
0
        public static List <AvrTreeElement> LoadQueries(bool readOnly = false)
        {
            LookupManager.AddObject("Query", null, AvrQueryLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            using (var manager = DbManagerFactory.Factory.Create())
            {
                var accessor = AvrQueryLookup.Accessor.Instance(null);
                var lookup   = accessor.SelectLookupList(manager, null);

                var treeElements = lookup
                                   .Where(
                    q =>
                    (!readOnly || q.blnReadOnly) &&
                    (q.idfsSearchObject == null ||
                     ((EidssUser)ModelUserContext.Instance.CurrentUser).IsAvrSearchObjectAvailable(q.idfsSearchObject.Value)))
                                   .Select(q => (AvrTreeElement)q)
                                   .ToList();
                return(treeElements);
            }
        }
Exemplo n.º 11
0
        public static List <AvrTreeElement> LoadLayouts(bool readOnly = false, long?queryId = null)
        {
            LookupManager.AddObject("Layout", null, AvrLayoutLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            using (var manager = DbManagerFactory.Factory.Create())
            {
                var accessor   = AvrLayoutLookup.Accessor.Instance(null);
                var lookup     = accessor.SelectLookupList(manager, null, queryId);
                var employeeId = EidssUserContext.User.EmployeeID is long?(long)EidssUserContext.User.EmployeeID : -1;
                var user       = (EidssUser)ModelUserContext.Instance.CurrentUser;
                Func <AvrLayoutLookup, bool> selector =
                    lay => (!readOnly || lay.blnReadOnly) &&
                    (!lay.idfsSearchObject.HasValue || user.IsAvrSearchObjectAvailable(lay.idfsSearchObject.Value)) &&
                    (lay.idfPerson.HasValue && lay.idfPerson.Value == employeeId ||
                     lay.blnShareLayout ||
                     AvrPermissions.AccessToAVRAdministrationPermission);
                var treeElements = lookup.Where(selector).Select(lay => (AvrTreeElement)lay).ToList();

                return(treeElements);
            }
        }