private void btnFindCard_Click(object sender, EventArgs e)
        {
            this.btnFindCard.Enabled = false;
            var service = new CardService();

            try
            {
                this.Card = service.Resolve(birth_date.Value, txtPhone.Text);

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            catch (CardNotFoundException)
            {
                MetroMessageBox.Show(this, "Kartela nuk u gjet", "Gabim", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.Message, "Gabim", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.btnFindCard.Enabled = true;
        }
Esempio n. 2
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var result = e.Result as CardInfo;

            if (result != null)
            {
                this.card = result;

                txtClientName.Text = String.Format("{0} {1}", this.card.ClientFirstName, this.card.ClientLastName);
                txtAvailablePoints.Text = this.card.AvailablePoints.ToString();

                txtRedeemPoints.Enabled = !ExternalRedeem;
                txtRedeemValue.Enabled = !ExternalRedeem;
            }
            cardProgress.Hide();
        }