Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_ShowTopList = reader.ReadBool();
                int c = reader.ReadInt();
                for (int i = 0; i < c; i++)
                {
                    Contributers.Add(new Contributer(reader.ReadInt(), reader.ReadMobile()));
                    ((Contributer)Contributers[Contributers.Count - 1]).Date = reader.ReadDateTime();
                }
                goto case 0;
            }

            case 0:
            {
                FundName = reader.ReadString();
                Fund     = reader.ReadInt();
                break;
            }
            }
        }
Ejemplo n.º 2
0
        /**
         * Select contributers for update json or insert json whether change is true
         *
         **/
        public void selectContribs()
        {
            if (change == "true")
            {
                select = new SqlCommand(" SELECT * FROM Contributers WHERE changeTime > @lastUpdated", con);
            }
            else
            {
                select = new SqlCommand(" SELECT * FROM Contributers WHERE updateTime > @lastUpdated", con);
            }

            select.Parameters.AddWithValue("@lastUpdated", lastUpdated);
            con.Open();
            Contributers contributers = new Contributers();

            contributers.Contributer = new List <Contributer>();
            var reader = select.ExecuteReader();

            //Gets contributer info to place in a json
            while (reader.Read())
            {
                Contributer contrib = new Contributer();
                contrib.email    = (string)reader["usersId"];
                contrib.progress = (string)reader["progress"];
                selectContribBook(reader, contrib, contributers.Contributer);
            }
            con.Close();

            //Creates json of contributers, serializes and writes
            string json = js.Serialize(contributers);

            Response.Write(json);
        }
Ejemplo n.º 3
0
        private void AddToFund(Mobile from, int amount)
        {
            bool skip = false;

            foreach (Contributer contributer in Contributers)
            {
                if (contributer.Mobile == from)
                {
                    contributer.Amount += amount;
                    contributer.Date    = DateTime.Now;
                    skip = true;
                    break;
                }
            }
            if (!skip)
            {
                Contributers.Add(new Contributer(amount, from));
            }
            Fund += amount;
            PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, false, String.Format("{0} contributed with {1} gold. Thanks a lot!", from.Name, amount));
        }