private void contextBtnDelete_Click(object sender, RoutedEventArgs e) { List <string> list = new List <string>(); foreach (PrivacyCard card in this.gvCards.SelectedItems) { list.Add(card.CardId); } foreach (string id in list) { PrivacyCard item = Global.PRIVACY_MANAGER.Cards.First <PrivacyCard>(x => x.CardId == id); if (Global.PRIVACY_MANAGER.DeleteCard(id)) { Global.PRIVACY_MANAGER.Cards.Remove(item); } } }
private void cmbPrivacyCards_SelectionChanged(object sender, SelectionChangedEventArgs e) { IEnumerator enumerator; if ((this.cmbPrivacyCards.SelectedItem == null) || (((ComboBoxItem)this.cmbPrivacyCards.SelectedItem).Tag.ToString() == "-1")) { this._parent._paymentView.lblPrivacyName.Text = ""; this._parent._paymentView.lblPrivacyName.Visibility = Visibility.Hidden; return; } PrivacyCard card = Global.PRIVACY_MANAGER.Cards.First <PrivacyCard>(x => x.CardId == ((ComboBoxItem)this.cmbPrivacyCards.SelectedItem).Tag.ToString()); this._parent._paymentView.txtCvv.Text = card.Cvv; this._parent._paymentView.textBox_0.Text = card.CardNumber; using (enumerator = ((IEnumerable)this._parent._paymentView.cmbExpirationMM.Items).GetEnumerator()) { ComboBoxItem item; goto Label_00CE; Label_00AA: item = (ComboBoxItem)enumerator.Current; if (item.Tag.ToString() == card.ExpMonth) { goto Label_00D8; } Label_00CE: if (!enumerator.MoveNext()) { goto Label_0106; } goto Label_00AA; Label_00D8: this._parent._paymentView.cmbExpirationMM.SelectedItem = item; } Label_0106: using (enumerator = ((IEnumerable)this._parent._paymentView.cmbExpirationYYYY.Items).GetEnumerator()) { ComboBoxItem item3; goto Label_014A; Label_0124: item3 = (ComboBoxItem)enumerator.Current; if (item3.Tag.ToString() == card.ExpYear) { goto Label_0154; } Label_014A: if (!enumerator.MoveNext()) { goto Label_0183; } goto Label_0124; Label_0154: this._parent._paymentView.cmbExpirationYYYY.SelectedItem = item3; } Label_0183: using (enumerator = ((IEnumerable)this._parent._paymentView.cmbCardType.Items).GetEnumerator()) { ComboBoxItem item2; goto Label_01C7; Label_01A1: item2 = (ComboBoxItem)enumerator.Current; if (item2.Tag.ToString() == "1") { goto Label_01D1; } Label_01C7: if (!enumerator.MoveNext()) { goto Label_0200; } goto Label_01A1; Label_01D1: this._parent._paymentView.cmbCardType.SelectedItem = item2; } Label_0200: this._parent._paymentView.lblPrivacyName.Text = "Card name: " + card.Name; this._parent._paymentView.lblPrivacyName.Visibility = Visibility.Visible; }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (this.Check()) { this._profile.Name = this.txtProfileName.Text.Trim(); this._profile.FirstName = this._billingView.txtFirstNameBilling.Text.Trim(); this._profile.LastName = this._billingView.txtLastNameBilling.Text.Trim(); this._profile.Address1 = this._billingView.txtAddress1Billing.Text.Trim(); this._profile.Address2 = this._billingView.txtAddress2Billing.Text.Trim(); this._profile.City = this._billingView.txtCityBilling.Text.Trim(); this._profile.Zip = this._billingView.txtZipBilling.Text.Trim(); this._profile.Email = this._billingView.txtEmailBilling.Text.Trim(); this._profile.Phone = Helpers.ExtractNumbers(this._billingView.txtPhoneBilling.Text.Trim()); this._profile.CountryId = ((ComboBoxItem)this._billingView.cmbCountryBilling.SelectedItem).Tag.ToString(); this._profile.StateId = (this._billingView.cmbStateBilling.SelectedItem != null) ? ((ComboBoxItem)this._billingView.cmbStateBilling.SelectedItem).Tag.ToString() : ""; this._profile.State = this._billingView.txtStateBilling.Text.Trim(); this._profile.VariousBilling = this._billingView.txtVariousBilling.Text.Trim(); if (this._privacyView.switchPrivacy.IsChecked.HasValue && this._privacyView.switchPrivacy.IsChecked.Value) { this._profile.Privacy = true; PrivacyCard card = Global.PRIVACY_MANAGER.Cards.First <PrivacyCard>(x => x.CardId == ((ComboBoxItem)this._privacyView.cmbPrivacyCards.SelectedItem).Tag.ToString()); this._profile.PrivacyCardName = card.Name; } else if (string.IsNullOrEmpty(this._paymentView.lblPrivacyName.Text.Trim())) { this._profile.Privacy = false; this._profile.PrivacyCardName = ""; } else { this._profile.Privacy = true; } if (!this.chSameBilling.IsChecked.Value) { this._profile.FirstNameShipping = this._shippingView.txtFirstNameShipping.Text.Trim(); this._profile.LastNameShipping = this._shippingView.txtLastNameShipping.Text.Trim(); this._profile.Address1Shipping = this._shippingView.txtAddress1Shipping.Text.Trim(); this._profile.Address2Shipping = this._shippingView.txtAddress2Shipping.Text.Trim(); this._profile.CityShipping = this._shippingView.txtCityShipping.Text.Trim(); this._profile.ZipShipping = this._shippingView.txtZipShipping.Text.Trim(); this._profile.EmailShipping = this._shippingView.txtEmailShipping.Text.Trim(); this._profile.PhoneShipping = Helpers.ExtractNumbers(this._shippingView.txtPhoneShipping.Text.Trim()); this._profile.CountryIdShipping = ((ComboBoxItem)this._shippingView.cmbCountryShipping.SelectedItem).Tag.ToString(); this._profile.StateIdShipping = (this._shippingView.cmbStateShipping.SelectedItem != null) ? ((ComboBoxItem)this._shippingView.cmbStateShipping.SelectedItem).Tag.ToString() : ""; this._profile.StateShipping = this._shippingView.txtStateShipping.Text.Trim(); this._profile.VariousShipping = this._shippingView.txtVariousShipping.Text.Trim(); } else { this._profile.FirstNameShipping = this._billingView.txtFirstNameBilling.Text.Trim(); this._profile.LastNameShipping = this._billingView.txtLastNameBilling.Text.Trim(); this._profile.Address1Shipping = this._billingView.txtAddress1Billing.Text.Trim(); this._profile.Address2Shipping = this._billingView.txtAddress2Billing.Text.Trim(); this._profile.CityShipping = this._billingView.txtCityBilling.Text.Trim(); this._profile.ZipShipping = this._billingView.txtZipBilling.Text.Trim(); this._profile.EmailShipping = this._billingView.txtEmailBilling.Text.Trim(); this._profile.PhoneShipping = Helpers.ExtractNumbers(this._billingView.txtPhoneBilling.Text.Trim()); this._profile.CountryIdShipping = ((ComboBoxItem)this._billingView.cmbCountryBilling.SelectedItem).Tag.ToString(); this._profile.StateIdShipping = (this._billingView.cmbStateBilling.SelectedItem != null) ? ((ComboBoxItem)this._billingView.cmbStateBilling.SelectedItem).Tag.ToString() : ""; this._profile.StateShipping = this._billingView.txtStateBilling.Text.Trim(); this._profile.VariousShipping = this._billingView.txtVariousBilling.Text.Trim(); } this._profile.IdGroup = (this.cmbGroup.SelectedItem != null) ? ((ComboBoxItem)this.cmbGroup.SelectedItem).Tag.ToString() : ""; this._profile.NameOnCard = this._paymentView.txtNameOnCard.Text.Trim(); this._profile.CCNumber = this._paymentView.textBox_0.Text.Replace(" ", "").Trim(); this._profile.Cvv = this._paymentView.txtCvv.Text.Trim(); this._profile.CardTypeId = ((ComboBoxItem)this._paymentView.cmbCardType.SelectedItem).Tag.ToString(); this._profile.ExpiryMonth = ((ComboBoxItem)this._paymentView.cmbExpirationMM.SelectedItem).Tag.ToString(); this._profile.ExpiryYear = ((ComboBoxItem)this._paymentView.cmbExpirationYYYY.SelectedItem).Tag.ToString(); this._profile.SameBillingShipping = this.chSameBilling.IsChecked.Value; this._profile.OnePerWebsite = this.chOneCheckoutPerSite.IsChecked.Value; try { int num2 = int.Parse(this._paymentView.txtBirthdayDay.Text); if ((num2 >= 1) && (num2 <= 0x1f)) { this._profile.BirthdayDay = num2.ToString(); } else { this._profile.BirthdayDay = "1"; } } catch { this._profile.BirthdayDay = "1"; } try { int num3 = int.Parse(this._paymentView.txtBirthdayMonth.Text); if ((num3 >= 1) && (num3 <= 12)) { this._profile.BirthdayMonth = num3.ToString(); } else { this._profile.BirthdayMonth = "1"; } } catch { this._profile.BirthdayMonth = "1"; } try { int num4 = int.Parse(this._paymentView.txtBirthdayYear.Text); if ((num4 >= 0x76c) && (num4 <= 0x7da)) { this._profile.BirthdayYear = num4.ToString(); } else { this._profile.BirthdayYear = "1"; } } catch { this._profile.BirthdayYear = "1980"; } if (this._operation == Global.FormOperation.insert) { Global.SETTINGS.PROFILES.Add(this._profile); } Helpers.SaveSettings(); base.Close(); } }