public DataToSend Processing(DataToSend inputData)
        {
            ISocketService  socketService   = new SocketService();
            DataToSend      outputData      = new DataToSend();
            LoginMap        loginMap        = new LoginMap();
            DeviceMap       deviceMap       = new DeviceMap();
            AccountMap      accountMap      = new AccountMap();
            RegistrationMap registrationMap = new RegistrationMap();

            if (inputData.Action == MessageSocketData.SocketObj.Action.Login)
            {
                Console.WriteLine("Login...");
                LoginDTO   loginDTO   = loginMap.MapTo(inputData.FirstObject as LoginSocket);
                DeviceDTO  deviceDTO  = deviceMap.MapTo(inputData.SecondObject as DeviceSocket);
                AccountDTO accountDTO = new AccountDTO();
                accountDTO             = socketService.CheckUser(loginDTO, deviceDTO);
                outputData.FirstObject = accountMap.MapFrom(accountDTO);
            }
            if (inputData.Action == MessageSocketData.SocketObj.Action.Registration)
            {
                Console.WriteLine("Registration...");
                RegistrationDTO registrationDTO = registrationMap.MapTo(inputData.FirstObject as RegistrationSocket);


                bool answer = socketService.GetRegistration(registrationDTO);
                outputData.Boolean = answer;
            }


            return(outputData);
        }
Esempio n. 2
0
        private static void TimerElapsed(object sender, ElapsedEventArgs e)
        {
            var gameState = Game.GetActaulState();

            foreach (var client in Game.Clients)
            {
                var success = gameState.PlayersXPositions.TryGetValue(client.Key, out double opponent);
                if (!success)
                {
                    return;
                }

                var dataToSend = new DataToSend()
                {
                    Opponent = opponent,
                    BallX    = gameState.BallX,
                    BallY    = gameState.BallY,
                    Speed    = gameState.Speed,
                    Degree   = gameState.Degree,
                    Score    = gameState.Score
                };

                var json = JsonConvert.SerializeObject(dataToSend);
                client.Value.Send(json);
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            rand = new Random();

            clients = new Deck <Client>();

            server = new TcpListener(IPAddress.Any, 1337);

            myIP = DataToSend.GetLocalIPAddress();

            server.Start();
            Console.WriteLine("Server : ON\nIpAdresse : " + myIP + "\nPort : " + ((IPEndPoint)server.LocalEndpoint).Port.ToString());

            waitingSaloon = new Thread(WaitingSaloon);
            listenMJ      = new Thread(ListenMJ);

            waitingSaloon.Start();

            /***** Test *****/

            /*clients.Add(new Client());
            *  clients.Add(new Client());
            *  clients.Add(new Client());
            *  clients.Add(new Client());*/
            //InitializeParty();

            /*** END TEST ***/
        }
        public void DoSend()
        {
            List <byte> data = new List <byte>();

            if (IsHex)
            {
                string[] characters = DataToSend.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string hex in characters)
                {
                    byte value = Convert.ToByte(hex, 16);
                    data.Add(value);
                }
            }

            if (IsText)
            {
                string parsed = DataToSend.Replace("\\\\r", "\r").Replace("\\\\n", "\n");
                data.AddRange(System.Text.Encoding.ASCII.GetBytes(parsed));
            }

            _eventAggregator.PublishOnUIThread(new Messages.SerialPortSend()
            {
                Data = data.ToArray()
            });
        }
Esempio n. 5
0
 static void DispatcherReceive(DataToSend data)
 {
     if (data.command == Command.NbPlayer)
     {
         int nbPlayer = (int)data.data;
         Console.WriteLine("Il y a " + nbPlayer + " joueurs dans la partie");
     }
     else if (data.command == Command.StringToDraw)
     {
         Console.WriteLine((string)data.data);
         string str = (string)data.data;
         if (str.Contains("votre tour"))
         {
             if (!sendData.IsAlive)
             {
                 sendData.Start();
             }
         }
     }
     else if (data.command == Command.Quit)
     {
         Console.WriteLine((string)data.data);
         CloseStream();
     }
     else if (data.command == Command.isTurn)
     {
         sendData.Start();
     }
 }
