Exemplo n.º 1
0
        private QueryFilterControl CreateFilterControl(string lang = "en")
        {
            DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString"));
            ConnectionManager.DefaultInstance.SetCredentials(Config.GetSetting("EidssConnectionString"));
            EidssUserContext.Init();
            context  = ModelUserContext.Instance as EidssUserContext;
            Security = new EidssSecurityManager();
            int result = Security.LogIn(Organizaton, Admin, AdminPassword);

            Assert.AreEqual(0, result);
            EIDSS_LookupCacheHelper.Init();
            EidssUserContext.CurrentLanguage = lang;
            var     queryDb             = new Query_DB();
            var     querySearchObjectDb = new QuerySearchObject_DB();
            var     queryDs             = queryDb.LoadDetailData(QueryId);
            DataRow row             = queryDs.Tables[Query_DB.TasQueryObjectTree].Rows[0];
            var     searchObjectsDs = querySearchObjectDb.LoadDetailData(row["idfQuerySearchObject"]);

            var form   = new Form();
            var filter = new QueryFilterControl {
                Parent = form, Dock = DockStyle.Fill
            };

            filter.Init();
            filter.Bind((long)queryDs.Tables[1].Rows[0]["idfQuerySearchObject"], searchObjectsDs);
            return(filter);
        }
Exemplo n.º 2
0
        public void InitContextProperties()
        {
            if (EidssSiteContext.Instance != null)
            {
                SiteId = EidssSiteContext.Instance.SiteID;
            }
            ModelUserContext model = ModelUserContext.Instance;

            if (model != null)
            {
                IsArchiveMode = model.IsArchiveMode;
            }

            EidssUser user = EidssUserContext.User;

            if (user != null)
            {
                if (user.OrganizationID != null)
                {
                    OrganizationId = Convert.ToInt64(user.OrganizationID);
                }
                if (user.ID != null)
                {
                    UserId = Convert.ToInt64(user.ID);
                }
                ForbiddenGroups = user.ForbiddenPersonalDataGroups ?? new List <PersonalDataGroup>();
            }
        }
Exemplo n.º 3
0
        public override DbManagerProxy Create(ModelUserContext context = null, CacheScope cacheScope = null)
        {
            DbManagerProxy     ret;
            LocalDataStoreSlot slot = Thread.GetNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));

            if (slot != null)
            {
                ret = Thread.GetData(slot) as DbManagerProxy;
                if (ret != null)
                {
                    ret.IncrementRef();
                    return(ret);
                }
            }
            else
            {
                slot = Thread.AllocateNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));
            }

            var connectionString = (context != null && context.IsArchiveMode)
                ? context.DatabaseConnectionString
                : m_ConnectionString;

            ret = new DbManagerProxy(new SqlDataProvider(), connectionString, context, cacheScope, m_DatabaseType);
            ret.IncrementRef();
            Thread.SetData(slot, ret);
            return(ret);
        }
Exemplo n.º 4
0
 // [Ignore]
 public void LookupPanelTestWithLayoutWithPermissions()
 {
     //показ листовой формы с учётом полномочий
     TestUserContext.Init();
     using (ModelUserContext context = ModelUserContext.Instance)
     {
         //Lookup2ListItem bo = Lookup2ListItem.CreateInstance();
         var panel = new TestLookupPanelUI();
         panel.LoadData();
         BaseFormManager.ShowSimpleFormModal(panel);
     }
     TestUserContext.Clear();
 }
Exemplo n.º 5
0
 internal DbManagerProxy
     (DataProviderBase provider, string connectionString, ModelUserContext context, CacheScope cacheScope, DatabaseType databaseType)
     : base(provider, connectionString)
 {
     CommandTimeout = 300;
     m_Context      = context;
     m_CacheScope   = cacheScope;
     m_DatabaseType = databaseType;
     if (m_Context != null)
     {
         m_Context.SetContext(this);
     }
 }
Exemplo n.º 6
0
        public void TestInitialize()
        {
            DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString"));
            ConnectionManager.DefaultInstance.SetCredentials(Config.GetSetting("EidssConnectionString"));
            EidssUserContext.Init();
            context    = ModelUserContext.Instance as EidssUserContext;
            m_Security = new EidssSecurityManager();
            int result = m_Security.LogIn(Organizaton, Admin, AdminPassword);

            Assert.AreEqual(0, result);
            EIDSS_LookupCacheHelper.Init();
            //while(!LookupCache.Filled)
            //    Thread.Sleep(500);
            ModelUserContext.CurrentLanguage = "en";
        }
Exemplo n.º 7
0
        protected override void Dispose(bool disposing)
        {
            if (DecrementRef() > 0)
            {
                return;
            }

            if (m_Context != null)
            {
                m_Context.ClearContext(this);
                m_Context = null;
            }

            LocalDataStoreSlot slot = Thread.GetNamedDataSlot(NameDbManagerSlot(m_DatabaseType));

            if (slot != null)
            {
                Thread.SetData(slot, null);
            }

            base.Dispose(disposing);
        }
Exemplo n.º 8
0
        public override DbManagerProxy Create(ModelUserContext context = null, CacheScope cacheScope = null)
        {
            DbManagerProxy     ret;
            LocalDataStoreSlot slot = Thread.GetNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));

            if (slot != null)
            {
                ret = Thread.GetData(slot) as DbManagerProxy;
                if (ret != null)
                {
                    ret.IncrementRef();
                    return(ret);
                }
            }
            else
            {
                slot = Thread.AllocateNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));
            }
            ret = new DbManagerProxy(new RemoteSqlDataProvider(), m_url, context, cacheScope, m_DatabaseType);
            ret.IncrementRef();
            Thread.SetData(slot, ret);
            return(ret);
        }
Exemplo n.º 9
0
 public abstract DbManagerProxy Create(ModelUserContext context = null, CacheScope cacheScope = null);