Пример #1
0
        public Certificate(string str1, string str2, int str4, string str5, string str6, string str7, string str8)
        {
            InitializeComponent();
            name.Text   = str1;
            course.Text = str2;
            marks.Text  = str4.ToString();
            grade.Text  = str5;
            jdate.Text  = str6;
            cdate.Text  = str7;
            DateTime now = DateTime.Now;

            parentname.Text = str8;
            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  flodata = str1 + "**" + str8 + "**" + str2 + "**" + str5 + "**" + str6 + "**" + str7 + "**" + now.ToString() + "**" + "DIGITAL SIGNATURE BY:-366piTECH";
                JObject Jobj    = JObject.Parse(obj.SendToAddress(address, 1M, "test send", "testing 123", false, false, 1, "UNSET", flodata));
                if (string.IsNullOrEmpty(Jobj["error"].ToString()))
                {
                    url += Jobj["result"].ToString();
                }
            }
            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();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception:" + ex);
            }
        }
        internal Response MakeTransaction(Candidate candidate)
        {
            Response res     = new Response();
            string   message = "This is to certify that '" + candidate.name + "' has successfully completed the Web Design certification course at LearnUp Labs, Ranchi from 20th December 2019 to 24th December 2019";

            try
            {
                JObject jobj = JObject.Parse(RpcObj.SendToAddress(address, 0.00001M, "BLOCKCHAIN SUMMIT 2019 RANCHI", "BLOCKCHAIN SUMMIT 2019 RANCHI", false, false, 1, "UNSET", message));
                if (string.IsNullOrEmpty(jobj["error"].ToString()))
                {
                    transtrackurl += jobj["result"].ToString();
                    res.resp       = true;
                    res.type       = "Successful";
                    res.transID    = jobj["result"].ToString();

                    MessagingToolkit.QRCode.Codec.QRCodeEncoder encoder = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
                    encoder.QRCodeScale = 8;
                    Bitmap bmp = encoder.Encode(transtrackurl);

                    bmp.Save(FileName, ImageFormat.Jpeg);
                }
                else
                {
                    res.resp = false;
                    res.type = "Response Error";
                }
            }
            catch (RpcInternalServerErrorException rpc_exp)
            {
                res.resp = false;
                res.type = "Rpc Server Error Exception";
            }
            catch (Exception exp)
            {
                res.resp = false;
                res.type = "General Exception";
            }

            return(res);
        }
Пример #3
0
        static void Main(string[] args)
        {
            string username    = ConfigurationManager.AppSettings.Get("username");
            string password    = ConfigurationManager.AppSettings.Get("password");
            string wallet_url  = ConfigurationManager.AppSettings.Get("wallet_url");
            string wallet_port = ConfigurationManager.AppSettings.Get("wallet_port");


            RpcMethods rpc = new RpcMethods(username, password, wallet_url, wallet_port);


            try
            {
                //Get Info
                JObject obj = JObject.Parse(rpc.GetInfo());

                if (string.IsNullOrEmpty(obj["error"].ToString()))
                {
                    Console.WriteLine("Get Info : " + obj["result"]);
                }
                else
                {
                    Console.WriteLine("Get Info Error : " + obj["error"]);
                }


                //Get Help

                obj = JObject.Parse(rpc.Help("getinfo"));

                if (string.IsNullOrEmpty(obj["error"].ToString()))
                {
                    Console.WriteLine("Get Help : " + obj["result"]);
                }
                else
                {
                    Console.WriteLine("Get Help Error : " + obj["error"]);
                }

                //Get Balance

                obj = JObject.Parse(rpc.GetBalance(""));

                if (string.IsNullOrEmpty(obj["error"].ToString()))
                {
                    Console.WriteLine("Balance : " + obj["result"]);
                }
                else
                {
                    Console.WriteLine("Get Balance Error : " + obj["error"]);
                }

                //Get Wallet Info
                obj = JObject.Parse(rpc.GetWalletInfo());

                if (string.IsNullOrEmpty(obj["error"].ToString()))
                {
                    Console.WriteLine("Wallet Info : " + obj["result"]);
                }
                else
                {
                    Console.WriteLine("Wallet Info Error : " + obj["error"]);
                }

                //Send Transaction
                obj = JObject.Parse(rpc.SendToAddress("Flo Address", 1.0M, "Test comment", "Test Comment", false, false, 1, "UNSET", "This is a test message"));

                if (string.IsNullOrEmpty(obj["error"].ToString()))
                {
                    Console.WriteLine("Transaction ID : " + obj["result"]);
                }
                else
                {
                    Console.WriteLine("Send Transaction Error : " + obj["error"]);
                }
            }
            catch (RpcInternalServerErrorException exception)
            {
                var errorCode    = 0;
                var errorMessage = string.Empty;

                if (exception.RpcErrorCode.GetHashCode() != 0)
                {
                    errorCode    = exception.RpcErrorCode.GetHashCode();
                    errorMessage = exception.RpcErrorCode.ToString();
                }

                Console.WriteLine("[Failed] {0} {1} {2}", exception.Message, errorCode != 0 ? "Error code: " + errorCode : string.Empty, !string.IsNullOrWhiteSpace(errorMessage) ? errorMessage : string.Empty);
            }
            catch (Exception exception)
            {
                Console.WriteLine("[Failed]\n\nPlease check your configuration and make sure that the daemon is up and running and that it is synchronized. \n\nException: " + exception);
            }

            Console.Read();
        }
