protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); _Unrelated = new MoneyField() { ID = "txtUnrelated" }; _UnrelatedCurrency = new CountryList { CodeType = CodeType.CurrencyCode, Width = DropdownListWith, ID = "ddlUnrelatedCurrency" }; _Related = new MoneyField() { ID = "txtRelated" }; _RelatedCurrency = new CountryList { CodeType = CodeType.CurrencyCode, Width = DropdownListWith, ID = "ddlRelatedCurrency" }; _Total = new MoneyField { ID = "txtTotal" }; _TotalCurrency = new CountryList { CodeType = CodeType.CurrencyCode, Width = DropdownListWith, ID = "TotalCurrency" }; Controls.Add(_Unrelated); Controls.Add(_UnrelatedCurrency); Controls.Add(_Related); Controls.Add(_RelatedCurrency); Controls.Add(_Total); Controls.Add(_TotalCurrency); }
protected bool MonitoryValuesValid() { var money = FindFields(typeof(MoneyField)); if (money.Any()) { var i = 0; MoneyField toFucus = null; var x = money.Cast <MoneyField>().ToList(); foreach (var item in x) { if (!item.IsEmpty) { decimal __MONEY; if (!decimal.TryParse(item.Text, out __MONEY)) { if (toFucus == null) { toFucus = item; item.BackColor = Color.Red; } i++; } } //if ( !item.IsValidMoney() ) //{ // if ( toFucus == null ) // { // toFucus = item; // item.BackColor = Color.Red; // } // i++; //} } if (i > 0) { toFucus.Focus(); MessageBox.Show("Please make sure that all Rands and Cents fields are populated correctly."); return(false); } } return(true); }
protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); _ResidentCountry = new CountryList() { Width = new Unit(98, UnitType.Percentage) }; _ResedentCurrency = new CountryList() { CodeType = CodeType.CurrencyCode, Width = DropdownListWith }; _ProfitLossBeforeIT = new MoneyField() { }; _ProfitLossBeforeITCurrencyCode = new CountryList() { CodeType = CodeType.CurrencyCode, Width = DropdownListWith }; _ITPaid = new MoneyField(); _ITPaidCurrencyCode = new CountryList { CodeType = CodeType.CurrencyCode, Width = DropdownListWith }; _ITAccrued = new MoneyField(); _ITAccruedCurrencyCode = new CountryList { CodeType = CodeType.CurrencyCode, Width = DropdownListWith }; _StatedCapital = new MoneyField(); _StatedCapitalCurrencyCode = new CountryList() { CodeType = CodeType.CurrencyCode, Width = DropdownListWith }; _AccumulatedEarnings = new MoneyField(); _AccumulatedEarningsCurrencyCode = new CountryList { CodeType = CodeType.CurrencyCode, Width = DropdownListWith }; _AssetsEarnings = new MoneyField(); _AssetsEarningsCurrencyCode = new CountryList { CodeType = CodeType.CurrencyCode, Width = DropdownListWith }; _NoOfEmployees = new NumberField(); Controls.Add(_ResidentCountry); Controls.Add(_ResedentCurrency); Controls.Add(_ProfitLossBeforeIT); Controls.Add(_ProfitLossBeforeITCurrencyCode); Controls.Add(_ITPaid); Controls.Add(_ITPaidCurrencyCode); Controls.Add(_ITAccrued); Controls.Add(_ITAccruedCurrencyCode); Controls.Add(_StatedCapital); Controls.Add(_StatedCapitalCurrencyCode); Controls.Add(_AccumulatedEarnings); Controls.Add(_AccumulatedEarningsCurrencyCode); Controls.Add(_AssetsEarnings); Controls.Add(_AssetsEarningsCurrencyCode); Controls.Add(_NoOfEmployees); }
public Transaction() { date = new DateField(); date.Text = "Date"; date.AllowNull = false; time = new TimeField(); time.Text = "Time"; time.AllowNull = true; total = new MoneyField(); total.Text = "Total"; total.AllowNull = false; }