Beispiel #1
0
        private static int ConnectWin(string remoteip, string remoteusername, string remotepassword)
        {
            var connect = new NetworkShareAccesser().TryConnect(remoteip, remoteusername, remotepassword);

            Console.WriteLine("Attempt Win Connect " + counterWin + ": " + remoteusername + ":" + remotepassword + "@" + remoteip + " - " + connect);
            connection con = new connection(remoteip, remoteusername, remotepassword, connect, "Windows");

            counterWin++;
            if (connect == 0)
            {
                ConnectWinSuccessList.Add(con);
            }
            else
            {
                ConnectWinErrorList.Add(con);
            }
            return(connect);
        }
Beispiel #2
0
        private static int ConnectLinux(string remoteip, string remoteusername, string remotepassword)
        {
            int connect = 1;

            try
            {
                using (var client = new SshClient(remoteip, remoteusername, remotepassword))
                {
                    //Accept Host key
                    client.HostKeyReceived += delegate(object sender, HostKeyEventArgs e)
                    {
                        e.CanTrust = true;
                    };
                    //Start the connection
                    client.Connect();
                    if (client.IsConnected)
                    {
                        connect = 0;
                    }
                    client.Disconnect();
                }
            }
            catch { connect = 1; }

            Console.WriteLine("Attempt Linux Connect " + counterLinux + ": " + remoteusername + ":" + remotepassword + "@" + remoteip + " - " + connect);
            connection con = new connection(remoteip, remoteusername, remotepassword, connect, "Linux");

            if (connect == 0)
            {
                ConnectLinuxSuccessList.Add(con);
            }
            else
            {
                ConnectLinuxErrorList.Add(con);
            }
            counterLinux++;
            return(connect);
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (list_text.SelectedIndex != -1)
            {
                int newID_now_2 = 0;
                // int useid = 0;
                string           ordb   = "Data source=orcl;User Id=scott; Password=tiger;";
                OracleConnection conn_4 = new OracleConnection("Data Source=ORCL;User Id=scott;password=tiger;");
                conn_4 = new OracleConnection(ordb);
                conn_4.Open();
                OracleCommand c_2 = new OracleCommand();
                c_2.Connection  = conn_4;
                c_2.CommandText = "GETIDNOW";
                c_2.CommandType = CommandType.StoredProcedure;


                c_2.Parameters.Add("var", OracleDbType.Int32, ParameterDirection.Output);
                // c_2.Parameters.Add("text_now", OracleDbType.NVarchar2,ParameterDirection.Input);

                c_2.Parameters.Add("text_now", list_text.Text);


                // lesa msh bya2raa el node_id


                c_2.ExecuteNonQuery();
                try
                {
                    newID_now_2 = Convert.ToInt32(c_2.Parameters["var"].Value.ToString());
                }

                catch { newID_now_2 = 1; }

                try
                {
                    //a = userID;

                    //b = newID_now_2;



                    connection delete = new connection();
                    if (MessageBox.Show("Are you sure to delete", "Comfirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                    {
                        delete.DELETING_PROC(userID, newID_now_2);
                        list_text.Items.RemoveAt(list_text.SelectedIndex);
                        if (ths.bunifuCustomLabel4.Text != "1")
                        {
                            ths.bunifuCustomLabel4.Text = (Convert.ToInt32(ths.bunifuCustomLabel4.Text) - 1).ToString();
                        }
                        else
                        {
                            ths.bunifuCustomLabel4.Text = "0";
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                PopupNotifier popup = new PopupNotifier();
                popup.TitleText   = "Personal Dairy Application";
                popup.ContentText = "Select a note which you want to delete it";
                popup.Image       = Properties.Resources.icons8_Notification_32px;
                popup.Popup();
            }
        }