示例#1
0
        private async void BtnPaLevar_Clicked(object sender, EventArgs e)
        {
            respG = false;
            await Task.Factory.StartNew(() =>
            {
                UserDialogs.Instance.ShowLoading("");
                respG = new restClient().validaLimCompras(idPhone1);
                UserDialogs.Instance.HideLoading();
            });

            do
            {
                if (respG.Equals(true))
                {
                    respG = false;
                    await Navigation.PushAsync(new PaLlevar1(idPhone1));

                    break;
                }
                else
                {
                    respG = false;
                    await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(new PopUpPrueba());

                    //await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(new PopUpConfirmacion());
                    break;
                }
            } while (respG.Equals(true));
        }
 protected void btn_register_Click(object sender, EventArgs e)
 {
     //save to xml file --> using our service
     try
     {
         UserRegistrationService.Service1Client client = new UserRegistrationService.Service1Client();
         Boolean response = client.registerUser(UserInput.Text, Class1.Encrypt(PasswordInput.Text));  // Adding the user by manipulating XML file
         if (response.Equals(true))
         {
             //  Error.Text = "User has been registered Successfully!";
             Session["registration"] = "success";
             Response.Redirect("MemberLogin.aspx");
         }
         else if (response.Equals(false))
         {
             Error.Text = "Username already exist! Provide a new username";
         }
         else
         {
             Error.Text = "Username or password is incorrect!!";
             //Error.Text = response;
         }
         //}
     }
     catch (Exception e1)
     {
         Error.Text = e1.Message;
     }
 }
示例#3
0
 public void asktosave()
 {
     if (toss.Equals(true))
     {
         MessageBox.Show("Do you want to save changes to " + saveFileDialog1.FileName.ToString(), "Save " + saveFileDialog1.FileName.ToString(), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
     }
 }
示例#4
0
 /// <summary>
 /// Acceptor of binary operation
 /// </summary>
 /// <param name="typeA">Type of left part</param>
 /// <param name="typeB">Type of right part</param>
 /// <returns>Accepted operation</returns>
 public IObjectOperation Accept(object typeA, object typeB)
 {
     if (!a.Equals(typeA) | !a.Equals(typeB))
     {
         return(null);
     }
     return(this);
 }
示例#5
0
    public virtual bool runTest()
    {
        int iCountTestcases = 0;
        int iCountErrors    = 0;

        Console.Error.WriteLine(strName + ": " + strTest + " runTest started...");
        bool    b2   = false;
        Boolean boo2 = false;
        Boolean boo3 = false;

        iCountTestcases++;
        b2   = true;
        boo2 = b2;
        boo3 = b2;
        if (!boo2.Equals(boo3))
        {
            iCountErrors += 1;
            print("E_185jz!");
        }
        iCountTestcases++;
        b2   = true;
        boo2 = b2;
        boo3 = !b2;
        if (boo2.Equals(boo3))
        {
            iCountErrors += 1;
            print("E_258em!");
        }
        iCountTestcases++;
        b2   = false;
        boo2 = b2;
        boo3 = !b2;
        if (boo2.Equals(boo3))
        {
            iCountErrors += 1;
            print("E_231wn!");
        }
        iCountTestcases++;
        b2   = false;
        boo2 = b2;
        boo3 = b2;
        if (!boo2.Equals(boo3))
        {
            iCountErrors += 1;
            print("E_311ah!");
        }
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine("paSs. " + strTest + "   iCountTestCases == " + iCountTestcases);
            return(true);
        }
        else
        {
            Console.Error.WriteLine("FAiL. " + strTest + "    iCountErrors==" + iCountErrors);
            return(false);
        }
    }
