Пример #1
0
        public DraftRun(int B1, int B2, int B3, int B4)
        {
            DraftRunLocation drl = new DraftRunLocation();

            drl.Country   = "";
            drl.City      = "";
            drl.Latitude  = 0;
            drl.Longitude = 0;

            DoDraftRun(B1, B2, B3, B4, drl);
        }
Пример #2
0
        public DraftRun(DraftRunLocation drl)
        {
            DraftBall draftball = new DraftBall(4);

            this.Ball1 = draftball.DraftBallNumber[0];
            this.Ball2 = draftball.DraftBallNumber[1];
            this.Ball3 = draftball.DraftBallNumber[2];
            this.Ball4 = draftball.DraftBallNumber[3];

            DoDraftRun(Ball1, Ball2, Ball3, Ball4, drl);
        }
        public async Task DraftRunLocation_Test()
        {
            string IPAddress;

            IPAddress = "27.0.44.3";
            DraftRunLocation drl = new DraftRunLocation();
            await drl.GetJSONResponse(IPAddress);

            Assert.IsNotNull(drl.Country, "Country Value is NULL");
            Assert.IsNotNull(drl.City, "City Value is NULL");
            Assert.IsNotNull(drl.Latitude, "Latitude Value is NULL");
            Assert.IsNotNull(drl.Longitude, "Longitude Value is NULL");
        }
Пример #4
0
        public DraftRun(decimal latitude, decimal longitude)
        {
            DraftBall draftball = new DraftBall(4);

            this.Ball1 = draftball.DraftBallNumber[0];
            this.Ball2 = draftball.DraftBallNumber[1];
            this.Ball3 = draftball.DraftBallNumber[2];
            this.Ball4 = draftball.DraftBallNumber[3];

            DraftRunLocation drl = new DraftRunLocation(latitude, longitude);

            DoDraftRun(Ball1, Ball2, Ball3, Ball4, drl);
        }
