Esempio n. 1
0
        private void updateCount(int pid, bool updown)
        {
            using (FF2014Entities ttt = new FF2014Entities())
            {
                var p = (from y in ttt.FF_Player
                         where y.ID == pid
                         select y).First();

                string _pos = p.POS.Trim();

                var c = (from x in ttt.FF_TAKEN
                         where x.POS == _pos
                         select x).First();

                if (updown)
                {
                    c.COUNT++;
                }
                else
                {
                    c.COUNT--;
                }

                ttt.SaveChanges();
            }
        }
Esempio n. 2
0
        protected void gv_MyTeam_CheckChanged(object sender, EventArgs e)
        {
            string danrules = "yes";
            int    _id      = 0;

            RepeaterItem row  = (sender as CheckBox).Parent as RepeaterItem;
            CheckBox     cb   = row.FindControl("CheckBox2") as CheckBox;
            RepeaterItem item = (RepeaterItem)cb.NamingContainer;

            Label lblid = (Label)item.FindControl("lblID");

            _id = int.Parse(lblid.Text);

            if (cb.Checked)
            {
                using (FF2014Entities itx = new FF2014Entities())
                {
                    var _i = from i in itx.FF_Player
                             where i.ID == _id
                             select i;
                    foreach (var t in _i)
                    {
                        t.DRAFTED = true;
                        t.MYTEAM  = true;
                    }
                    itx.SaveChanges();
                    updateCount(_id, itx, true);

                    itx.Dispose();
                }
                BuildData();
            }
            else
            {
                using (FF2014Entities itx = new FF2014Entities())
                {
                    var _i = from i in itx.FF_Player
                             where i.ID == _id
                             select i;
                    foreach (var t in _i)
                    {
                        t.DRAFTED = false;
                        t.MYTEAM  = false;
                    }
                    itx.SaveChanges();
                    updateCount(_id, itx, false);

                    itx.Dispose();
                }
                BuildData();
            }
        }
Esempio n. 3
0
        private void cleanSpace()
        {
            using (FF2014Entities stx = new FF2014Entities())
            {
                var _players = from p in stx.FF_Player
                               where p.DRAFTED == false
                               select p;

                foreach (var p in _players)
                {
                    p.FIRST = p.FIRST.Trim();
                }
                stx.SaveChanges();
            }
        }
Esempio n. 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            drafting = getTurn();
            string boxvalue = tags.Text;

            string[] parts = boxvalue.Split('|');

            if (parts.Length > 1)
            {
                int pid = int.Parse(parts[1].ToString().Trim());

                using (FF2014Entities ptx = new FF2014Entities())
                {
                    var tid = (from i in ptx.FF_DRAFT
                               where i.DRAFT == drafting
                               select i.TEAMID).First();

                    FF_League l = new FF_League {
                        PLAYERID = pid, TEAMID = (int)tid
                    };
                    ptx.FF_League.Add(l);

                    ptx.SaveChanges();

                    var p = from layer in ptx.FF_Player
                            where layer.ID == pid
                            select layer;

                    foreach (var y in p)
                    {
                        y.DRAFTED = true;
                        if (tid == 1)
                        {
                            y.MYTEAM = true;
                        }
                    }

                    ptx.SaveChanges();
                    ptx.Dispose();
                }

                using (FF2014Entities stx = new FF2014Entities())
                {
                    var s = from x in stx.FF_Turn
                            where x.ID == 1
                            select x;

                    foreach (var a in s)
                    {
                        int incr = a.DRAFTSPOT;
                        if (!a.UPDOWN)
                        {
                            if (a.DRAFTSPOT != a.MAXCOUNT)
                            {
                                incr++;
                            }
                            else
                            {
                                a.UPDOWN = true;
                            }
                        }
                        else
                        {
                            if (a.DRAFTSPOT != 1)
                            {
                                incr--;
                            }
                            else
                            {
                                a.UPDOWN = false;
                            }
                        }



                        a.DRAFTSPOT = incr;
                    }
                    stx.SaveChanges();
                    stx.Dispose();

                    //Update counters
                    updateCount(pid, true);
                }

                tags.Text = "";
                drafting  = getTurn();
                SetupPage();
                updateTeam();
                tags.Focus();
            }
            else
            {
                tags.Text = "";
            }
        }