Пример #1
0
        private void SubscribeToEvents()
        {
            unitsDetaileUC.SaveUnitsDetailEventRaised += (sender, modelDictionary) =>
            {
                UnitsDtoModel unitDto = new UnitsDtoModel
                {
                    Id    = modelDictionary.ModelDictionary["Id"] == "" ? 0 : int.Parse(modelDictionary.ModelDictionary["Id"]),
                    Name  = modelDictionary.ModelDictionary["Name"],
                    Notes = modelDictionary.ModelDictionary["Notes"]
                };
                if (unitDto.Id > 0)
                {
                    facade.UpdateUnit(unitDto);
                }
                else
                {
                    facade.AddUnit(unitDto);
                }

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

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