public void Initialize(BusinessLayer.Person kunde, BusinessLayer.Transaction transaction, BusinessLayer.Position position, BusinessLayer.Artikel artikel)
        {
            _kunde = kunde;
            _transaction = transaction;
            _tempPosition = position;
            _article = artikel;

            // set the modus
            if (position == null)
                this._modus = EditMode.INSERT;
            else
                this._modus = EditMode.UPDATE;
            
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///
        /// Member functions of the class
        ///
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region Member Functions

        /// <summary>
        /// Purpose: Gets a person object to get all the Angebote of this person 
        /// </summary>
        /// <param name="person">Person to fill the controls with</param>
        public override void FillControls (BusinessLayer.Artikel artikel)
        {

            if (artikel == null)
                return;

            if (_artikel == null || artikel.ID != _artikel.ID) {
                _artikel = artikel;
                _crossArtikeln = _artikel.GetArtikelCrossSelling(Application._user);

            }


        }
        /// <summary>
        /// Purpose: Gets the tasks of the selected person
        /// Example FillControls (person) -> GetTasks(person.id) 
        ///          -> according to this the VCSelectTasks can be run with filled data
        /// </summary>
        /// <returns>The controls async.</returns>
        /// <param name="person">Person.</param>
        async public override Task FillControlsAsync(BusinessLayer.Artikel artikel)
        {

            if (artikel == null)
                return;

            if (_artikel == null || artikel.ID != _artikel.ID) {
                _artikel = artikel;
                _crossArtikeln = await  _artikel.GetArtikelCrossSellingAsync(Application._user);
            }

        }
        /// <summary>
        /// Purpose: Gets a person object an fills the textviews with it. It is called by the State Class
        /// Example: FillControls (person) -> txtGeneralName.text = person.Name ...etc.
        /// </summary>
        /// <param name="person">Person to fill the controls with</param>
        public override void FillControls (BusinessLayer.Artikel artikel)
        {

            // First check that the person object has a reference
            if (artikel == null)
                return;

            _artikel = artikel;
            TxtAktuellerBestand.Text = BusinessLayer.Artikel.GetArtikelBestand(artikel.ID, artikel.Version, Application._user) + " " + _artikel.Einheit;



        }
        async  public override System.Threading.Tasks.Task FillControlsAsync(BusinessLayer.Artikel artikel)
        {

            // First check that the person object has a reference
            if (artikel == null)
                return ;

            _artikel = artikel;
            TxtAktuellerBestand.Text = await BusinessLayer.Artikel.GetArtikelBestandAsync(artikel.ID, artikel.Version, Application._user) + " " + _artikel.Einheit ;

        }
        protected override void OnStart()
        {
            Console.WriteLine("OnStart");
            base.OnStart();
            _listview =  this.FindViewById<ListView>(Resource.Id.DlgListviewMainListview);
            _btnSearch = this.FindViewById<ImageButton>(Resource.Id.btnDlgSearch);
            _edDlgSearch = this.FindViewById<EditText>(Resource.Id.edDlgSearch);
            _edDlgSearch.EditorAction += (object sender, TextView.EditorActionEventArgs e) => 
                {
                    if (e.ActionId == Android.Views.InputMethods.ImeAction.Search)
                    {
                        BtnSearchAsync();
                    }
                };

            _btnSearch.Click+= (sender, e) => {
                BtnSearchAsync();
            };

            _listview.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>  {
                artikel = _artikeln[e.Position];
                _dlgPosition.UpdateArtikelAsync(artikel);
                this.Dismiss();
            };
        }
        /// <summary>
        /// Fill Artikel control, Einheit, Waehrung
        /// </summary>
        /// <param name="country">The Country to fill the controls.</param>
        public void UpdateArtikel(BusinessLayer.Artikel artikel)
        {
            if (artikel == null)
                return;

            // Set the insert modus
            this._modus = EditMode.INSERT;
            this._tempPosition = BusinessLayer.Position.Create();

            string CompleteString = "";
            if (artikel.Bez2 != "")
                CompleteString = artikel.Bez2;

            if (artikel.Bez3 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez3;
                else
                    CompleteString = artikel.Bez3;
            }

            if (artikel.Bez4 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez4;
                else
                    CompleteString = artikel.Bez4;
            }

            if (artikel.Bez5 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez5;
                else
                    CompleteString = artikel.Bez5;
            }

            if (artikel.Bez6 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez6;
                else
                    CompleteString = artikel.Bez6;
            }

            if (artikel.Version != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Version ;
                else
                    CompleteString = artikel.Version ;
            }

            TxtArtikel.Text = artikel.Nummer + " - " + artikel.Bez1 + " " + CompleteString;

            // Set the default VkMenge
            if (artikel.VkMenge == "0")
                TxtMenge.Text = "1";
            else
                TxtMenge.Text = artikel.VkMenge;

            // set the global member for the selected Artikel
            _article = artikel;

            // fill the other controls
            LblEinheit.Text = artikel.Einheit;
            LblPositionWertEin.Text = artikel.Waehrung;
            LblGesamtWertEinheit.Text = artikel.Waehrung;

            // Calculate the price for this article
            CalculateItemPrice();
        }
Ejemplo n.º 8
0
 public ArtikelGeneralFragment( MainActivity activity,   BusinessLayer.Artikel artikel)
 {
     this.layoutId = UI.Resource.Layout.FrgArtikelGeneral;
     _artikel = artikel;
     _activity = activity;
 }
Ejemplo n.º 9
0
 public ArtikelGeneralFragment(int layoutId, MainActivity activity,   BusinessLayer.Artikel artikel)
 {
     this.layoutId = layoutId;
     _artikel = artikel;
     _activity = activity;
 }
Ejemplo n.º 10
0
        async public void UpdateArtikelAsync(BusinessLayer.Artikel artikel)
        {
            if (artikel == null)
                return;

            // set the insert modus
            this._modus = EditMode.INSERT;
            this._tempPosition = BusinessLayer.Position.Create();

            string CompleteString = "";
            if (artikel.Bez2 != "")
                CompleteString = artikel.Bez2;

            if (artikel.Bez3 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez3;
                else
                    CompleteString = artikel.Bez3;
            }

            if (artikel.Bez4 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez4;
                else
                    CompleteString = artikel.Bez4;
            }

            if (artikel.Bez5 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez5;
                else
                    CompleteString = artikel.Bez5;
            }

            if (artikel.Bez6 != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Bez6;
                else
                    CompleteString = artikel.Bez6;
            }

            if (artikel.Version != "")
            {
                if (CompleteString != "")
                    CompleteString += " / " + artikel.Version ;
                else
                    CompleteString = artikel.Version ;
            }

            tvArtikel.Text = artikel.Nummer + " - " + artikel.Bez1 + " " + CompleteString;

            // Set the default VkMenge
            if (artikel.VkMenge == "0")
                edMenge.Text = "1";
            else
                edMenge.Text = artikel.VkMenge;

            // set the global member for the selected Artikel
            _artikel = artikel;

            // fill the other controls
            tvQuantityEinheit.Text = artikel.Einheit;
            tvPositionsWertEinheit.Text = artikel.Waehrung;
            tvTotalWertEinheit.Text = artikel.Waehrung;

            // Calculate the price for this article
            await CalculateItemPriceAsync();
        }
Ejemplo n.º 11
0
        void RunPositionEditDlg(EditMode mode)
        {
            try
            {
                if (mode == EditMode.INSERT)
                {
                    if (!this.ValidateKpf())
                        return;

                    _transaction.Datum = EdDatum.Text;
                    _transaction.KundeID = _person.ID;
                    _transaction.Projekt = EdProject.Text;
                    if (_rechnungsAnschrift != null)
                        _transaction.RechnungsAnschriftID = _rechnungsAnschrift.ID;
                    if (_lieferAnschrift != null)
                        _transaction.LieferAnschriftID = _lieferAnschrift.ID;


                    var dlg = new PositionEditDialog(_context);
                    dlg.Initialize(_person, _transaction, null, null);
                    dlg.Show();
                    dlg.DismissEvent += (object sen, EventArgs e) =>
                    {
                            if (dlg.bChanged)
                            {
                                // update the values 
                                this.UpdateTransaction(_transaction,_tempPosition,EditMode.INSERT);
                                this.bChanged = true;
                            }
                    };
                }
                else
                {
                    _transaction.Datum = EdDatum.Text;
                    _transaction.KundeID = _person.ID;
                    _transaction.Projekt = EdProject.Text;
                    if (_rechnungsAnschrift != null)
                        _transaction.RechnungsAnschriftID = _rechnungsAnschrift.ID;
                    if (_lieferAnschrift != null)
                        _transaction.LieferAnschriftID = _lieferAnschrift.ID;
                     
                    _article = BusinessLayer.Artikel.GetArtikel(_tempPosition.ArtID, _tempPosition.Version, Utilities.GetCurrentLanguage(MainActivity._mainActivity), MainActivity.User);

                    var dlg = new PositionEditDialog(_context);
                    dlg.Initialize(_person, _transaction, _tempPosition, _article);
                    dlg.Show();
                    dlg.DismissEvent += (object sen, EventArgs e) =>
                        {
                            if (dlg.bChanged)
                            {
                                // update the values
                                this.UpdateTransaction(_transaction,_tempPosition,EditMode.UPDATE);
                                this.bChanged = true;
                            }
                        };
                }
            }
            catch(Exception ex)
            {
                ExceptionWriter.WriteLogFile(ex);
            }

        }
        /// <summary>
        /// Purpose: Gets a person object an fills the textviews with it. It is called by the State Class
        /// Example: FillControls (person) -> txtGeneralName.text = person.Name ...etc.
        /// </summary>
        /// <param name="person">Person to fill the controls with</param>
        public void FillControls (BusinessLayer.Artikel artikel)
        {

            // First check that the person object has a reference
            if (artikel == null)
                return;

            _artikel = artikel;

            TxtVK.Text = _artikel.VKLast + " " + _artikel.Waehrung;
            TxtSK.Text = _artikel.SK + " " + _artikel.Waehrung;



            tableview.Source = new TableSource(  this);



        }
        async  public System.Threading.Tasks.Task FillControlsAsync(BusinessLayer.Artikel artikel)
        {

            // First check that the person object has a reference
            if (artikel == null)
                return ;

            _artikel = artikel;
            TxtVK.Text = _artikel.VKLast + " " + _artikel.Waehrung;
            TxtSK.Text = _artikel.SK + " " + _artikel.Waehrung;
            _artikel.StaffelPreise = await _artikel.GetArtikelStaffelPreiseAsync(NSLocale.CurrentLocale.LanguageCode.ToUpper(), Application._user);
            await System.Threading.Tasks.Task.Delay(0);
            tableview.Source = new TableSource(  this);
            tableview.Delegate = new TableViewDelegate(this);
            tableview.ReloadData();


        }
        protected void RunPositionEditDlg(EditMode mode)
        {
            if (mode == EditMode.INSERT)
            {
                // First validate the controls
                if (!ValidateKpf())
                    return;

                _transaction.Datum = TxtDatum.Text;
                _transaction.KundeID = _person.ID;
                _transaction.Projekt = TxtProjekt.Text;
                if(_rechnungsAnschrift != null)
                    _transaction.RechnungsAnschriftID = _rechnungsAnschrift.ID;
                if(_lieferAnschrift != null)
                    _transaction.LieferAnschriftID = _lieferAnschrift.ID;

                TBPositionEdit temp = Storyboard.InstantiateViewController<TBPositionEdit>();
                temp.Initialize(_person, _transaction,null,null);
                temp.RegisterObserver(this);
                PresentViewController(temp, true, null);

            }
            else
            {
                // Set the modus to UPDATE

                _transaction.Datum = TxtDatum.Text;
                _transaction.KundeID = _person.ID;
                _transaction.Projekt = TxtProjekt.Text;
                if(_rechnungsAnschrift != null)
                    _transaction.RechnungsAnschriftID = _rechnungsAnschrift.ID;
                if(_lieferAnschrift != null)
                    _transaction.LieferAnschriftID = _lieferAnschrift.ID;

                _article = BusinessLayer.Artikel.GetArtikel(_tempPosition.ArtID,_tempPosition.Version,Language.GetLanguageCode(),ref Application._user);


                TBPositionEdit temp = Storyboard.InstantiateViewController<TBPositionEdit>();
                temp.Initialize(_person, _transaction, _tempPosition,_article);
                temp.RegisterObserver(this);
                PresentViewController(temp, true, null);

      

            }

        }