public void AddGenesisBlock(string type)
        {
            switch (type)
            {
            case "credentrails":
                BlockchainCredentials bcCredentials = new BlockchainCredentials();
                Chain.Add(new Block(DateTime.Now, null, bcCredentials));
                break;

            case "data":
                BlockchainData bcData = new BlockchainData();
                Chain.Add(new Block(DateTime.Now, null, bcData));
                break;

            case "reports":
                BlockchainReports bcReports = new BlockchainReports();
                Chain.Add(new Block(DateTime.Now, null, bcReports));
                break;

            case "ratings":
                BlockchainRatings bcRatings = new BlockchainRatings();
                Chain.Add(new Block(DateTime.Now, null, bcRatings));
                break;
            }
        }
 public Block(DateTime timeStamp, string previousHash, BlockchainReports data)
 {
     Index        = 0;
     TimeStamp    = timeStamp.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffff");
     PreviousHash = previousHash;
     DataReports  = data;
     Hash         = CalculateHash();
 }
        private void BtnReport_Click(object sender, RoutedEventArgs e)
        {
            if (txtMarked.Text != "" && (End != 0))
            {
                InitializeSender();

                MessagePack       mp = new MessagePack();
                BlockchainReports br = new BlockchainReports(ArticleID, UserID, txtMarked.Text, cmbCategory.Text, txtComment.Text, Start, End, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                mp.SmObj = new Block(System.DateTime.Now, null, br);
                mp.Text  = "newBlockReports";
                byte[] data = Blockchain.ObjectToByteArray(mp);
                sendingClient.Send(data, data.Length);
                this.Close();
            }
            else
            {
                MessageBox.Show("Proszę najpierw prawidłowo zaznaczyć fragment artykułu.");
            }
        }