Esempio n. 6
0
        public bool Registration(RegistrationDTO registrationDTO)
        {
            NetworkStream   networkStream = tcpClient.GetStream();
            BinaryFormatter bf            = new BinaryFormatter();


            DataToSend dataToSend = new DataToSend()
            {
                FirstObject = new RegistrationSocket()
                {
                    Email          = registrationDTO.Email,
                    Login          = registrationDTO.Login,
                    Password       = registrationDTO.Password,
                    PhoneNumber    = registrationDTO.PhoneNumber,
                    RepeatPassword = registrationDTO.RepeatPassword
                },
                Action = MessageSocketData.SocketObj.Action.Registration,
            };


            bf.Serialize(networkStream, dataToSend);


            ///////////////////////////////////////////////////////////////
            DataToSend answer = bf.Deserialize(tcpClient.GetStream()) as DataToSend;
            bool       obj    = (answer.Boolean);

            return(obj);
        }
Esempio n. 7
0
    // Start is called before the first frame update
    void Start()
    {
        //using the serializable object to send the data to the server
        DataToSend progressData = new DataToSend();

        progressData.uname = PlayerPrefs.GetString("username"); //only need username to delete the data
        string jsonData = JsonUtility.ToJson(progressData);

        //need to set this data back to default in indexeddb
        PlayerPrefs.SetString("level", "Level1");
        PlayerPrefs.SetInt("upgrade", 0);
        PlayerPrefs.SetString("skin", "normal");
        if (PlayerPrefs.GetInt("isFB") == 1)
        {
            PlayerPrefs.SetInt("health", 150);
            PlayerPrefs.SetInt("score", 50);
        }
        else
        {
            PlayerPrefs.SetInt("health", 100);
            PlayerPrefs.SetInt("score", 0);
        }
        PlayerPrefs.SetInt("speed", 7);
        PlayerPrefs.SetInt("nectarpoints", 1);
        PlayerPrefs.SetInt("bosshealth", 400);

        //send the request to delete the data
        StartCoroutine(PostUsername("https://vesta.uclan.ac.uk/~diqbal/UnityScripts/deleteData.php", jsonData));
    }
        private void SendData()
        {
            var stringData = DataToSend.Replace(Environment.NewLine, " ");

            WriteData(IsHex
                ? FormatConverter.HexStringToByteArray(stringData)
                : FormatConverter.StringToByteArray(stringData));
        }
Esempio n. 9
0
 static void DispatcherSend(string command)
 {
     if (command == @"\nbPlayer")
     {
         DataToSend.SendData(myIpAdress, Command.NbPlayer, null, stream);
     }
     else if (command == @"\GetCards")
     {
         DataToSend.SendData(myIpAdress, Command.GetCards, null, stream);
     }
     else if (command == @"\Quit")
     {
         DataToSend.SendData(myIpAdress, Command.Quit, null, stream);
     }
     else if (command == @"\EndTurn")
     {
         DataToSend.SendData(myIpAdress, Command.EndTurn, null, stream);
         sendData.Abort();
     }
     else if (command.Contains(@"\PlayCard"))
     {
         string[] split       = command.Split(' ');
         int      indexCard   = -1;
         bool     isOk1       = int.TryParse(split[1], out indexCard);
         int      indexTarget = -1;
         bool     isOk2       = int.TryParse(split[2], out indexTarget);
         if (isOk1)
         {
             DataToSend.SendData(myIpAdress, Command.PlayCard, new object[] { indexCard, indexTarget }, stream);
         }
         else
         {
             Console.WriteLine("Erreur dans la commande !");
         }
     }
     else if (command == @"\PlayersInfo")
     {
         DataToSend.SendData(myIpAdress, Command.PlayersInfo, null, stream);
     }
     else if (command.Contains(@"\PlayerInfo"))
     {
         string[] split       = command.Split(' ');
         int      indexPlayer = -1;
         bool     isOk        = int.TryParse(split[1], out indexPlayer);
         if (isOk)
         {
             DataToSend.SendData(myIpAdress, Command.PlayerInfo, indexPlayer, stream);
         }
         else
         {
             Console.WriteLine("Erreur dans la commande !");
         }
     }
     else
     {
         Console.WriteLine("La commande n'existe pas !");
     }
 }
