Beispiel #1
0
		public override IList getInactiveUsers() {
			PostGre.PostGreParam [] param = new PostGreParam[1];
			param[0] = new PostGreParam(DateTime.Now.AddMonths(-1),NpgsqlDbType.Date);
			
			DataSet ds = PostGreServerUtility.getFromDB("OrionsBelt_UsersGetInative",param);

			return PopulateInativeUsers(ds);
		}
Beispiel #2
0
        /// <summary>Obtém as notícias existentes por linguagem </summary>
        protected override NewsList GetNewsFromDBByLang(string lang)
        {
            PostGre.PostGreParam [] param = new PostGreParam[1];
            param[0] = new PostGreParam(lang, NpgsqlDbType.Varchar);

            DataSet ds = PostGreServerUtility.getFromDB("OrionsBelt_GetNewsByLang", param);

            return(NewsFromDataSet(ds));
        }
Beispiel #3
0
		public override string checkUser(int id) {
			PostGre.PostGreParam [] param = new PostGreParam[1];
			param[0] = new PostGreParam(id,NpgsqlDbType.Integer);
			
			DataSet ds = PostGreServerUtility.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();
		}
        public override int Register(AllianceInfo info)
        {
            PostGre.PostGreParam [] param = new PostGreParam[5];
            param[0] = new PostGreParam(info.Name, NpgsqlDbType.Varchar, 150);
            param[1] = new PostGreParam(info.Tag, NpgsqlDbType.Varchar, 150);
            param[2] = new PostGreParam(info.Motto, NpgsqlDbType.Varchar, 150);
            param[3] = new PostGreParam(info.Ranking, NpgsqlDbType.Integer);
            param[4] = new PostGreParam(info.RankingBattles, NpgsqlDbType.Integer);

            DataSet ds = PostGreServerUtility.getFromDB("OrionsBelt_AllianceRegisterAlliance", param);

            return(int.Parse(ds.Tables[0].Rows[0][0].ToString()));
        }
Beispiel #5
0
		public override string getAvatar( int rulerId ) {
			PostGre.PostGreParam [] param = new PostGreParam[1];
			param[0] = new PostGreParam(rulerId,NpgsqlDbType.Integer);
			
			DataSet ds = PostGreServerUtility.getFromDB("OrionsBelt_UsersGetAvatar",param);

			object o = ds.Tables[0].Rows[0][0];

			if( ds.Tables[0].Rows.Count != 1 || o is System.DBNull ) {
				return User.DefaultAvatar;
			}
			string s = o.ToString();

			return s == string.Empty?User.DefaultAvatar:s;
		}
        public override AllianceInfo Get(int id)
        {
            PostGre.PostGreParam [] param = new PostGreParam[1];
            param[0] = new PostGreParam(id, NpgsqlDbType.Integer);

            DataSet alliances = PostGreServerUtility.getFromDB("OrionsBelt_AllianceGetAllianceById", param);

            ArrayList allianceArray = FromDataSet(alliances);

            if (allianceArray.Count > 0)
            {
                return((AllianceInfo)allianceArray[0]);
            }

            return(null);
        }
Beispiel #7
0
        public override string[] getAllSectionsRolesFromDB(int section_id)
        {
            PostGre.PostGreParam [] param = new PostGreParam[1];
            param[0] = new PostGreParam(section_id, NpgsqlDbType.Integer);

            DataSet roles = PostGreServerUtility.getFromDB("OrionsBelt_SectionsGetAllSectionsRoles", param);

            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[0];
            }

            return(rolesArray);
        }
Beispiel #8
0
		/// <summary>Retorna as roles de um User</summary>
		public override string[] getRoles( string userMail ) {
			PostGre.PostGreParam [] param = new PostGreParam[1];
			param[0] = new PostGreParam(userMail,NpgsqlDbType.Varchar,40);
			
			DataSet dataset = PostGreServerUtility.getFromDB("OrionsBelt_UsersGetUserRoles",param);
			string[] roles = new string[dataset.Tables[0].Rows.Count];
			
			int i = 0;
			bool insertMade = false;
			foreach ( DataRow role in dataset.Tables[0].Rows ) {
				if( !(role[0] is System.DBNull) ) {
					roles[i++] = (string)role[0];
					insertMade = true;
				}
			}

			if(insertMade) {
				return roles;
			}

			return new string[0];
		}
Beispiel #9
0
		public override void setAllianceMembers( AllianceInfo info ) {
			PostGre.PostGreParam [] param = new PostGreParam[1];
			param[0] = new PostGreParam(info.Id,NpgsqlDbType.Integer);
			
			DataSet ds = PostGreServerUtility.getFromDB("OrionsBelt_AllianceGetAllianceMembers",param);
			
			ArrayList all = PopulateUsers(ds, "user_id");
			
			ArrayList members = new ArrayList();
			ArrayList wannabe = new ArrayList();
			
			foreach( User user in all ) {
				if( user.AllianceId < 0 ) {
					wannabe.Add(user);
				} else {
					members.Add(user);
				}
			}
			
			info.Members = members;
			info.Wannabe = wannabe;
			
		}