示例#1
0
		public void SpinnerAnsprechpartnerItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
		{
			Spinner spinner = (Spinner)sender;
			GetControlReferences ();

			_ansprechpartner = _ansprechpartnern [e.Position];
			_edAnsprechpartner.Text = _ansprechpartner.Name;
		}
示例#2
0
		async public System.Threading.Tasks.Task BtnAnsprechpartnerFragmentClickAsync()
		{
            _ansprechpartnern = await BusinessLayer.Ansprechpartner.GetAnsprechpartnernAsync ( _stateClass._person.ID, Utilities.GetCurrentLanguage(_mainActivity),MainActivity.User);

			// Set the current ansprechpartner object
			if (_ansprechpartnern.Count > 0)
            {
                // The object is the first item
                _ansprechpartner = _ansprechpartnern[0];

                // Configure the buttons
                if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                    ConfigureButtons(false, false, false, false, false);
                else
                    ConfigureButtons(permission.Create , permission.Update, false, false, permission.UpDownload);

            }
            else
            {
                // Just create a new empty object
                _ansprechpartner = BusinessLayer.Ansprechpartner.Create();

                // Configure the buttons
                if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                    ConfigureButtons(false, false, false, false, false);
                else
                    ConfigureButtons(permission.Create, false, false, false, permission.UpDownload);

            }


			AnsprechpartnerFragment fragment = new AnsprechpartnerFragment(Resource.Layout.FrgAnsprechpartner, _mainActivity , this);

			_mainActivity.FragmentManager 
				.BeginTransaction()
				.SetCustomAnimations (Android.Resource.Animator.FadeIn,Android.Resource.Animator.FadeOut)
				.Replace(Resource.Id.frameContent, fragment)
				.AddToBackStack (null)
				.Commit();

		}
示例#3
0
		public void  BtnNewClick()
		{
			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;

			// Enable the controls to let the user enter value
			EnableControls ();

			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;

            // For new Ansprechpartner get some value of the Kunde/Lieferant/Interessent
			_ansprechpartner = BusinessLayer.Ansprechpartner.Create ();
			_edName.Text = "";
			_edVorname.Text = "";
			_edNummer.Text = "0";
            _edStrasse.Text = _stateClass._person.Strasse;
            _edPLZ.Text = _stateClass._person.PLZ;
            _edOrt.Text = _stateClass._person.Ort;
            _tvEmail.Text = "";
            _tvPhone.Text = "";

            _edPLZ.FocusChange += (sender, e) => 
                {
                    _edOrt.Text = _stateClass._person.GetTownViaPLZ (_edPLZ.Text ,MainActivity.User);
                };
            
            if (Utilities.GetCurrentLanguage(_mainActivity) == "DE")
                _spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndexByName("Deutschland"));
            else
                _spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndexByName("Kanada"));
            
            _edTelefon.Text = _stateClass._person.Telefon;
            _edEmail.Text = _stateClass._person.Email;

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(false, false, false, false, false);
            else
                ConfigureButtons(false, false, true, false, permission.UpDownload);

			return ;

		}
示例#4
0
        public void SpinnerItemSelected(int selectedIndex)
        {
            GetControlReferences ();
            _selectedIndex = selectedIndex;

            _edName.Error = null;
            _edPLZ.Error = null;

            _ansprechpartner = _ansprechpartnern [_selectedIndex];
            _edName.Text = _ansprechpartnern [_selectedIndex].Name;
            _edVorname.Text = _ansprechpartnern [_selectedIndex].Vorname;
            _edNummer.Text = _ansprechpartnern [_selectedIndex].Nummer;
            _edStrasse.Text = _ansprechpartnern [_selectedIndex].Strasse;
            _edPLZ.Text =_ansprechpartnern [_selectedIndex].PLZ;
            _edOrt.Text =_ansprechpartnern [_selectedIndex].Ort;
            _spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndex(_ansprechpartnern[_selectedIndex].LandNummer));
            _edTelefon.Text = _ansprechpartnern[_selectedIndex].Telefon;
            _edEmail.Text =_ansprechpartnern [_selectedIndex].Email;
            _tvEmail.Text = _ansprechpartnern[_selectedIndex].Email;
            _tvPhone.Text = _ansprechpartnern[_selectedIndex].Telefon;

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(false, false, false, false, false);
            else
                ConfigureButtons(permission.Create , permission.Update, false, false, permission.UpDownload);

        }
示例#5
0
		async public Task ListViewClickAsync()
		{

			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;

			// Disable the controls 
			DisableControls ();

            _edName.Error = null;
            _edPLZ.Error = null;

            _ansprechpartnern = await BusinessLayer.Ansprechpartner.GetAnsprechpartnernAsync ( _stateClass._person.ID, Utilities.GetCurrentLanguage(_mainActivity),MainActivity.User);
			_spinnerAnsprechpartner = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerAnsprechpartner);
			_spinnerAnsprechpartner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerItemSelected);
			AnsprechpartnerViewAdapter _adapter = new AnsprechpartnerViewAdapter (_mainActivity, _ansprechpartnern);
			_spinnerAnsprechpartner.Adapter = _adapter;

			// Specific Controls
			if (_ansprechpartnern.Count > 0)
			{
				// Show by default the first item, if there is an item!!!
				_edName.Text = _ansprechpartnern [0].Name;
				_edVorname.Text = _ansprechpartnern [0].Vorname;
				_edNummer.Text = _ansprechpartnern [0].Nummer;
				_edStrasse.Text = _ansprechpartnern [0].Strasse;
				_edPLZ.Text = _ansprechpartnern [0].PLZ;
				_edOrt.Text = _ansprechpartnern [0].Ort;
                _spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndex(_ansprechpartnern[0].LandNummer));
                _edTelefon.Text = _ansprechpartnern[0].Telefon;
                _edEmail.Text = _ansprechpartnern [0].Email;
                _tvEmail.Text = _ansprechpartnern[0].Email;
                _tvPhone.Text = _ansprechpartnern[0].Telefon;

                // Configure the buttons
                if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                    ConfigureButtons(false, false, false, false, false);
                else
                    ConfigureButtons(permission.Create , permission.Update, false, false, permission.UpDownload);

			}
			else
			{
				// If not, just clear all controls
				_ansprechpartner = BusinessLayer.Ansprechpartner.Create ();
				ResetControls ();

                // Configure the buttons
                if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                    ConfigureButtons(false, false, false, false, false);
                else
                    ConfigureButtons(false, false, false, false, permission.UpDownload);

			}


			return ;

		}
 /// <summary>
 /// Fill the TxtTaskAnsprechpartner with the Ansprechpartner and assign the local _ansprechpartner with it
 /// </summary>
 /// <param name="ansprechpartner">Fill the main TxtAnsprechpartner with that.</param>
 public void FillTaskAnsprechpartnerControls( BusinessLayer.Ansprechpartner ansprechpartner)
 {
     if (ansprechpartner.Name != null)
     {
         TxtTaskAnsprechpartner.Text = ansprechpartner.Name.TrimEnd() + ", " + ansprechpartner.Vorname;
         _ansprechpartner = ansprechpartner;
     }
 }