Пример #1
0
 // Verify Vendor Currency and Price exist or not.
 // If verify failed, can not post the import.
 private void VerifyVendorCurrencyPrice(int iCount, DataRow row)
 {
     if (!string.IsNullOrEmpty(row[colVendorCurrency].ToString()))
     {
         //string sql = "CurrencyCode = '" + row[colVendorCurrency].ToString() + "'";
         //Currency oCurr = Currency.LoadWhere(sql);
         //if (oCurr != null)
         if (CurrencyEx.IsCurrencyCodeInUse(row[colVendorCurrency].ToString()))
         {
             // TODO:Set the cell style of DataGridView
         }
     }
     else // Without Vendor Currency, Vendor Price should be ZERO
     {
         // TODO:Set the cell style of DataGridView
     }
 }
Пример #2
0
        private bool IsValid()
        {
            bool result = true; decimal numeric = 0;

            errorProvider.SetError(txtCurrencyCode, string.Empty);
            errorProvider.SetError(txtUnicodeDecimal, string.Empty);
            errorProvider.SetError(txtExchangeRate, string.Empty);

            #region CountryCode 唔可以吉
            if (txtCurrencyCode.Text.Length == 0)
            {
                errorProvider.SetError(txtCurrencyCode, "Cannot be blank!");
                errorProvider.SetIconAlignment(txtCurrencyCode, ErrorIconAlignment.TopLeft);
                result = false;
            }
            #endregion

            #region 新增,要 check CountryCode 係咪 in use
            if (_CurrencyId == Guid.Empty)
            {
                if (CurrencyEx.IsCurrencyCodeInUse(txtCurrencyCode.Text.Trim()))
                {
                    errorProvider.SetError(txtCurrencyCode, "Currency Code in use");
                    errorProvider.SetIconAlignment(txtCurrencyCode, ErrorIconAlignment.TopLeft);
                    result = false;
                }
            }
            #endregion

            if (!decimal.TryParse(txtUnicodeDecimal.Text, out numeric))
            {
                errorProvider.SetError(txtUnicodeDecimal, Resources.Common.DigitalNeeded);
                errorProvider.SetIconAlignment(txtUnicodeDecimal, ErrorIconAlignment.TopLeft);
                result = false;
            }
            if (!decimal.TryParse(txtExchangeRate.Text, out numeric))
            {
                errorProvider.SetError(txtExchangeRate, Resources.Common.DigitalNeeded);
                errorProvider.SetIconAlignment(txtExchangeRate, ErrorIconAlignment.TopLeft);
                result = false;
            }

            return(result);
        }