Example #1
0
        public PyDataType GetMembers(int corporationID, int startPos, int limit, SparseRowsetHeader header, Dictionary <PyDataType, int> rowsIndex)
        {
            // TODO: GENERATE PROPER FIELDS FOR THE FOLLOWING FIELDS
            // TODO: titleMask, grantableRoles, grantableRolesAtHQ, grantableRolesAtBase, grantableRolesAtOther
            // TODO: divisionID, squadronID
            // TODO: CHECK IF THIS startDateTime IS THE CORP'S MEMBERSHIP OR CHARACTER'S MEMBERSHIP
            MySqlConnection connection = null;
            MySqlDataReader reader     = Database.PrepareQuery(ref connection,
                                                               "SELECT" +
                                                               " characterID, title, startDateTime, corpRole AS roles, rolesAtHQ, rolesAtBase, rolesAtOther," +
                                                               " titleMask, 0 AS grantableRoles, 0 AS grantableRolesAtHQ, 0 AS grantableRolesAtBase," +
                                                               " 0 AS grantableRolesAtOther, 0 AS divisionID, 0 AS squadronID, 0 AS baseID, " +
                                                               " 0 AS blockRoles, gender " +
                                                               "FROM chrInformation " +
                                                               "WHERE corporationID=@corporationID " +
                                                               "LIMIT @startPos,@limit",
                                                               new Dictionary <string, object>()
            {
                { "@corporationID", corporationID },
                { "@startPos", startPos },
                { "@limit", limit }
            }
                                                               );

            using (connection)
                using (reader)
                {
                    return(header.DataFromMySqlReader(0, reader, rowsIndex));
                }
        }
Example #2
0
        public PyDataType GetMembers(PyList characterIDs, int corporationID, SparseRowsetHeader header, Dictionary <PyDataType, int> rowsIndex)
        {
            // TODO: GENERATE PROPER FIELDS FOR THE FOLLOWING FIELDS
            // TODO: titleMask, grantableRoles, grantableRolesAtHQ, grantableRolesAtBase, grantableRolesAtOther
            // TODO: divisionID, squadronID
            // TODO: CHECK IF THIS startDateTime IS THE CORP'S MEMBERSHIP OR CHARACTER'S MEMBERSHIP

            Dictionary <string, object> parameters = new Dictionary <string, object>();

            string query = "SELECT" +
                           " characterID, title, startDateTime, corpRole AS roles, rolesAtHQ, rolesAtBase, rolesAtOther," +
                           " titleMask, 0 AS grantableRoles, 0 AS grantableRolesAtHQ, 0 AS grantableRolesAtBase," +
                           " 0 AS grantableRolesAtOther, 0 AS divisionID, 0 AS squadronID, 0 AS baseID, " +
                           " 0 AS blockRoles, gender " +
                           "FROM chrInformation " +
                           "WHERE corporationID=@corporationID AND characterID IN (";

            foreach (PyDataType id in characterIDs)
            {
                parameters["@characterID" + parameters.Count.ToString("X")] = (int)(id as PyInteger);
            }

            // prepare the correct list of arguments
            query += String.Join(',', parameters.Keys) + ")";

            parameters["@corporationID"] = corporationID;
            MySqlConnection connection = null;
            MySqlDataReader reader     = Database.PrepareQuery(ref connection, query, parameters);

            using (connection)
                using (reader)
                {
                    return(header.DataFromMySqlReader(0, reader, rowsIndex));
                }
        }
Example #3
0
        public PyDataType GetOffices(PyList itemIDs, int corporationID, SparseRowsetHeader header, Dictionary <PyDataType, int> rowsIndex)
        {
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            string query = "SELECT" +
                           " itemID, stationID, typeID, officeFolderID " +
                           "FROM chrInformation " +
                           "LEFT JOIN invItems ON invItems.itemID = chrInformation.activeCloneID " +
                           "WHERE corporationID=@corporationID AND itemID IN (";

            foreach (PyDataType id in itemIDs)
            {
                parameters["@itemID" + parameters.Count.ToString("X")] = (int)(id as PyInteger);
            }

            // prepare the correct list of arguments
            query += String.Join(',', parameters.Keys) + ")";

            parameters["@corporationID"] = corporationID;

            // TODO: GENERATE PROPER FIELDS FOR THE FOLLOWING FIELDS
            // TODO: titleMask, grantableRoles, grantableRolesAtHQ, grantableRolesAtBase, grantableRolesAtOther
            // TODO: divisionID, squadronID
            // TODO: CHECK IF THIS startDateTime IS THE CORP'S MEMBERSHIP OR CHARACTER'S MEMBERSHIP
            MySqlConnection connection = null;
            MySqlDataReader reader     = Database.PrepareQuery(ref connection, query, parameters);

            using (connection)
                using (reader)
                {
                    return(header.DataFromMySqlReader(0, reader, rowsIndex));
                }
        }
Example #4
0
        public OfficesSparseRowsetService(Corporation corporation, CorporationDB db, SparseRowsetHeader rowsetHeader, BoundServiceManager manager) : base(rowsetHeader, manager)
        {
            this.DB          = db;
            this.Corporation = corporation;

            // get all the indexes based on the key
            this.RowsIndex = this.DB.GetOffices(corporation.ID);
        }
Example #5
0
        public PyDataType GetMembers(CallInformation call)
        {
            // generate the sparse rowset
            SparseRowsetHeader rowsetHeader = this.DB.GetMembersSparseRowset(call.Client.CorporationID);

            PyDictionary dict = new PyDictionary
            {
                ["realRowCount"] = rowsetHeader.Count
            };

            // create a service for handling it's calls
            MembersSparseRowsetService svc =
                new MembersSparseRowsetService(this.Corporation, this.DB, rowsetHeader, this.BoundServiceManager, call.Client);

            rowsetHeader.BoundObjectIdentifier = svc.MachoBindObject(dict, call.Client);

            // finally return the data
            return(rowsetHeader);
        }
Example #6
0
        public PyDataType GetOffices(int corporationID, int startPos, int limit, SparseRowsetHeader header, Dictionary <PyDataType, int> rowsIndex)
        {
            MySqlConnection connection = null;
            MySqlDataReader reader     = Database.PrepareQuery(ref connection,
                                                               "SELECT" +
                                                               " itemID, stationID, typeID, officeFolderID " +
                                                               "FROM crpOffices " +
                                                               "WHERE corporationID=@corporationID " +
                                                               "LIMIT @startPos,@limit",
                                                               new Dictionary <string, object>()
            {
                { "@corporationID", corporationID },
                { "@startPos", startPos },
                { "@limit", limit }
            }
                                                               );

            using (connection)
                using (reader)
                {
                    return(header.DataFromMySqlReader(0, reader, rowsIndex));
                }
        }
Example #7
0
 protected SparseRowsetDatabaseService(SparseRowsetHeader rowsetHeader, BoundServiceManager manager, Client client) : base(manager, client)
 {
     this.SparseRowset = rowsetHeader;
 }