Пример #5
0
        public DraftRun()
        {
            DraftRunLocation drl = new DraftRunLocation();

            drl.Country   = "";
            drl.City      = "";
            drl.Latitude  = 0;
            drl.Longitude = 0;

            DraftBall draftball = new DraftBall(4);

            this.Ball1 = draftball.DraftBallNumber[0];
            this.Ball2 = draftball.DraftBallNumber[1];
            this.Ball3 = draftball.DraftBallNumber[2];
            this.Ball4 = draftball.DraftBallNumber[3];

            DoDraftRun(Ball1, Ball2, Ball3, Ball4, drl);
        }
        public ActionResult Index()
        {
            string IPAddress = string.Empty;

            string[] SplitIPAddress;
            string   IPv4Address;

            if (HttpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
            {
                IPAddress = HttpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
            }
            else if (HttpContext.Request.UserHostAddress.Length != 0)
            {
                IPAddress = HttpContext.Request.UserHostAddress;
            }

            //DEBUGGING
            //IPAddress = "24.150.185.77:3639";

            SplitIPAddress = IPAddress.Split(':');
            IPv4Address    = SplitIPAddress[0];

            DraftRunLocation drl = new DraftRunLocation(IPv4Address);

            DraftRun draftrun = new DraftRun(drl);

            ViewBag.DraftRun    = draftrun;
            ViewBag.DRL         = drl;
            ViewBag.IPAddress   = IPAddress;
            ViewBag.IPv4Address = IPv4Address;


            //Application Insights - CUSTOM EVENT
            var telemetry = new TelemetryClient();

            telemetry.TrackEvent("User clicked on creating a new DraftRun. Draft Winner was " + draftrun.TeamList4[0].TeamCity + " " + draftrun.TeamList4[0].TeamName + " with Draft Balls: " + draftrun.Ball1.ToString() + " | " + draftrun.Ball2.ToString() + " | " + draftrun.Ball3.ToString() + " | " + draftrun.Ball4.ToString() + ".");

            return(View());
        }
Пример #7
0
        public int DoDraftRun(int B1, int B2, int B3, int B4, DraftRunLocation drl)
        {
            int TeamID        = 0;
            int TeamSeqNumber = 0;

            Ball1 = B1;
            Ball2 = B2;
            Ball3 = B3;
            Ball4 = B4;

            TeamList1 = new List <DraftTeamRowItem>();
            TeamList2 = new List <DraftTeamRowItem>();
            TeamList3 = new List <DraftTeamRowItem>();
            TeamList4 = new List <DraftTeamRowItem>();

            if (LeagueID == null)
            {
                LeagueID = "1";
            }



            DataConnection dataConnection = new DataConnection(DBCnxn);

            // Get the list of teams still eligible for the first pick after Ball #1
            string    queryString = "EXEC spShowDraftTeamCombos 1, " + Ball1.ToString() + ", " + Ball2.ToString() + ", " + Ball3.ToString() + ", " + Ball4.ToString() + ", " + LeagueID;
            DataTable queryResult = dataConnection.ExecuteQuery(queryString);

            foreach (DataRow row in queryResult.Rows)
            {
                DraftTeamRowItem draftrow = new DraftTeamRowItem();
                draftrow.TeamID                = int.Parse(row["TeamID"].ToString());
                draftrow.TeamCity              = row["TeamCity"].ToString();
                draftrow.TeamName              = row["TeamName"].ToString();
                draftrow.TeamAbbr              = row["TeamAbbr"].ToString();
                draftrow.ImagePrimaryLargeURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Large/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryNormalURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Normal/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimarySmallURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Small/s" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryXSmallURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/XSmall/xs" + row["TeamID"].ToString() + ".png";
                draftrow.ImageAltLargeURL      = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Large/alt" + row["TeamID"].ToString() + ".png";
                draftrow.ImageAltSmallURL      = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Small/alts" + row["TeamID"].ToString() + ".png";
                TeamList1.Add(draftrow);
            }

            // Get the list of teams still eligible for the first pick after Ball #2
            queryString = "EXEC spShowDraftTeamCombos 2, " + Ball1.ToString() + ", " + Ball2.ToString() + ", " + Ball3.ToString() + ", " + Ball4.ToString() + ", " + LeagueID;
            queryResult = dataConnection.ExecuteQuery(queryString);

            foreach (DataRow row in queryResult.Rows)
            {
                DraftTeamRowItem draftrow = new DraftTeamRowItem();
                draftrow.TeamID                = int.Parse(row["TeamID"].ToString());
                draftrow.TeamCity              = row["TeamCity"].ToString();
                draftrow.TeamName              = row["TeamName"].ToString();
                draftrow.TeamAbbr              = row["TeamAbbr"].ToString();
                draftrow.ImagePrimaryLargeURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Large/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryNormalURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Normal/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimarySmallURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Small/s" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryXSmallURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/XSmall/xs" + row["TeamID"].ToString() + ".png";
                draftrow.ImageAltLargeURL      = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Large/alt" + row["TeamID"].ToString() + ".png";
                draftrow.ImageAltSmallURL      = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Small/alts" + row["TeamID"].ToString() + ".png";
                TeamList2.Add(draftrow);
            }

            // Get the list of teams still eligible for the first pick after Ball #3
            queryString = "EXEC spShowDraftTeamCombos 3, " + Ball1.ToString() + ", " + Ball2.ToString() + ", " + Ball3.ToString() + ", " + Ball4.ToString() + ", " + LeagueID;
            queryResult = dataConnection.ExecuteQuery(queryString);

            foreach (DataRow row in queryResult.Rows)
            {
                DraftTeamRowItem draftrow = new DraftTeamRowItem();
                draftrow.TeamID                = int.Parse(row["TeamID"].ToString());
                draftrow.TeamCity              = row["TeamCity"].ToString();
                draftrow.TeamName              = row["TeamName"].ToString();
                draftrow.TeamAbbr              = row["TeamAbbr"].ToString();
                draftrow.ImagePrimaryLargeURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Large/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryNormalURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Normal/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimarySmallURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Small/s" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryXSmallURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/XSmall/xs" + row["TeamID"].ToString() + ".png";
                draftrow.ImageAltLargeURL      = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Large/alt" + row["TeamID"].ToString() + ".png";
                //draftrow.ImageAltSmallURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Small/alts" + row["TeamID"].ToString() + ".png";
                TeamList3.Add(draftrow);
            }


            // Get the list of teams still eligible for the first pick after Ball #4
            queryString = "EXEC spShowDraftTeamCombos 4, " + Ball1.ToString() + ", " + Ball2.ToString() + ", " + Ball3.ToString() + ", " + Ball4.ToString() + ", " + LeagueID;
            queryResult = dataConnection.ExecuteQuery(queryString);

            foreach (DataRow row in queryResult.Rows)
            {
                DraftTeamRowItem draftrow = new DraftTeamRowItem();
                draftrow.TeamID                = int.Parse(row["TeamID"].ToString());
                TeamID                         = int.Parse(row["TeamID"].ToString());
                draftrow.TeamCity              = row["TeamCity"].ToString();
                draftrow.TeamName              = row["TeamName"].ToString();
                draftrow.TeamAbbr              = row["TeamAbbr"].ToString();
                TeamSeqNumber                  = int.Parse(row["TeamDraftChance"].ToString());
                draftrow.TeamSeqNumber         = int.Parse(row["TeamDraftChance"].ToString());
                draftrow.SeqNumber             = int.Parse(row["DraftBallRow"].ToString());
                draftrow.ImagePrimaryLargeURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Large/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryNormalURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Normal/" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimarySmallURL  = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/Small/s" + row["TeamID"].ToString() + ".png";
                draftrow.ImagePrimaryXSmallURL = "https://draftsimulatorstorage.blob.core.windows.net/logos/Primary/XSmall/xs" + row["TeamID"].ToString() + ".png";
                draftrow.ImageAltLargeURL      = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Large/alt" + row["TeamID"].ToString() + ".png";
                draftrow.ImageAltSmallURL      = "https://draftsimulatorstorage.blob.core.windows.net/logos/Alternate/Small/alts" + row["TeamID"].ToString() + ".png";
                TeamList4.Add(draftrow);
            }


            queryString = "EXEC spLogDraftRun " + TeamSeqNumber.ToString() + ", " + TeamID.ToString() + ", 0, " + "'Web', '" + drl.Country + "', '" + drl.City + "', " + drl.Latitude + ", " + drl.Longitude + ", '" + Season + "'";
            queryResult = dataConnection.ExecuteQuery(queryString);

            return(0);
        }