private void CbWmidTextChanged(object sender, EventArgs e) { // 154129735662 var isValid = WebMoneyValidator.WmidIsValid(cbWMID.Text); lblWmidValid.ForeColor = isValid ? SystemColors.ControlText : Color.Red; }
/// <summary> /// сохранить данные кошельков WM /// </summary> private void BtnSaveWebMoneyClick(object sender, EventArgs e) { var wmId = cbWMID.Text; var isValid = WebMoneyValidator.WmidIsValid(wmId); if (!isValid) { MessageBox.Show("WMID введен некорректно.\n" + WebMoneyValidator.GetCorrectWMIDSampleStringWithSpecs(), "Ошибка ввода", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // взять все purseId bool errorExists; var purses = webMoneyPursePanelControl.GetPurseIds(out errorExists); if (errorExists) { MessageBox.Show("ID кошелька введен некорректно.\n" + WebMoneyValidator.GetCorrectPurseIdSampleStringWithSpecs(), "Ошибка ввода", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // забить на сервер кошельки / WMID WalletError error; try { error = TradeSharpWalletManager.Instance.proxy.SetPaymentWalletsBySystem( CurrentProtectedContext.Instance.MakeProtectedContext(), PaymentSystem.WebMoney, purses.Select(p => new UserPaymentSystem { RootId = wmId, PurseId = p, SystemPayment = PaymentSystem.WebMoney }).ToList(), AccountStatus.Instance.Login, ""); // wallet pwrd } catch (Exception ex) { Logger.Error("BtnSaveWebMoneyClick() error", ex); error = WalletError.CommonError; } if (error == WalletError.OK) { MessageBox.Show("Данные платежной системы обновлены"); GetUserWalletsWebMoney(); return; } MessageBox.Show("Ошибка обновления данных:\n" + EnumFriendlyName <WalletError> .GetString(error), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private bool PurseIsValid() { return(WebMoneyValidator.PusrseIdIsValid(tbPurse.Text)); }