private void FillListView()
        {
            if (_kunden != null )
            {
                KundenViewAdapter _adapter = new KundenViewAdapter (_activity, _kunden);
                _listview.Adapter = _adapter;

            }
        }
        async private void BtnSearchAsync()
        {
            ProgressDialog progressDialog = null;

            try
            {
                // Run the progressbar
                progressDialog = ProgressDialog.Show(_activity, "Apollo",this._activity.Resources.GetString(Resource.String.Loading), false);
                progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);

                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)_activity.GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(_edDlgSearch.WindowToken, 0);

                _kunden = await BusinessLayer.Kunde.GetKundenAsync (_edDlgSearch.Text, Utilities.GetCurrentLanguage(_activity),MainActivity.User);
                _adapter = new KundenViewAdapter (_activity, _kunden);
                _listview.Adapter = _adapter;

            }
            catch(Exception ex)
            {
                DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
            }
            finally
            {
                // Hide the progressbar
                if (progressDialog != null)
                    progressDialog.Dismiss ();
            }
        }
Beispiel #3
0
		public override bool BtnDeleteClick()
		{

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

			// No Item is selected
			if (_edMainName.Text == "")
				return false;


			if (this._fragmentState.BtnDeleteClick ( ) != null)
			{
				if (this._fragmentState.GetType ().ToString () == "UI.StateFragmentAnsprechpartner")
				{
					// If it is deleting the Ansprechpartner, get out of this sub
					return true;
				}

                if (this._fragmentState.GetType().ToString() == "UI.StateFragmentTask")
                {
                    // If it is deleting the task, get out of this sub
                    return true;
                }

				// Create a new person object, so that we don't have a null reference
				_person = BusinessLayer.Kunde.Create();

				// Remove the object from the list and display the new list in the listview
				_kunden.RemoveAt (_selectedIndex);
				_adapter = new KundenViewAdapter (_mainActivity,_kunden);
				_list.Adapter = _adapter;
				this.ResetControls();
				return true;

			}

			return false;
		}
Beispiel #4
0
		async public override Task<bool> BtnSaveClickAsync ()
		{

			bool bInserting = false;
			if (_person.ID == null)
				bInserting = true;

			if ( await _fragmentState.BtnSaveClickAsync () == false)
				return false;

			if (this._fragmentState.GetType ().ToString () == "UI.StateFragmentAnsprechpartner" || this._fragmentState.GetType ().ToString () == "UI.StateFragmentTask")
			{
                Android.Widget.Toast.MakeText(_mainActivity,_mainActivity.Resources.GetString(Resource.String.SavedSuccessfully), Android.Widget.ToastLength.Short).Show();
				return true;
			}

			if (bInserting)
			{
				// INSERT statement
				_kunden.Add ((BusinessLayer.Kunde)_person);
				_selectedIndex = _kunden.Count - 1;
			}
			else
			{
				// UPDATE statement
				_kunden [_selectedIndex] = (BusinessLayer.Kunde)_person;						
			}


			// Refresh the listview
			_adapter = new UI.KundenViewAdapter(_mainActivity,_kunden);
			_list.Adapter = _adapter;

			// Inform the user
            Android.Widget.Toast.MakeText(_mainActivity,_mainActivity.Resources.GetString(Resource.String.SavedSuccessfully), Android.Widget.ToastLength.Short).Show();

			// refresh the general controls
			_edMainName.Text = _person.Name;
			_tvEmail.Text = _person.Email;
			_tvNummer.Text = _person.Nummer;
			_tvTelefon.Text = _person.Telefon;
			_tvUmsatz.Text = _person.Umsatz;
			_mainActivity._btnSave.Enabled = false;

			return true;
		}
Beispiel #5
0
		async public override System.Threading.Tasks.Task BtnSearchClickAsync ()
		{

            _kunden = await BusinessLayer.Kunde.GetKundenAsync (_edSearch.Text, Utilities.GetCurrentLanguage(_mainActivity),MainActivity.User);

			_adapter = new KundenViewAdapter (_mainActivity, _kunden);
			if (_mainActivity._activityData == null)
			{
				_mainActivity._activityData = new MainActivityData ();
			}
			_mainActivity._activityData.Kunden = _kunden;
			_list.Adapter = _adapter;
			_edMainName.Text = "";
			_tvEmail.Text = "";
			_tvNummer.Text = "";
			_tvTelefon.Text = "";
			_tvUmsatz.Text = "";
			_fragmentState.BtnSearchClick ();		 

		}
Beispiel #6
0
		public override void BtnSearchClick()
		{

			_kunden = BusinessLayer.Kunde.GetKunden (_edSearch.Text, Utilities.GetCurrentLanguage(_mainActivity), MainActivity.User,false);
			_adapter = new KundenViewAdapter (_mainActivity,_kunden);
			if (_mainActivity._activityData == null)
			{
				_mainActivity._activityData = new MainActivityData ();
			}
			_mainActivity._activityData.Kunden = _kunden;
			_list.Adapter = _adapter;
			_edMainName.Text = "";
			_tvEmail.Text = "";
			_tvNummer.Text = "";
			_tvTelefon.Text = "";
			_tvUmsatz.Text = "";
			_fragmentState.BtnSearchClick ();

		}
		void RunActivityData()
		{
			// If this activity was filled with data then
			// Fill our Activity with data

			// Fill the EdSearch

			var adapter = new KundenViewAdapter(this, this._activityData.Kunden);
			_list.Adapter = adapter;
			_activityData = new MainActivityData{Kunden = this._activityData.Kunden};
			_edSearch.Text = _activityData.edSearchText;

		}