Esempio n. 10
0
    // Start is called before the first frame update
    void Start()
    {
        //setting the data into the object
        DataToSend progressData = new DataToSend();

        progressData.uname = PlayerPrefs.GetString("username");
        string jsonData = JsonUtility.ToJson(progressData);

        //post the username to the server to delete the data
        StartCoroutine(PostUsername("https://vesta.uclan.ac.uk/~diqbal/UnityScripts/deleteData.php", jsonData));
    }
Esempio n. 11
0
    private void DealWithInfoResponse(IGraphResult result)
    {
        //add the user to the db too using their email
        PlayerInfo playerInfo = JsonUtility.FromJson <PlayerInfo>(result.RawResult);
        DataToSend userData   = new DataToSend();

        userData.uname = playerInfo.email;
        userData.pass  = "******";

        string jsonData = JsonUtility.ToJson(userData);

        StartCoroutine(PostRequestJSONFB("https://vesta.uclan.ac.uk/~diqbal/UnityScripts/login.php", jsonData, userData.uname));
    }
    //upload the highscore to the db
    public void UploadHighScore()
    {
        DataToSend progressData = new DataToSend();

        progressData.score = PlayerPrefs.GetInt("score");
        progressData.uname = PlayerPrefs.GetString("username");
        string jsonData = JsonUtility.ToJson(progressData);

        //save the highscore
        StartCoroutine(PostHS("https://vesta.uclan.ac.uk/~diqbal/UnityScripts/saveHS.php", jsonData));

        //open the highscore scnee
        OpenHS();
    }
Esempio n. 13
0
 static void WaitingData()
 {
     while (true)
     {
         byte[] bytes  = new byte[DataToSend.bufferSize];
         int    result = stream.Read(bytes, 0, bytes.Length);
         if (result == -1)
         {
             continue;
         }
         DataToSend data = (DataToSend)ISerialize.Deserialize(bytes);
         DispatcherReceive(data);
     }
 }
Esempio n. 14
0
        public DataToSend Receive()
        {
            // Receiving data bytes from server
            var stream = _client.GetStream();
            var buffer = new byte[2048];

            stream.Read(buffer, 0, buffer.Length);

            // Deserializing bytes
            var dataReceived = DataToSend.Deserialize(buffer);

            // Returning the result
            return(dataReceived);
        }
Esempio n. 15
0
        static void Dispatcher(DataToSend data)
        {
            int clientID = clients.GetIDByIp(data.ipAddr);

            Console.WriteLine("Client " + clientID + " ( " + data.ipAddr + " ) : Commande -> " + data.command.ToString());
            if (data.command == Command.NbPlayer)
            {
                SendMessage(clientID, new DataToSend(myIP, Command.NbPlayer, clients.Count));
            }
            else if (data.command == Command.GetCards)
            {
                SendMessage(clientID, new DataToSend(myIP, Command.StringToDraw, gameState.GetCards(clientID)));
            }
            else if (data.command == Command.Quit)
            {
                SendMessage(clientID, new DataToSend(myIP, Command.Quit, "Vous avez quitté la partie !"));
                if (listenMJ.IsAlive)
                {
                    isOkListenMJ = false;
                }
                clients.RemoveAt(clientID);
                if (!listenMJ.IsAlive)
                {
                    isOkListenMJ = true;
                }

                SendMessageToAll("Le client " + clientID + " vient de quitter la partie"); // To uncomment for build
            }
            else if (data.command == Command.EndTurn)
            {
                gameState.NextPlayer();
            }
            else if (data.command == Command.PlayCard)
            {
                object[] parameters  = (object[])data.data;
                int      indexCard   = (int)parameters[0];
                int      indexTarget = (int)parameters[1];
                string   targetCard  = (string)parameters[2];
                gameState.PlayCard(clientID, indexCard, indexTarget, targetCard);
            }
            else if (data.command == Command.PlayerInfo)
            {
                SendMessage(clientID, new DataToSend(myIP, Command.StringToDraw, gameState.GetPlayerInfo(clientID, (int)data.data)));
            }
            else if (data.command == Command.PlayersInfo)
            {
                SendMessage(clientID, new DataToSend(myIP, Command.StringToDraw, gameState.GetPlayersInfo()));
            }
        }