示例#6
0
    public static void TestEquals()
    {
        // Boolean Boolean.Equals(Boolean)
        Boolean bTrue  = true;
        Boolean bFalse = false;

        Assert.True(bTrue.Equals(true));
        Assert.True(bFalse.Equals(false));
        Assert.False(bTrue.Equals(false));
        Assert.False(bFalse.Equals(true));
    }
    public virtual bool runTest()
    {
        int iCountTestcases = 0;
        int iCountErrors    = 0;

        Console.Error.WriteLine(strName + ": " + strTest + " runTest started...");
        Boolean boolX = false;
        Boolean boolY = false;

        do
        {
            iCountTestcases++;
            boolX = true;
            boolY = boolX;
            if (boolX.Equals(boolY) != true)
            {
                iCountErrors++; print("E_bdu1");
            }
            if (boolX.GetHashCode() != boolY.GetHashCode())
            {
                iCountErrors++; print("E_ik4");
            }
            iCountTestcases++;
            boolX = true;
            boolY = false;
            if (boolX.Equals(boolY) != false)
            {
                iCountErrors++; print("E_j58");
            }
            if (boolX.GetHashCode() == boolY.GetHashCode())
            {
                iCountErrors++; print("E_he8");
            }
            iCountTestcases++;
            if ((boolX.GetHashCode() != 1) || (boolY.GetHashCode() != 0))
            {
                iCountErrors++; print("E_dh2");
            }
        }while (false);
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine("paSs. " + strTest + "   iCountTestCases == " + iCountTestcases);
            return(true);
        }
        else
        {
            Console.Error.WriteLine(" FAiL : " + strTest + "    iCountErrors==" + iCountErrors);
            return(false);
        }
    }
        protected void btnAcceder_Click(object sender, EventArgs e)
        {
            // Boolean validar = validarCampos();
            // if (validar.Equals(true))
            //{
            int     ID_CARGO = Convert.ToInt32(DropDownListCargo.SelectedValue.ToString());
            string  EMAIL    = txtEmail.Text;
            string  PASSWORD = txtPassword.Text;
            Boolean rpta     = objUsuario.LoginSystem(ID_CARGO, EMAIL, PASSWORD);

            if (rpta.Equals(true))
            {
                if (ID_CARGO == 1)
                {
                    Response.Redirect("WF_MENU_PRINCIPAL.aspx", true);
                }
                else if (ID_CARGO == 2)
                {
                    Response.Redirect("WF_MENU_PRINCIPAL_SUPERVISOR.aspx", true);
                }
                else if (ID_CARGO == 3)
                {
                    Response.Redirect("WF_MENU_PRINCIPAL_EMPLEADO.aspx", true);
                }
            }
            else
            {
                mensaje           = "Usuario/Password no existen";
                LabelMensaje.Text = mensaje;
            }
            // }
        }
示例#9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            busEmployees busemp = new busEmployees();
            Employees    frmEmp = new Employees();

            frmEmp.FullName  = this.txtFullname.Text;
            frmEmp.Email     = this.txtEmail.Text;
            frmEmp.Login     = this.txtLogin.Text;
            frmEmp.LastName  = this.txtLastName.Text;
            frmEmp.passwords = this.txtPassword.Text;

            isExisting = isUserExisting();
            if (isExisting.Equals(true))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User existing')", true);
            }
            else
            {
                busemp.insertEmployee(frmEmp);
            }
            DataTable dt = new DataTable("User");

            dt = busemp.allUser();
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
示例#10
0
        private void button3_Click(object sender, EventArgs e)
        {
            List <Carteira> valida = new List <Carteira>();

            Gerenciador_carteira busca = new Gerenciador_carteira();

            valida = busca.verificaCaixaAberto(labelIdCliente.Text);

            if (valida.Count.Equals(0))
            {
                MessageBox.Show("Este cliente não possui débitos!");
            }
            else
            {
                frmCarteira add = new frmCarteira(labelIdCliente.Text);
                add.ShowDialog();

                Carteira dados = new Carteira();

                dados.id    = Convert.ToInt32(add.dgvCarteira.CurrentRow.Cells[0].Value);
                dados.valor = Convert.ToString(add.dgvCarteira.CurrentRow.Cells[1].Value);
                dados.data  = Convert.ToString(add.dgvCarteira.CurrentRow.Cells[2].Value);

                if (lstCarteira.Count.Equals(0))
                {
                    lstCarteira.Add(dados);
                }
                else
                {
                    Boolean Validate = false;
                    for (int i = 0; i < lstCarteira.Count; i++)
                    {
                        if (dados.id.Equals(lstCarteira[i].id))
                        {
                            Validate = true;
                        }
                    }

                    if (Validate.Equals(false))
                    {
                        lstCarteira.Add(dados);
                    }
                }
                dgvContas.Rows.Clear();

                for (int i = 0; i < lstCarteira.Count; i++)
                {
                    dgvContas.Rows.Add(
                        lstCarteira[i].id,
                        lstCarteira[i].valor,
                        lstCarteira[i].data
                        );
                }

                if (lstCarteira.Count > 0)
                {
                    button1.Enabled = true;
                }
            }
        }
