Beispiel #1
0
        private void SubscribeToEvents()
        {
            suppliersDetailUC.SaveSuppliersDetailEventRaised += (sender, modelDictionary) =>
            {
                SuppliersDtoModel supplierDto = new SuppliersDtoModel()
                {
                    Id       = modelDictionary.ModelDictionary["Id"] == "" ? 0 : int.Parse(modelDictionary.ModelDictionary["Id"]),
                    Name     = modelDictionary.ModelDictionary["Name"],
                    Link     = modelDictionary.ModelDictionary["Link"],
                    Currency = modelDictionary.ModelDictionary["Currency"],
                    Notes    = modelDictionary.ModelDictionary["Notes"]
                };
                if (supplierDto.Id > 0)
                {
                    facade.UpdateSupplier(supplierDto);
                }
                else
                {
                    facade.AddSupplier(supplierDto);
                }

                EventHelper.RaiseEvent(this, SaveSupplierClickEventRaised, new EventArgs());
            };

            suppliersDetailUC.CancelSuppliersDetailEventRaised += (sender, e) => EventHelper.RaiseEvent(this, CancelClickEventRaised, new EventArgs());
        }