Esempio n. 16
0
 public void SetSettings(int num_vertical_leds, int num_horizontal_leds, bool have_corner_leds)
 {
     if (num_vertical_leds > 0 && num_horizontal_leds > 0)
     {
         if (data == null)
         {
             data = new DataToSend(num_vertical_leds, num_horizontal_leds);
         }
         else
         {
             data.RefreshSettings(num_vertical_leds, num_horizontal_leds);
         }
         this.have_corner_leds = have_corner_leds;
     }
 }
Esempio n. 17
0
        static void Main(string[] args)
        {
            TcpListener tcpListener = new TcpListener(IPAddress.Parse(ip), port);

            tcpListener.Start();

            Console.WriteLine($"<<SOCKET>> Server(ip:{ip}, port: {port}) started...");


            while (true)
            {
                TcpClient     tcpClient     = tcpListener.AcceptTcpClient();
                NetworkStream networkStream = tcpClient.GetStream();



                Console.WriteLine("Connect");
                try
                {
                    ///Get data from client


                    BinaryFormatter bf1         = new BinaryFormatter();
                    DataToSend      dataRequest = bf1.Deserialize(tcpClient.GetStream()) as DataToSend;

                    Console.WriteLine(dataRequest.FirstObject.ToString() + " " + dataRequest.Action.ToString());


                    DataToSend answerData = new DataToSend();
                    ///Do something with data
                    DataProcessing dataProcessing = new DataProcessing();



                    answerData = dataProcessing.Processing(dataRequest);

                    ///Send data to client
                    BinaryFormatter bf2 = new BinaryFormatter();
                    bf2.Serialize(networkStream, answerData);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    tcpClient.Close();
                }
            }
            Console.ReadKey();
        }
Esempio n. 18
0
        public void sendGraph(Graph graf, Threats threats)
        {
            // Creating stream and encoder
            Stream        stm  = tcpclnt.GetStream();
            ASCIIEncoding asen = new ASCIIEncoding();

            // Packing, serializing and encoding data to send
            DataToSend toSend     = new DataToSend(graf, threats);
            string     jsonString = JsonConvert.SerializeObject(toSend);

            byte[] ba = asen.GetBytes(jsonString);

            Console.WriteLine("Sending data about graph and threats to server ...");
            // Writing data to stream
            stm.Write(ba, 0, ba.Length);
        }
Esempio n. 19
0
    //used to save the current game progress
    public void SaveGame()
    {
        //create an instance of the serializable object
        DataToSend progressData = new DataToSend();

        /*
         * setting the data that needs to be saved to the corresponding variable in the object
         */
        progressData.skin    = LevelManager.spriteType;
        progressData.upgrade = LevelManager.timesUpgraded;
        progressData.level   = level;
        progressData.score   = LevelManager.score;
        if (level == "Level1" || level == "Level2")
        {
            //level 1 and 2 saved data is different to boss level
            progressData.health = PlayerScript.health;
            progressData.uname  = PlayerPrefs.GetString("username");
            progressData.speed  = PlayerScript.speed;
            PlayerPrefs.SetInt("bosshealth", PlayerPrefs.GetInt("bosshealth"));
            progressData.bosshealth = PlayerPrefs.GetInt("bosshealth");
        }
        else if (level == "BossLevel")
        {
            //save the boss level data
            progressData.health     = BossLevelPlayerScript.health;
            progressData.uname      = PlayerPrefs.GetString("username");
            progressData.speed      = BossLevelPlayerScript.speed;
            progressData.bosshealth = Boss.bossHealth;
        }
        progressData.nectarpoints = NectarPickup.nectarValue;
        string jsonData = JsonUtility.ToJson(progressData);

        //set the data in the indexed db
        PlayerPrefs.SetString("level", progressData.level);
        PlayerPrefs.SetInt("upgrade", progressData.upgrade);
        PlayerPrefs.SetString("skin", progressData.skin);
        PlayerPrefs.SetInt("score", progressData.score);
        PlayerPrefs.SetInt("health", progressData.health);
        PlayerPrefs.SetInt("speed", progressData.speed);
        PlayerPrefs.SetInt("nectarpoints", progressData.nectarpoints);
        PlayerPrefs.SetInt("bosshealth", progressData.bosshealth);

        //post the data to save to the server
        StartCoroutine(PostRequestJSON("https://vesta.uclan.ac.uk/~diqbal/UnityScripts/saveData.php", jsonData));
    }
