Пример #1
0
        private void wsTrn_OnMessage(object sender, MessageEventArgs e)
        {
            //1:SC2FB Client GetTRN ile Istek yapar, Server gonderir FB ye kayit edilir
            //2:FB2SC Client PutTRN ile FB kayitlarini gonderir, duzeltme varsa gelir (Sadece ID duzeltilir)

            Trn d = JsonConvert.DeserializeObject <Trn>(e.Data);

            queriesTableAdapter.MDF_TRN(d.PutGet, d.NewID, d.ID, d.Stu, d.Ad, d.Tarih);
            textBox1.Invoke(new Action(() => textBox1.AppendText($"Trn: {d.PutGet} -> {d.NOR} {d.ID}\r\n")));

            TrnSay--;
        }
Пример #2
0
        private void PutTRN(long TrnID)
        {
            textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nTurnuvalar\r\n")));

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

            if (wsTrn.ReadyState == WebSocketState.Open)
            {
                int nor = 0;
                if (TrnID == 0)
                {
                    nor = trnTableAdapter.FillByStu(this.ds.TRN);
                }
                else
                {
                    nor = trnTableAdapter.FillByTrnStu(this.ds.TRN, TrnID);
                }

                TrnSay = nor;

                foreach (DataSet1.TRNRow row in ds.TRN.Rows)
                {
                    var obj = new Trn();
                    obj.NOR = nor--;

                    obj.ID    = row.ID;
                    obj.Stu   = row.STU;
                    obj.Tarih = row.IsTRHNull() ? "" : row.TRH.ToString("s");
                    obj.Ad    = row.AD;

                    string output = JsonConvert.SerializeObject(obj);
                    wsTrn.Send(output);
                }
            }
            else
            {
                textBox1.AppendText("--X\r\n");
            }
        }
Пример #3
0
        private void GetTRN()
        {
            textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nTurnuvalar\r\n")));

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

            if (wsTrn.ReadyState == WebSocketState.Open)
            {
                var obj = new Trn();
                obj.PutGet = "G";
                string output = JsonConvert.SerializeObject(obj);
                if (GetTrnSay() > 0)
                {
                    wsTrn.Send(output);
                }
            }
            else
            {
                textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nNo Connection\r\n")));
            }
        }