Example #1
0
 public SetPlayerRaffleDefinitions(DataRafflePrizes rd, bool isdelete)
 {
     m_id                  = 18210;
     RaffleDefID           = rd.RaffleID;
     isDelete              = isdelete;
     NumberOfPlayersToDraw = rd.NoOfRafflePrize;
     RaffleName            = rd.RaffleName;
     RaffleDefinition      = rd.RafflePrizeDescription;
     RaffleDisclaimer      = rd.RaffleDisclaimer;
 }
Example #2
0
        public static int Set(DataRafflePrizes rd, bool isdelete)
        {
            SetPlayerRaffleDefinitions msg = new SetPlayerRaffleDefinitions(rd, isdelete);

            try
            {
                msg.Send();
            }
            catch (ServerCommException ex)
            {
                throw new Exception("SetPlayerRaffleDefinitions: " + ex.Message);
            }

            return(msg.RaffleDefID);
        }
Example #3
0
        protected override void UnpackResponse()
        {
            base.UnpackResponse();

            MemoryStream responseStream = new MemoryStream(m_responsePayload);
            BinaryReader responseReader = new BinaryReader(responseStream, Encoding.Unicode);

            try
            {
                responseReader.BaseStream.Seek(sizeof(int), SeekOrigin.Begin); //? what is this script do
                ushort RaffleCount = responseReader.ReadUInt16();              //Raffle Count

                List_DataRafflePrize.LDataRafflePrize.Clear();

                if (ReturnCode == 0)
                {
                    for (ushort startCount = 0; startCount < RaffleCount; startCount++)
                    {
                        DataRafflePrizes data = new DataRafflePrizes();
                        data.gsRaffleID        = responseReader.ReadInt32();                             //Raffle definition ID
                        data.gsNoOfRafflePrize = responseReader.ReadInt32();                             //Number of Players to Draw
                        ushort stringLen = responseReader.ReadUInt16();                                  //Raffle Name Len
                        data.gsRaffleName             = new string(responseReader.ReadChars(stringLen)); //Raffle Name
                        stringLen                     = responseReader.ReadUInt16();                     //Raffle Description Len
                        data.gsRafflePrizeDescription = new string(responseReader.ReadChars(stringLen)); //Raffle Description
                        //what if its null.
                        stringLen = responseReader.ReadUInt16();                                         //Raffle Disclaimer Len
                        data.gsRaffleDisclaimer = new string(responseReader.ReadChars(stringLen));       //Raffle Disclaimer
                        List_DataRafflePrize.LDataRafflePrize.Add(data);
                    }
                }
            }
            catch (EndOfStreamException e)
            {
                throw new MessageWrongSizeException("Get Raffle Player Definition", e);
            }
            catch (Exception e)
            {
                throw new ServerException("Get Raffle Player Definition", e);
            }

            responseReader.Close();
        }