Esempio n. 20
0
        public async Task <bool> CreateRoute(Route route)
        {
            var json    = JsonConvert.SerializeObject(route);
            var content = new StringContent(json, Encoding.UTF8, "application/json");

            try
            {
                var response = await Client.PostAsync(_routesUri, content);

                return(true);
            }
            catch (Exception)
            {
                var dataToSend = new DataToSend(json, _routesUri);
                _userLocalRepository.CreateDataToSend(dataToSend);

                return(false);
            }
        }
Esempio n. 21
0
        public AccountDTO LoginService(LoginDTO loginDTO, DeviceDTO deviceDTO)
        {
            NetworkStream   networkStream = tcpClient.GetStream();
            BinaryFormatter bf            = new BinaryFormatter();


            DataToSend dataToSend = new DataToSend()
            {
                FirstObject = new LoginSocket()
                {
                    Username = loginDTO.Username, Password = loginDTO.Password
                },
                Action       = MessageSocketData.SocketObj.Action.Login,
                SecondObject = new DeviceSocket()
                {
                    DeviceId   = deviceDTO.DeviceId,
                    DeviceIp   = deviceDTO.DeviceIp,
                    DeviceName = deviceDTO.DeviceName,
                    DeviceTime = deviceDTO.DeviceTime
                }
            };


            bf.Serialize(networkStream, dataToSend);


            ///////////////////////////////////////////////////////////////
            DataToSend answer     = bf.Deserialize(tcpClient.GetStream()) as DataToSend;
            var        obj        = (answer.FirstObject as AccountSocket);
            AccountDTO accountDTO = new AccountDTO()
            {
                Email       = obj.Email,
                Id          = obj.Id,
                Img         = obj.Img,
                Login       = obj.Login,
                Password    = obj.Password,
                PhoneNumber = obj.PhoneNumber,
                Role        = obj.Role,
                Token       = obj.Token
            };

            return(accountDTO);
        }
Esempio n. 22
0
        public async Task <bool> CreateRankingRecordAsync(RankingRecord currentTry, Guid routeId)
        {
            var json    = JsonConvert.SerializeObject(currentTry);
            var content = new StringContent(json, Encoding.UTF8, "application/json");
            var uri     = $"{_routesUri}/{routeId}/ranking-record";

            try
            {
                var response = await Client.PostAsync(uri, content);

                return(true);
            }
            catch (Exception)
            {
                var dataToSend = new DataToSend(json, uri);
                _userLocalRepository.CreateDataToSend(dataToSend);

                return(false);
            }
        }
Esempio n. 23
0
        public DataToSend listen()
        {
            // Receiving data from client
            byte[] b = new byte[Constants.MAXSIZE];
            int    k = socket.Receive(b);

            // Decoding message to json string
            var jsonReceived = new StringBuilder();

            Console.WriteLine("Recieved...");
            for (int i = 0; i < k; i++)
            {
                jsonReceived.Append(Convert.ToChar(b[i]));
            }
            string strr = jsonReceived.ToString();

            // From json to Object
            DataToSend receivedData = JsonConvert.DeserializeObject <DataToSend>(strr);

            return(receivedData);
        }
