Пример #1
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            Mobile mobile;
            string IMEI = SearchIMEITextBox.Text;

            mobile = _mobileManager.SearchByIMEI(IMEI);

            IMEITextBox.Text  = mobile.IMEI;
            nameTextBox.Text  = mobile.Name;
            priceTextBox.Text = mobile.Price.ToString();
        }
Пример #2
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (SearchIMEITextBox.Text.Equals(""))
                {
                    MessageBox.Show("Invalid Input!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (SearchIMEITextBox.Text.Length != 15)
                {
                    MessageBox.Show("IMEI Number Must be 15 digit!", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    bool IsExistsIMEi = _mobileManager.IsExists(SearchIMEITextBox.Text);
                    if (!IsExistsIMEi)
                    {
                        MessageBox.Show("No data found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }


                Mobile mobile;
                string IMEI = SearchIMEITextBox.Text;
                mobile = _mobileManager.SearchByIMEI(IMEI);

                IMEITextBox.Text  = mobile.IMEI;
                nameTextBox.Text  = mobile.Name;
                priceTextBox.Text = mobile.Price.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }