private void Label2_Click(object sender, EventArgs e)
        {
            Internlogin ob = new Internlogin();

            this.Hide();
            ob.Show();
        }
Esempio n. 2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string username = ConfigurationManager.AppSettings.Get("rpcusername");
            string passcode = ConfigurationManager.AppSettings.Get("rpcpassword");
            string url1     = ConfigurationManager.AppSettings.Get("wallet_url");
            string port     = ConfigurationManager.AppSettings.Get("wallet_port");

            RpcMethods obj = new RpcMethods(username, passcode, url1, port);

            try
            {
                string fn      = first.Text.Trim();
                string ln      = last.Text.Trim();
                string c       = college.Text.Trim();
                string r       = roll.Text.Trim();
                string m       = mobile.Text.Trim();
                string em      = email.Text.Trim();
                string p       = pass.Text;
                string t       = type.Text.Trim();
                string g       = guardian.Text.Trim();
                string YYYY    = yj.Text.Trim();
                string MM      = mj.Text.Trim();
                string DD      = dj.Text.Trim();
                string yyyy    = yc.Text.Trim();
                string mm      = mc.Text.Trim();
                string dd      = dc.Text.Trim();
                string jdate   = DD + "/" + MM + "/" + YYYY;
                string cdate   = dd + "/" + mm + "/" + yyyy;
                string n       = fn + " " + ln;
                string txid    = "";
                string qry     = string.Empty;
                string message = fn + "--" + ln + "--" + c + "--" + r + "--" + m + "--" + em + "--" + t + "--" + g + "--" + jdate + "--" + cdate + "--" + ComputeSha256Hash(p);



                JObject jobj = JObject.Parse(obj.SendToAddress(address, 1M, "test send", "testing 123", false, false, 1, "UNSET", message));
                if (string.IsNullOrEmpty(jobj["error"].ToString()))
                {
                    url += jobj["result"].ToString();

                    response.Text      = "MESSAGE SENT SUCCESSFULLY";
                    response.ForeColor = Color.Blue;
                    response.Visible   = true;
                    txid = jobj["result"].ToString();
                    using (SaveFileDialog sfd = new SaveFileDialog()
                    {
                        Filter = "JPEG|*.jpg", ValidateNames = true
                    })
                    {
                        if (sfd.ShowDialog() == DialogResult.OK)
                        {
                            MessagingToolkit.QRCode.Codec.QRCodeEncoder encoder = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
                            encoder.QRCodeScale = 8;
                            Bitmap bmp = encoder.Encode(jobj["result"].ToString());

                            qr.Image = bmp;

                            bmp.Save(sfd.FileName, ImageFormat.Jpeg);
                        }
                    }

                    SqlConnection conn = new SqlConnection(@"Data Source=BT1707113\SQLEXPRESS02;Initial Catalog=root;Integrated Security=True");
                    conn.Open();
                    qry = "insert into skills values ('" + n + "','" + txid + "',NULL,NULL,NULL,NULL,NULL,NULL,'0','" + t + "','" + jdate + "','" + cdate + "','" + g + "');";
                    SqlCommand cmd = new SqlCommand(qry, conn);
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    Internlogin ob = new Internlogin();
                    this.Hide();
                    ob.Show();
                }
                else
                {
                    response.Text      = "MESSAGE WAS NOT SENT";
                    response.ForeColor = Color.Blue;
                    response.Visible   = true;
                }
            }

            catch (RpcInternalServerErrorException ex1)
            {
                var    err_code    = 0;
                string err_message = "";
                if (ex1.RpcErrorCode.GetHashCode() != 0)
                {
                    err_code    = ex1.RpcErrorCode.GetHashCode();
                    err_message = ex1.RpcErrorCode.ToString();
                }
                Console.WriteLine("Error:" + err_code + "\n" + err_message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception:" + ex);
                response.Text    = "Message Not Sent";
                response.Visible = true;
            }
        }