示例#11
0
        public void startAnimation()
        {
            Point location = new Point(0, 0);

            if (!show_close_flag)
            {
                for (int i = 0; i < 488; i++)
                {
                    location      = new Point(workingArea.Right - Convert.ToInt32(i), workingArea.Bottom - Size.Height - 30);
                    this.Location = location;
                    Thread.Sleep(50);
                }
            }
            else
            {
                for (int i = 488; i > 0; i--)
                {
                    location      = new Point(workingArea.Right + 412 - Convert.ToInt32(i), workingArea.Bottom - Size.Height - 30);
                    this.Location = location;
                    Thread.Sleep(50);
                }
            }

            if (show_close_flag.Equals(true))
            {
                show_close_flag = false;
            }
            else
            {
                show_close_flag = true;
            }

            Thread.Sleep(100);
        }
示例#12
0
        //*******************************************************
        //*    PROCEDIMIENTO PARA EJECUTAR UN STORED PROCEDURE
        //******************************************************

        public static int ejecutarStoredProcedure(SqlCommand command, String operacion, Boolean muestraMensaje)
        {
            int           filasAfectadas = -1;
            int           identity       = -1;
            SqlConnection conn           = abrirConexion();

            command.Connection  = conn;
            command.CommandType = CommandType.StoredProcedure;
            filasAfectadas      = command.ExecuteNonQuery();

            if (filasAfectadas > 0)
            {
                // Recupero el ID con el que se genero
                string sqlIdentity = "SELECT @@IDENTITY";
                using (SqlCommand cmdIdentity = new SqlCommand(sqlIdentity, conn))
                {
                    if (cmdIdentity.ExecuteScalar() is DBNull)
                    {
                    }
                    else
                    {
                        identity = Convert.ToInt32(cmdIdentity.ExecuteScalar());
                    }
                }
            }
            if (muestraMensaje.Equals(true))
            {
                MessageBox.Show(operacion + " realizada satisfactoriamente", operacion, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            cerrarConexion(conn);
            return(identity);
        }
示例#13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            busProducts busProd = new busProducts();

            FrameWork.Products frmProd = new  FrameWork.Products();
            frmProd.ProductName     = this.txtProdName.Text;
            frmProd.ProductCode     = this.txtCode.Text;
            frmProd.Description     = this.txtProdDescription.Text;
            frmProd.CategoryID      = int.Parse(this.drpCategory.SelectedValue);
            frmProd.ProductSizeID   = int.Parse(this.drpSize.SelectedValue);
            frmProd.UnitOfMeasureID = int.Parse(this.drpUOM.SelectedValue);
            isExisting = isUserExisting();
            if (isExisting.Equals(true))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Product already Exists')", true);
            }
            else
            {
                busProd.insertProducts(frmProd);
            }
            DataTable dt = new DataTable("User");

            dt = busProd.allProducts();
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
示例#14
0
 /// <summary> evaluate Boolean values against each other. If the right is a String,
 /// the method will attempt to create a new Boolean object and evaluate.
 /// </summary>
 /// <param name="">left
 /// </param>
 /// <param name="">right
 /// </param>
 /// <returns>
 ///
 /// </returns>
 public static bool evaluateNotEqual(Boolean left, Object right)
 {
     if (right is Boolean)
     {
         return(left.Equals(right));
     }
     else if (right is String)
     {
         Boolean b = ((String)right).Equals("true", StringComparison.InvariantCultureIgnoreCase);
         return(left.Equals(b));
     }
     else
     {
         return(false);
     }
 }
示例#15
0
        protected void LogIn(object sender, EventArgs e)
        {
            Upwd        = Password.Text;
            Uemail      = email.Text;
            lbl.Visible = true;

            SqlDataSource3.SelectCommand = ("SELECT customer_ID FROM [customer] where customer_email ='" + Uemail + "' AND customer_pwd = '" + Upwd + "'");

            DataSourceSelectArguments sr = new DataSourceSelectArguments();

            System.Data.DataView dv = (System.Data.DataView)SqlDataSource3.Select(sr);
            if (dv.Count != 0)
            {
                Session["uid"] = dv[0][0].ToString();
            }


            if (correctUser.Equals(true))
            {
                lbl.Text = "Correct Credentials Inserted";
                Response.Redirect("~/user_management/userHomePage", false); //create a user page with few options (book, view profile, view booking list)
                Session["email"] = Uemail;
                Session["state"] = "logged in";
            }
            else
            {
                lbl.Text = "Wrong Credentials inserted";
            }
        }
示例#16
0
 public Boolean Equals(Query q)
 {
     if (!(queryString.Equals(q.getqueryString())))
     {
         return(false);
     }
     if (!(ylo.Equals(q.getylo())))
     {
         return(false);
     }
     if (!(yhi.Equals(q.getyhi())))
     {
         return(false);
     }
     if (!(includePatents.Equals(q.getincludePatents())))
     {
         return(false);
     }
     if (!(id.Equals(q.getpageid())))
     {
         return(false);
     }
     if (!(sortOrder.Equals(q.sortOrder)))
     {
         return(false);
     }
     if (!(resultType.Equals(q.resultType)))
     {
         return(false);
     }
     return(true);
 }
示例#17
0
        private async void BtnIngresar_Clicked(object sender, EventArgs e)
        {
            lblMensaje.Text = string.Empty;

            if (string.IsNullOrEmpty(txtEmail.Text))
            {
                lblMensaje.Text = "Debe ingresar un Email";
            }
            else
            {
                if (string.IsNullOrEmpty(txtContraseña.Text))
                {
                    lblMensaje.Text = "Debe ingresar una contraseña";
                }
                else
                {
                    if (txtEmail.Text.Equals("Admin") && txtContraseña.Text.Equals("123"))
                    {
                        //Application.Current.Properties["privilegio"] = "Administrador@";
                        txtEmail.Text      = string.Empty;
                        txtContraseña.Text = string.Empty;
                        await Navigation.PushAsync(new menuAdmin());
                    }
                    else
                    {
                        Boolean isUserExist = UsuarioRepository.Instancia.AttempLogin(txtEmail.Text, txtContraseña.Text);

                        if (isUserExist.Equals(true))
                        {
                            Usuario userSesion = UsuarioRepository.Instancia.userType(txtEmail.Text, txtContraseña.Text);

                            if (userSesion.Tipo.Equals("Empaque"))
                            {
                                await this.DisplayAlert("Bienvenido", userSesion.Tipo + ": " + userSesion.Nombre + " " + userSesion.Apellido, "Acceder");

                                Application.Current.Properties["sesion"] = userSesion;

                                txtEmail.Text      = string.Empty;
                                txtContraseña.Text = string.Empty;
                                await Navigation.PushAsync(new menuEmpaque());
                            }
                            else
                            {
                                await this.DisplayAlert("Bienvenido", userSesion.Tipo + ": " + userSesion.Nombre + " " + userSesion.Apellido, "Acceder");

                                Application.Current.Properties["sesion"] = userSesion;

                                txtEmail.Text      = string.Empty;
                                txtContraseña.Text = string.Empty;
                                await Navigation.PushAsync(new menuCordina());
                            }
                        }
                        else
                        {
                            lblMensaje.Text = UsuarioRepository.Instancia.EstadoMensaje;;
                        }
                    }
                }
            }
        }
 protected void CheckRememberMe(IWebElement element, Boolean value)
 {
     if (value.Equals(true))
     {
         element.Click();
     }
 }
示例#19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            String rutaXml = Server.MapPath("./sessiones/") + "usuario_" + Session.SessionID + ".xml";
            PRO.recSession(rutaXml, "RUT_EMPRESA");

            id       = Request.QueryString["id"];
            grupo    = Request.QueryString["grupo"];
            servicio = Request.QueryString["servicio"];
            operador = Request.QueryString["operador"];
            visita   = Request.QueryString["visita"];
            incializaCampos();


            Boolean valFoto = cargarFoto();

            if (valFoto.Equals(false))
            {
                cargarFotoVisita();
            }

            lbServ.Text   = servicio;
            lbGrupo.Text  = grupo;
            lbVisita.Text = visita;
        }
        catch (Exception ex)
        {
            Response.Redirect("errorSesion.aspx");
        }
    }
