コード例 #1
0
        private void SubscribeToEvents()
        {
            groupsDetailUC.SaveGroupsDetailEventRaised += (sender, modelDictionary) =>
            {
                GroupsDtoModel groupDto = new GroupsDtoModel
                {
                    Id                 = modelDictionary.ModelDictionary["Id"] == "" ? 0 : int.Parse(modelDictionary.ModelDictionary["Id"]),
                    Name               = modelDictionary.ModelDictionary["Name"],
                    Number             = modelDictionary.ModelDictionary["Number"],
                    Identifier         = modelDictionary.ModelDictionary["Identifier"],
                    AncestorNumber     = modelDictionary.ModelDictionary["AncestorNumber"],
                    AncestorIdentifier = modelDictionary.ModelDictionary["AncestorIdentifier"],
                    ProductType        = modelDictionary.ModelDictionary["ProductType"],
                    Link               = modelDictionary.ModelDictionary["Link"],
                    Notes              = modelDictionary.ModelDictionary["Notes"]
                };
                if (groupDto.Id > 0)
                {
                    facade.UpdateGroup(groupDto);
                }
                else
                {
                    facade.AddGroup(groupDto);
                }
                EventHelper.RaiseEvent(this, SaveGroupClickEventRaised, new EventArgs());
            };

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