Exemplo n.º 1
0
        /// <summary>Obtm todos os scans de um planeta</summary>
        public override Scan[] GetScans(Planet scanner)
        {
            Hashtable parameters = new Hashtable();

            parameters.Add("@targetPlanetOwner", scanner.Id);

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_GetScansByPlanetId", parameters);

            return(DataSetToScans(ds));
        }
Exemplo n.º 2
0
        /// <summary>Obtém as notícias existentes por linguagem </summary>
        protected override NewsList GetNewsFromDBByLang(string lang)
        {
            Hashtable parameters = new Hashtable();

            parameters.Add("@lang", lang);

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_GetNewsByLang", parameters);

            return(NewsFromDataSet(ds));
        }
Exemplo n.º 3
0
        /// <summary>Obtm um scan dado o seu id</summary>
        public override Scan GetScan(int id)
        {
            Hashtable parameters = new Hashtable();

            parameters.Add("@id", id);

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_GetScansById", parameters);

            return(DataSetToScans(ds)[0]);
        }
Exemplo n.º 4
0
        /// <summary>Obtm todos os utilizadores com a role passada</summary>
        public override int[] getUsers(int role)
        {
            Hashtable param = new Hashtable();

            param.Add("@role", role);

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_UsersGetUsersIdByRole", param);

            return(fetchUsersIds(ds));
        }
Exemplo n.º 5
0
        public override string checkUser(int id)
        {
            Hashtable param = new Hashtable();

            param.Add("@user_id", id);

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_UsersGetMailFromId", param);

            if (ds.Tables.Count == 0)
            {
                throw new AlnitakException("O Dataset deveria ter pelo menos 1 resultado @ SqlServerUserUtility::checkUser(int id)");
            }

            return(ds.Tables[0].Rows[0]["user_mail"].ToString());
        }
Exemplo n.º 6
0
        public override string getAvatar(int rulerId)
        {
            Hashtable param = new Hashtable();

            param.Add("@ruler_id", rulerId);

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_UsersGetAvatar", param);

            if (ds.Tables[0].Rows.Count != 1)
            {
                return(User.DefaultAvatar);
            }
            string s = (string)ds.Tables[0].Rows[0]["user_avatar"];

            return(s == string.Empty?User.DefaultAvatar:s);
        }
Exemplo n.º 7
0
        public override string[] getAllSectionsRolesFromDB(int section_id)
        {
            Hashtable parameters = new Hashtable();

            parameters.Add("@section_id", section_id.ToString());
            DataSet roles = SqlServerUtility.getFromDB("OrionsBelt_SectionsGetAllSectionsRoles", parameters);

            int results = roles.Tables[0].Rows.Count;

            string[] rolesArray = new string[results];

            for (int i = 0; i < results; ++i)
            {
                DataRow row = roles.Tables[0].Rows[i];
                rolesArray[i] = (string)row["roles_roleName"];
            }

            return(rolesArray);
        }
Exemplo n.º 8
0
        /// <summary>Obtém todos os scans de um jogador em todos os planetas</summary>
        public override Scan[] GetScans(Ruler ruler)
        {
            StringWriter writer = new StringWriter();

            writer.Write("scans_sourcePlanetId={0}", ruler.Planets[0].Id);
            for (int i = 1; i < ruler.Planets.Length; ++i)
            {
                writer.Write(" or scans_sourcePlanetId={0} ", ruler.Planets[i].Id);
            }

            Hashtable parameters = new Hashtable();

            parameters.Add("@count", 40);
            parameters.Add("@types", writer.ToString( ));

            DataSet ds = SqlServerUtility.getFromDB("OrionsBelt_GetScans", parameters);

            return(DataSetToScans(ds));
        }
Exemplo n.º 9
0
        /// <summary>Retorna as roles de um User</summary>
        public override string[] getRoles(string userMail)
        {
            Hashtable param = new Hashtable();

            param.Add("@user_mail", userMail);

            DataSet dataset = SqlServerUtility.getFromDB("OrionsBelt_UsersGetUserRoles", param);

            string[] roles = new string[dataset.Tables[0].Rows.Count];

            int i = 0;

            foreach (DataRow role in dataset.Tables[0].Rows)
            {
                roles[i++] = (string)role["roles_roleName"];
            }

            return(roles);
        }