示例#20
0
        //checks if rate code has already exists in Rate Table
        public static Boolean RateCodeExists(String RateCode)
        {
            Boolean answer = true;

            //Connect to Database
            OracleConnection myConn = new OracleConnection(DBConnect.oradb);

            myConn.Open();

            String strSQL = "SELECT * FROM Rates WHERE Rate_code = '" + RateCode.ToUpper() + "'";

            OracleCommand cmd = new OracleCommand(strSQL, myConn);

            //execute the SQL query and put result in OracleDataReader object
            OracleDataReader dr = cmd.ExecuteReader();

            //Finish
            if (dr.Read())
            {
                answer.Equals(true);
            }
            else
            {
                answer = false;
            }


            //close DB connection
            myConn.Close();

            //return answer
            return(answer);
        }
示例#21
0
        //Checks the database to see if an phone exists already in it
        public static Boolean phoneExists(String phone)
        {
            Boolean          answer = true;
            OracleConnection conn   = new OracleConnection(DBConnect.oradb);

            conn.Open();

            String sql = "SELECT * FROM CUSTOMER WHERE PHONENUMBER = '" + phone.ToUpper() + "'";

            OracleCommand cmd = new OracleCommand(sql, conn);

            OracleDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                answer.Equals(true);
            }
            else
            {
                answer = false;
            }


            conn.Close();

            return(answer);
        }