Пример #4
0
        private void Submit_Click(object sender, EventArgs e)
        {
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "insert into [Short Details Table] (ApplicationNumber,Title,CopyrightDate,AuthorName,StatementOfRight) values('" + textBox11.Text + "','" + titlebox.Text + "','" + dateTimePicker1.Text + "','" + namebox.Text + "','" + listBox1.Text + "')";
            cmd.ExecuteNonQuery();
            con.Close();

            string     username    = ConfigurationManager.AppSettings.Get("rpcusername");
            string     password    = ConfigurationManager.AppSettings.Get("rpcpassword");
            string     wallet_url  = ConfigurationManager.AppSettings.Get("wallet_url");
            string     wallet_port = ConfigurationManager.AppSettings.Get("wallet_port");
            string     flodata     = "";
            RpcMethods rpc         = new RpcMethods(username, password, wallet_url, wallet_port);

            try
            {
                string title   = titlebox.Text;
                string date    = dateTimePicker1.Text;
                string name    = namebox.Text;
                string right   = listBox1.Text;
                string send_to = "oYKg7fpcQs4DCmLSwqJvUFpnnXLdffGGkm";



                if ((titlebox.Text == "") || (dateTimePicker1.Text == "") || (namebox.Text == "") || (send_to == ""))
                {
                    MessageBox.Show("FILL UP ALL THE DETAILS");
                }
                else if ((listBox1.SelectedIndex == -1) || (listBox1.Text == "(none)"))
                {
                    MessageBox.Show("Select either one of the statement of rights\n scroll down and  CLICK on the options to select.");
                }
                else
                {
                    flodata = " \t" + title + "\n" + "copyright ©" + date + " " + name + " " + right;

                    JObject jobj = JObject.Parse(rpc.SendToAddress(send_to, 0.01M, "copyright system", "copyright", false, false, 1, "UNSET", flodata));

                    if (string.IsNullOrEmpty(jobj["error"].ToString()))
                    {
                        url               += jobj["result"];
                        labelmsg.Text      = "Details saved successfully to FLO";
                        labelmsg.Visible   = true;
                        labelmsg.ForeColor = Color.White;
                        data.Text          = flodata;
                        data.Visible       = true;
                        data.ForeColor     = Color.White;
                        linkLabel1.Visible = true;
                    }
                    else
                    {
                        labelmsg.Text      = "Error!!!" + "could not retrieve any transaction details..plzz check ur address";
                        labelmsg.Visible   = true;
                        labelmsg.ForeColor = Color.Red;
                    }
                }
            }
            catch (RpcInternalServerErrorException ex)
            {
                var errCode    = 0;
                var errMessage = string.Empty;
                if (ex.RpcErrorCode.GetHashCode() != 0)
                {
                    errCode    = ex.RpcErrorCode.GetHashCode();
                    errMessage = ex.RpcErrorCode.ToString();
                }
                Console.WriteLine("Exception :" + errCode + "-" + errMessage);


                labelmsg.Text      = "INternal server error!!";
                labelmsg.ForeColor = Color.Red;
                labelmsg.Visible   = true;
                labelmsg.Visible   = true;
            }
            catch (Exception ex1)
            {
                Console.WriteLine("Exception :" + ex1.ToString());
                labelmsg.Text      = "Error connecting to the server!!";
                labelmsg.ForeColor = Color.White;
                labelmsg.Visible   = true;
                labelmsg.Visible   = true;
                MessageBox.Show(labelmsg.Text);
                MessageBox.Show(flodata);
            }
        }
        private void student_form_Load(object sender, EventArgs e)
        {
            con = new SqlConnection(connstr);
            con.Open();
            //string cert = "PTRN005";
            //int count=0;

            lblReg_no.Text    = r;
            lblIssueDate.Text = DateTime.Now.ToShortDateString();


            //count++;
            //label31.Text = cert + count.ToString();

            cmd = new SqlCommand("select Name,Fathers_name,Course,Grade,Marks,Date_j,Date_c from student where Reg_no = @rn", con);
            cmd.Parameters.Add(new SqlParameter("@rn", lblReg_no.Text));
            //cmd.Parameters.Add(new SqlParameter("@r", comboBox1.Text));
            dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                lblName.Text         = (dr[0].ToString());
                lblGuardianName.Text = (dr[1].ToString());
                lblCourse.Text       = (dr[2].ToString());
                lblGrade.Text        = (dr[3].ToString());
                lblPercent.Text      = (dr[4].ToString());
                DateTime dt = DateTime.Parse(dr[5].ToString());
                lblDoj.Text             = (dt.ToString("dd-MM-yyyy"));
                dt                      = DateTime.Parse(dr[6].ToString());
                lblCompletion_Date.Text = (dt.ToString("dd-MM-yyyy"));
            }
            lblCertificate_no.Text = DateTime.Now.ToString("ddMMyyyyhhmmss");

            con.Close();


            string username    = ConfigurationManager.AppSettings.Get("username");
            string password    = ConfigurationManager.AppSettings.Get("password");
            string wallet_url  = ConfigurationManager.AppSettings.Get("wallet_url");
            string wallet_port = ConfigurationManager.AppSettings.Get("wallet_port");


            RpcMethods rpc     = new RpcMethods(username, password, wallet_url, wallet_port);
            string     tranid  = "";
            string     flodata = "deepacertproject#" + lblName.Text + "#" + lblGuardianName.Text + "#" + lblReg_no.Text + "#" + lblCourse.Text + "#" + lblGrade.Text + "#" + lblPercent.Text + "#" + lblDoj.Text + "#" + lblCompletion_Date.Text + "#" + lblIssueDate.Text + "#" + lblCertificate_no.Text;

            try
            {
                JObject obj = JObject.Parse(rpc.SendToAddress("oXFZb6CJFfw5E46hLFwiMKdPt3LEUtuV4L", 0.01M, "Test comment", "Test Comment", false, false, 1, "UNSET", flodata));

                if (string.IsNullOrEmpty(obj["error"].ToString()))
                {
                    tranid = obj["result"].ToString();
                    con    = new SqlConnection(connstr);
                    con.Open();
                    cmd = new SqlCommand("insert into Flo_record values(@r,@t,@c)", con);
                    cmd.Parameters.Add(new SqlParameter("@r", lblReg_no.Text));
                    cmd.Parameters.Add(new SqlParameter("@t", tranid));
                    cmd.Parameters.Add(new SqlParameter("@c", lblCertificate_no.Text));
                    cmd.ExecuteNonQuery();
                    con.Close();


                    Console.WriteLine("Transaction ID : " + obj["result"]);
                }
                else
                {
                    MessageBox.Show("Send Transaction Error : " + obj["error"]);
                }
            }
            catch (RpcInternalServerErrorException exception)
            {
                var errorCode    = 0;
                var errorMessage = string.Empty;

                if (exception.RpcErrorCode.GetHashCode() != 0)
                {
                    errorCode    = exception.RpcErrorCode.GetHashCode();
                    errorMessage = exception.RpcErrorCode.ToString();
                }

                Console.WriteLine("[Failed] {0} {1} {2}", exception.Message, errorCode != 0 ? "Error code: " + errorCode : string.Empty, !string.IsNullOrWhiteSpace(errorMessage) ? errorMessage : string.Empty);
                MessageBox.Show("Wallet Error Code : " + errorCode);
            }
            catch (Exception exception)
            {
                MessageBox.Show("[Failed]\n\nPlease check your configuration and make sure that the daemon is up and running and that it is synchronized. \n\nException: " + exception);
            }
        }
