Beispiel #1
0
        private void readUserManagedOrganizations(ITUser user, XStorageConnection con)
        {
            XDbCommand cmd = con.CreateCommand();

            cmd.CommandText = @"
				SELECT o.ObjectID
				FROM Organization o WITH (nolock)
					JOIN Organization o_p WITH (nolock) ON o_p.LIndex <= o.LIndex AND o_p.RIndex >= o.RIndex and o_p.Director = @EmployeeID		
			"            ;
            cmd.Parameters.Add("EmployeeID", DbType.Guid, ParameterDirection.Input, false, user.EmployeeID);
            using (IXDataReader reader = cmd.ExecuteXReader())
            {
                ArrayList aOrgIDs = new ArrayList();
                while (reader.Read())
                {
                    aOrgIDs.Add(reader.GetGuid(0));
                }
                user.ManagedOrganizations = new Guid[aOrgIDs.Count];
                aOrgIDs.CopyTo(user.ManagedOrganizations);
            }
        }
Beispiel #2
0
        private void readUserActivityTypes(ITUser user, XStorageConnection con)
        {
            XDbCommand cmd = con.CreateCommand();

            cmd.CommandText = @"
				SELECT at.ObjectID, at.Name, at.Code, at.AccountRelated, at.FolderType, at.StartDate, at.EndDate 
				FROM dbo.SystemUser_ActivityTypes su_at WITH (nolock)
					JOIN dbo.ActivityType at WITH (nolock) ON su_at.Value = at.ObjectID
				WHERE su_at.ObjectID = @ObjectID
				UNION
				SELECT at.ObjectID, at.Name, at.Code, at.AccountRelated, at.FolderType, at.StartDate, at.EndDate 
				FROM dbo.SystemUser_SystemRoles su_sr WITH (nolock)
					JOIN dbo.SystemRole_ActivityTypes sr_at WITH (nolock) ON su_sr.Value = sr_at.ObjectID
						JOIN dbo.ActivityType at WITH (nolock) ON sr_at.Value = at.ObjectID
				WHERE su_sr.ObjectID = @ObjectID
				"                ;
            cmd.Parameters.Add("ObjectID", DbType.Guid, ParameterDirection.Input, false, user.SystemUserID);
            using (IXDataReader reader = cmd.ExecuteXReader())
            {
                user.ActivityTypes = new Hashtable();
                while (reader.Read())
                {
                    DomainObject_ActivityType xobj = new DomainObject_ActivityType();
                    xobj.ObjectID       = reader.GetGuid(reader.GetOrdinal("ObjectID"));
                    xobj.Name           = reader.GetString(reader.GetOrdinal("Name"));
                    xobj.Code           = reader.GetString(reader.GetOrdinal("Code"));
                    xobj.AccountRelated = reader.GetBoolean(reader.GetOrdinal("AccountRelated"));
                    xobj.FolderType     = (FolderTypeFlags)reader.GetInt16(reader.GetOrdinal("FolderType"));
                    xobj.StartDate      = reader.GetDateTime(reader.GetOrdinal("StartDate"));
                    if (!reader.IsDBNull(reader.GetOrdinal("EndDate")))
                    {
                        xobj.EndDate = reader.GetDateTime(reader.GetOrdinal("EndDate"));
                    }
                    user.ActivityTypes.Add(xobj.ObjectID, xobj);
                }
            }
        }