示例#22
0
    public StepResult GetResult(Process process, string databaseName)
    {
        _process      = process;
        _databaseName = databaseName;

        var rows   = new List <Row>();
        var result = new StepResult();

        var result1 = InputOne.GetResult(process, databaseName);
        var result2 = InputTwo.GetResult(process, databaseName);

        if (Boolean.Equals("AND"))
        {
            // return rows where the condition is true for both parts
            rows = result1.Rows.Intersect(result2.Rows).ToList();
        }

        if (Boolean.Equals("OR"))
        {
            // union returns both rows, removing duplicates
            rows = result1.Rows.Union(result2.Rows).ToList();
        }

        result.Rows    = rows;
        result.IsValid = true;
        return(result);
    }
示例#23
0
 private void button3_Click(object sender, EventArgs e)
 {
     using (MySqlConnection connection = new MySqlConnection("server=localhost;user id=root;password=;database=csharpmysql"))
     {
         connection.Open();
         using (MySqlCommand command = connection.CreateCommand())
         {
             command.CommandText = "SELECT * FROM csharpmysql.test_table where id=@id";
             command.Parameters.AddWithValue("@id", id.Text);
             command.ExecuteNonQuery();
             MySqlDataReader reader = command.ExecuteReader();
             Boolean         read   = reader.Read();
             if (read.Equals(true))
             {
                 if (reader[0].ToString() == id.Text)
                 {
                     MessageBox.Show(reader[0].ToString() + " " + reader[1].ToString() + " " + reader[2].ToString());
                     //reader.Close();
                 }
             }
             //reader.Close();
             else
             {
                 MessageBox.Show("No data for id");
             }
             connection.Close();
         }
     }
 }
示例#24
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.</returns>
        /// <param name="other">An object to compare with this object.</param>
        public bool Equals(JsonValue other)
        {
            // using a == here would result in recursion and death by stack overflow
            if (ReferenceEquals(other, null))
            {
                return(false);
            }
            if (other.Type != Type)
            {
                return(false);
            }
            switch (Type)
            {
            case JsonValueType.Number:
                return(Number.Equals(other.Number));

            case JsonValueType.String:
                return(String.Equals(other.String));

            case JsonValueType.Boolean:
                return(Boolean.Equals(other.Boolean));

            case JsonValueType.Object:
                return(Object.Equals(other.Object));

            case JsonValueType.Array:
                return(Array.Equals(other.Array));

            case JsonValueType.Null:
                return(true);
            }
            return(false);
        }
示例#25
0
        void TrackFullscreenPropertyChanges(object sender, PropertyChangedEventArgs e)
        {
            if (!Boolean.Equals(e.OldValue, e.NewValue) && wbForm.FullScreen)
            {
                switch (e.Key)
                {
                case "HideMainMenu":
                case "ShowMainMenuOnMouseMove":
                    RedrawMainMenu();
                    break;

                case "HideToolbars":
                    RedrawToolbars();
                    break;

                //case "HideTabs":
                //case "HideVerticalScrollbar":
                //case "HideHorizontalScrollbar":
                case "HideStatusBar":
                case "ShowStatusBarOnMouseMove":
                    RedrawStatusBar();
                    break;
                    //case "HideWindowsTaskbar":
                }
            }
        }
