Ejemplo n.º 1
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            try
            {
                String searchText = searchImeiTextBox.Text;
                if (String.IsNullOrEmpty(searchText))
                {
                    MessageBox.Show("Insert imei number for Searching");
                    return;
                }
                if (searchImeiTextBox.Text.Length < 15)
                {
                    MessageBox.Show("IMEI requires exact 15 characters!");
                    return;
                }

                _mobile = _mobileManager.SearchMobileByImei(searchText);
                if (!String.IsNullOrEmpty(_mobile.IMEI))
                {
                    MessageBox.Show("Mobile handset found!");
                    modelNameLabel.Text = _mobile.ModelName;
                    imeiLabel.Text      = _mobile.IMEI;
                    priceLabel.Text     = _mobile.Price;
                }
                else
                {
                    MessageBox.Show("Mobile not found!!");
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                _mobileManager.CloseConnection();
            }
        }