Ejemplo n.º 1
0
        public void GetReadersTest()
        {
            using (FileLogger l = new FileLogger("MdbContextTest", new FileLogSettings()
            {
                DateFolderMask = "yyyy-MM-dd"
            }))
            {
                MdbContextOptions.GetOptions().CommandTimeout = 120;
                using (var ctx = new MdbContext(_cn))
                {
                    l.Debug("Test 1 Start ");
                    int i   = 0;
                    var drs = ctx.GetReaders(@"
						Select * From PayDocs Where Handle = @handle;
						Select * From PayDocs Where Handle = @handle1
						Select * From PayDocs Where Handle = @handle1+1"                        ,
                                             new MdbParameter("@handle", 3999750),
                                             new MdbParameter("@handle1", 3999751)
                                             );
                    foreach (var dr in drs)
                    {
                        using (dr)
                        {
                            for (; dr.Read(); i++)
                            {
                                l.Debug(dr.GetRowJSON());
                            }
                        }
                    }
                    l.Debug($"Test 1 Finish rows result {i}");
                }
            }
        }
Ejemplo n.º 2
0
        public void GetSysCatReadersTest()
        {
            using (FileLog l = new FileLog("MdbContextTest", new FileLogSettings()
            {
                DateFolderMask = "yyyy-MM-dd"
            }))
            {
                MdbContextOptions.GetOptions().CommandTimeout = 120;
                using (var ctx = new MdbContext(_syscat))
                {
                    l.Debug("Test 1 Start ");
                    int i   = 0;
                    var drs = ctx.GetReaders(@"
						select u.ID
							   ,u.StructuralUnitID
							   ,u.AccessLevelID
							   ,u.UserName
							   ,COALESCE(u.DomainName, '') as DomainName
							   ,COALESCE(u.PersonID, 0) as PersonID
							   ,COALESCE(u.Name, '') as Name
							   ,COALESCE(u.JData, '') as JData
						from Users u
						where u.UserName LIKE '{0}';
						select 
							Upper(r.RoleName) as RoleName
						from Users u
						inner join Users2Roles ur on u.ID = ur.UserID
						inner join Roles r on r.ID = ur.RoleID
						where u.UserName LIKE '{0}'"                        .ToFormat(@"DESKTOP-14MM2MF\sergey")
                                             );
                    foreach (var dr in drs)
                    {
                        using (dr)
                        {
                            for (; dr.Read(); i++)
                            {
                                l.Debug(dr.GetRowJSON());
                            }
                        }
                    }
                    l.Debug($"Test 1 Finish rows result {i}");
                }
            }
        }