示例#26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            id       = Request.QueryString["id"];
            grupo    = Request.QueryString["grupo"];
            servicio = Request.QueryString["servicio"];
            operador = Request.QueryString["operador"];
            visita   = Request.QueryString["visita"];
            incializaCampos();


            Boolean valFoto = cargarFoto();

            if (valFoto.Equals(false))
            {
                cargarFotoVisita();
            }

            lbServ.Text   = servicio;
            lbGrupo.Text  = grupo;
            lbVisita.Text = visita;
        }
        catch (Exception ex)
        {
            Response.Redirect("errorSesion.aspx");
        }
    }
示例#27
0
        public ActionResult Removal()
        {
            // Je récupère les informations saisies par l'utilisateur (en minuscules, afin d'éviter les problèmes de casse)
            string firstname = Request["firstname"].ToLower();
            string lastname  = Request["lastname"].ToLower();
            int    identity  = Convert.ToInt32(Request["number"]);

            // Je teste ensuite si les informations saisies correspondent à une réservation (comme une sorte de login)
            // Si c'est en ordre, je lance les deux requêtes de suppression
            Boolean login = ReservationManager.LoginReservation(identity, firstname, lastname);

            if (login.Equals(true))
            {
                ReservationManager.RemoveReservation(identity);
                ReservationDetailsManager.RemoveReservationDetails(identity);
            }

            // Je passe ensuite la valeur du booléen login à la vue, afin d'afficher le bon encadré
            // Je passe également les informations de la réservation, afin de les afficher
            ViewData["login"] = login;

            ReservationVM reservation = new ReservationVM
            {
                IdReservation   = identity,
                ClientFirstname = Request["firstname"],
                ClientLastname  = Request["lastname"]
            };

            return(View(reservation));
        }
示例#28
0
 private bool IsEqual(InsuranceInformation insurance)
 {
     return(Decimal.Equals(Price, insurance.Price) &&
            String.Equals(UserId, insurance.UserId) &&
            String.Equals(InsuranceNumber, insurance.InsuranceNumber) &&
            Boolean.Equals(IsDiscountProtected, insurance.IsDiscountProtected));
 }
示例#29
0
 public static Boolean checkNet(Boolean est)
 {
     try
     {
         Ping        myPing      = new Ping();
         String      host        = "minerstat.farm";
         byte[]      buffer      = new byte[32];
         int         timeout     = 2000;
         PingOptions pingOptions = new PingOptions();
         PingReply   reply       = myPing.Send(host, timeout, buffer, pingOptions);
         if (reply.Status == IPStatus.Success)
         {
             if (est.Equals(true))
             {
                 Program.connectionspeed = CheckInternetSpeed() / 1000;
                 Program.NewMessage("NODE => Estimated Internet Speed: " + Program.connectionspeed + " MB/s", "INFO");
             }
             Program.connectionError = false;
             return(true);
         }
         else
         {
             Program.connectionError = true;
             return(false);
         }
     }
     catch (Exception)
     {
         Program.connectionError = true;
         return(false);
     }
 }
示例#30
0
        public static string firstMethod()
        {
            //Declaring method Variables
            Boolean loop = true;

            do
            {
                try
                {
                    Console.WriteLine("Please enter a pokedex id"); //Tells the user to enter a integer value.
                    int pokedexID = int.Parse(Console.ReadLine());  // Reads the value from the users input.


                    if (pokedexID < 1 || pokedexID > 807)                         //Input validation to make sure value is within the range of all the new pokemon - meltan - melmetal
                    {
                        Console.WriteLine("Please enter a value within 1 - 807"); // This a message to warn the user of the acceptable range
                        return(null);
                    }

                    //DO Method should close around here -- need to apply another message to user and read key.


                    Console.WriteLine("Loading information from api...");                //Message to user.
                    String selectedPokemon = GetOnePokemon(pokedexID).Result.ToString(); //Runs the first GET from the first API. Var pokedex is entered from the user input.
                    loop = false;
                    return(selectedPokemon);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error: Please only enter a integer value. (Whole numbers)");//Input validation
                    return(null);
                }
            } while (loop.Equals(true));//Loops while the codition is true
            return(null);
        }