Esempio n. 24
0
    //do the user login with the input details
    public void UserLogin()
    {
        DataToSend userData = new DataToSend();

        //get the text and set it into variables
        userData.uname = unameIF.text;
        userData.pass  = passIF.text;

        //details need to be filled
        if (userData.uname == "" || userData.pass == "")
        {
            error.text = "Dont leave the inputs blank";
        }
        else
        {
            string jsonData = JsonUtility.ToJson(userData);

            //send the login request to the server
            StartCoroutine(PostRequestJSON("https://vesta.uclan.ac.uk/~diqbal/UnityScripts/login.php", jsonData));
        }
    }
    //starts a new game
    public void StartGame()
    {
        //need to load level1 as a new game
        SceneManager.LoadScene("Level1");
        DataToSend progressData = new DataToSend();

        //set the progress data to new data
        progressData.skin    = "normal";
        progressData.upgrade = 0;
        progressData.level   = "Level1";
        progressData.score   = 0;
        if (PlayerPrefs.GetInt("isFB") == 1)
        {
            progressData.health = 150;
            progressData.score  = 50;
        }
        else
        {
            progressData.health = 100;
            progressData.score  = 0;
        }
        progressData.uname        = PlayerPrefs.GetString("username");
        progressData.speed        = 7;
        progressData.nectarpoints = 1;
        progressData.bosshealth   = 400;
        string jsonData = JsonUtility.ToJson(progressData);

        //set the new data to indexeddb too
        PlayerPrefs.SetString("level", progressData.level);
        PlayerPrefs.SetInt("upgrade", progressData.upgrade);
        PlayerPrefs.SetString("skin", progressData.skin);
        PlayerPrefs.SetInt("score", progressData.score);
        PlayerPrefs.SetInt("health", progressData.health);
        PlayerPrefs.SetInt("speed", progressData.speed);
        PlayerPrefs.SetInt("nectarpoints", progressData.nectarpoints);
        PlayerPrefs.SetInt("bosshealth", progressData.bosshealth);

        //post the dta to the server to save it
        StartCoroutine(PostRequestJSON("https://vesta.uclan.ac.uk/~diqbal/UnityScripts/saveData.php", jsonData));
    }
Esempio n. 26
0
        private void Reject(TcpClient client, int clientId)
        {
            var stream = client.GetStream();

            var dataType = new DataToSend
            {
                ClientState = ClientState.Rejected,
                GameData    = _gameData
            };

            // Serializing data to bytes
            byte[] data = dataType.Serialize();

            // Sending data
            stream.Write(data, 0, data.Length);

            Log($"Data sent to id: {clientId}.");

            // Closing the connection
            stream.Close();
            client.Close();
        }
Esempio n. 27
0
        private void Accept(TcpClient client, int clientId)
        {
            var stream = client.GetStream();

            // Adding new player to game data
            var player = new PlayerData("Michau", clientId);

            _gameData.AddPlayer(player);

            // Creating data to send
            var dataType = new DataToSend
            {
                GameData    = _gameData,
                ClientId    = clientId,
                ClientState = ClientState.Accepted
            };

            for (int i = 0; i < 1000; i++)
            {
                // Changing data
                player.PositionX = i;
                player.PositionY = 1000 - i;
                // Serializing data to bytes
                var data = dataType.Serialize();

                // Sending data
                stream.Write(data, 0, data.Length);

                Log($"Data sent to id: {clientId}.");

                Thread.Sleep(1000);
            }

            // Closing the connection
            stream.Close();
            client.Close();
        }
Esempio n. 28
0
        static void ListenMJ()
        {
            if (clients.Count == 0)
            {
                Console.WriteLine("!!! Il n'y a aucun joueur de connecté !!!");
                return;
            }
            Client client = clients[0]; // FOR BUILD

            //Client client = clients[clients.Count - 1]; // FOR TEST
            Console.WriteLine("Actually listenning the client " + client.ID);
            SendMessage(client.ID, new DataToSend(myIP, Command.StringToDraw, "Il y a plusieurs joueurs de connecté"));
            //InitializeParty(); //HERE FOR TEST TO REMOVE FOR BUILD
            while (isOkListenMJ)
            {
                byte[] bytes = client.ReceiveMessage(DataToSend.bufferSize); // Peut être source de problème à check
                if (bytes.Length == 0)
                {
                    continue;
                }
                DataToSend data = (DataToSend)ISerialize.Deserialize(bytes);
                Dispatcher(data);
            }
        }
Esempio n. 29
0
        static void Main(string[] args)
        {
            Console.Write("Adresse Ip du serveur : ");
            string ipToConnect = Console.ReadLine();

            Console.Write("Port du serveur : ");
            int portToConnect = int.Parse(Console.ReadLine());

            client = new TcpClient(ipToConnect, portToConnect);
            //client = new TcpClient("192.168.1.68", 1337);
            //client = new TcpClient("10.33.3.209", 1337);
            //client = new TcpClient("192.168.0.239", 1337);

            stream = client.GetStream();


            myIpAdress = DataToSend.GetLocalIPAddress();

            waitingData = new Thread(WaitingData);
            waitingData.Start();

            sendData = new Thread(SendData);
            sendData.Start();
        }
Esempio n. 30
0
 public void CreateDataToSend(DataToSend dataToSend)
 {
     Db.Insert(dataToSend);
 }