Ejemplo n.º 1
0
        private void wsTrnTkmOyn_OnMessage(object sender, MessageEventArgs e)
        {
            TrnTkmOyn d = JsonConvert.DeserializeObject <TrnTkmOyn>(e.Data);

            queriesTableAdapter.MDF_TRNTKMOYN(d.PutGet, d.NewID, d.ID, d.Stu, d.TrnID, d.TkmID, d.OynID);
            textBox1.Invoke(new Action(() => textBox1.AppendText($"TrnTkm: {d.PutGet} -> {d.NOR} {d.ID}\r\n")));

            TrnTkmOynSay--;
        }
Ejemplo n.º 2
0
        private void PutTRNTKMOYN(long TrnID)
        {
            textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nTurnuva Takımları\r\n")));

            if (wsTrnTkmOyn.ReadyState != WebSocketState.Open)
            {
                wsTrnTkmOyn.Connect();
            }

            if (wsTrnTkmOyn.ReadyState == WebSocketState.Open)
            {
                int nor = 0;
                if (TrnID == 0)
                {
                    nor = trntkmoynTableAdapter.FillByStu(this.ds.TRNTKMOYN);
                }
                else
                {
                    nor = trntkmoynTableAdapter.FillByTrnStu(this.ds.TRNTKMOYN, TrnID);
                }

                TrnTkmOynSay = nor;

                foreach (DataSet1.TRNTKMOYNRow row in ds.TRNTKMOYN.Rows)
                {
                    var obj = new TrnTkmOyn();
                    obj.NOR = nor--;

                    obj.ID    = row.ID;
                    obj.Stu   = row.STU;
                    obj.TrnID = row.TRNID;
                    obj.TkmID = row.TKMID;
                    obj.OynID = row.OYNID;

                    string output = JsonConvert.SerializeObject(obj);
                    wsTrnTkmOyn.Send(output);
                }
            }
            else
            {
                textBox1.AppendText("--X\r\n");
            }
        }