Esempio n. 1
0
 private void ShowNewAsset(Asset asset)
 {
     _canAddFields = asset.CanAddFields;
     _currentAsset = asset;
     _assets.Add(asset);
     foreach (var required in asset.RequiredFields)
     {
         Control fieldControl;
         if (required.Value == typeof(CurrencyField))
         {
             var field = new CurrencyField();
             field.Name   = required.Key;
             fieldControl = new CurrencyControl(field);
         }
         else
         {
             var field = new StringField();
             field.Name   = required.Key;
             fieldControl = new CommonFieldControl(field);
             ((CommonFieldControl)fieldControl).FieldNameBlocked = true;
         }
         fieldControl.Location = new Point(15, _heightCounter);
         _heightCounter       += fieldControl.Size.Height + 5;
         Controls.Add(fieldControl);
         Height = _heightCounter + fieldControl.Size.Height + 10;
     }
     if (_canAddFields)
     {
         AddEmptyField();
     }
 }
Esempio n. 2
0
 private void ShowExistingAsset(Asset asset)
 {
     _fieldsInitialized = true;
     _currentAsset      = asset;
     if (asset is BankMoneyAsset)
     {
         AssetTypeCB.SelectedItem = "Актив банковского счёта";
     }
     else if (asset is OtherMoneyAsset)
     {
         AssetTypeCB.SelectedItem = "Денежный актив";
     }
     else
     {
         AssetTypeCB.SelectedItem = "Неденежный актив";
     }
     _canAddFields = asset.CanAddFields;
     foreach (var pair in asset.Fields)
     {
         Control fieldControl;
         if (pair.Value is CurrencyField)
         {
             fieldControl = new CurrencyControl((CurrencyField)pair.Value);
         }
         else
         {
             fieldControl = new CommonFieldControl((StringField)pair.Value);
         }
         fieldControl.Location = new Point(15, _heightCounter);
         _heightCounter       += fieldControl.Size.Height + 5;
         Controls.Add(fieldControl);
         Height = _heightCounter + fieldControl.Size.Height + 10;
     }
     if (_canAddFields)
     {
         AddEmptyField();
     }
 }