Пример #6
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string username    = ConfigurationManager.AppSettings.Get("rpcusername");
            string password    = ConfigurationManager.AppSettings.Get("rpcpassword");
            string wallet_url  = ConfigurationManager.AppSettings.Get("wallet_url");
            string wallet_port = ConfigurationManager.AppSettings.Get("wallet_port");

            RpcMethods rpc = new RpcMethods(username, password, wallet_url, wallet_port);


            try
            {
                string Name    = namebox.Text;
                string Send_to = Send_to_box.Text;

                string Review = reviewbox.Text;



                string flodata = "Review from:" + Name + "-- " + Review;

                JObject jobj = JObject.Parse(rpc.SendToAddress(Send_to, 0.01M, "review purpose", "review purpose", false, false, 1, "UNSET", flodata));
                if (string.IsNullOrEmpty(jobj["error"].ToString()))
                {
                    labelmsg.Text      = "Review saved successfully to FLO";
                    labelmsg.Visible   = true;
                    labelmsg.ForeColor = Color.Green;
                }
                else
                {
                    labelmsg.Text      = "Error!!!" + "could not retrieve any transaction details..plzz check ur transaction id";
                    labelmsg.Visible   = true;
                    labelmsg.ForeColor = Color.Red;
                }
            }
            catch (RpcInternalServerErrorException ex)
            {
                var errCode    = 0;
                var errMessage = string.Empty;
                if (ex.RpcErrorCode.GetHashCode() != 0)
                {
                    errCode    = ex.RpcErrorCode.GetHashCode();
                    errMessage = ex.RpcErrorCode.ToString();
                }
                Console.WriteLine("Exception :" + errCode + "-" + errMessage);


                labelmsg.Text      = "INternal server error!!";
                labelmsg.ForeColor = Color.Red;
                labelmsg.Visible   = true;
                labelmsg.Visible   = true;
            }
            catch (Exception ex1)
            {
                Console.WriteLine("Exception :" + ex1.ToString());
                labelmsg.Text      = "Error connecting to the server!!";
                labelmsg.ForeColor = Color.Red;
                labelmsg.Visible   = true;
                labelmsg.Visible   = true;
            }
        }
Пример #7
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;
            }
        }