Exemple #1
0
        public bool getDraws(List <DrawRequestRespons> draws)
        {
            SqlDataReader rdr = null;

            string     stm = "SELECT * FROM lancellotDB.dbo.draws";
            SqlCommand cmd = new SqlCommand(stm, _connection);

            using (rdr = cmd.ExecuteReader())
            {
                while (rdr.Read())
                {
                    DrawRequestRespons DrawRequestRespons = new DrawRequestRespons();
                    DrawRequestRespons.Id              = rdr[0].ToString();
                    DrawRequestRespons.CountryFlag     = rdr[1].ToString();
                    DrawRequestRespons.DrawLogo        = rdr[2].ToString();
                    DrawRequestRespons.State           = rdr[3].ToString();
                    DrawRequestRespons.Amount          = rdr[4].ToString();
                    DrawRequestRespons.StartDate       = rdr[5].ToString();
                    DrawRequestRespons.EndDate         = rdr[6].ToString();
                    DrawRequestRespons.CreatedOn       = rdr[7].ToString();
                    DrawRequestRespons.BannerImage     = rdr[8].ToString();
                    DrawRequestRespons.BannerImageType = rdr[9].ToString();
                    DrawRequestRespons.PrizeAmount     = rdr[10].ToString();
                    DrawRequestRespons.Status          = rdr[11].ToString();
                    DrawRequestRespons.Url             = rdr[12].ToString();

                    draws.Add(DrawRequestRespons);
                }
            }

            rdr.Close();
            return(true);
        }
Exemple #2
0
        public bool getDrawsRequestResualt(string request_type,
                                           string from_record,
                                           string to_record,
                                           string sort_type,
                                           string sort_dir,
                                           string device_type,
                                           string device_id,
                                           string decode,
                                           int id,
                                           DrawRequestRespons DrawRequestRespons)
        {
            SqlDataReader rdr = null;

            string     stm = String.Format("SELECT * FROM lancellotDB.dbo.draws where id = {0}", id);
            SqlCommand cmd = new SqlCommand(stm, _connection);

            rdr = cmd.ExecuteReader();

            int numOfFields = rdr.FieldCount;

            if ((numOfFields == 13) && (rdr.Depth == 0))
            {
                while (rdr.Read())
                {
                    DrawRequestRespons.Id              = rdr[0].ToString();
                    DrawRequestRespons.CountryFlag     = rdr[1].ToString();
                    DrawRequestRespons.DrawLogo        = rdr[2].ToString();
                    DrawRequestRespons.State           = rdr[3].ToString();
                    DrawRequestRespons.Amount          = rdr[4].ToString();
                    DrawRequestRespons.StartDate       = rdr[5].ToString();
                    DrawRequestRespons.EndDate         = rdr[6].ToString();
                    DrawRequestRespons.CreatedOn       = rdr[7].ToString();
                    DrawRequestRespons.BannerImage     = rdr[8].ToString();
                    DrawRequestRespons.BannerImageType = rdr[9].ToString();
                    DrawRequestRespons.PrizeAmount     = rdr[10].ToString();
                    DrawRequestRespons.Status          = rdr[11].ToString();
                    DrawRequestRespons.Url             = rdr[12].ToString();
                }
            }
            else
            {
                return(false);
            }

            //while (rdr.Read())
            //{
            //    Console.WriteLine(rdr[0] + " -- " + rdr[1]);
            //}
            rdr.Close();
            return(true);
        }
Exemple #3
0
        public void sendDrawsRequestResponse(Socket handler)
        {
            DrawRequestRespons drawResponse = new DrawRequestRespons();
            int  amount  = 4000;
            bool resualt = DBConnector.DBConnector.Instance.getDB().getDrawsRequestResualt("x", "y", "z", "m", "n", "c", "v", "b", amount, drawResponse);

            JObject jsonObj = new JObject();

            JObject responseData = new JObject(
                new JProperty("Id", drawResponse.Id),
                new JProperty("Amount", drawResponse.Amount));

            jsonObj["DrawsResponse"] = responseData;

            string jsonMessage = jsonObj.ToString();

            Console.WriteLine(drawResponse.print());
            Common.TCPSocketServer.Send(handler, jsonMessage);
        }