Esempio n. 1
0
        private void SubscribeToEvents()
        {
            imagesDetailUC.SaveImagesDetailEventRaised += (sender, modelDictionary) =>
            {
                ImagesDtoModel imageDto = new ImagesDtoModel
                {
                    Id           = modelDictionary.ModelDictionary["Id"] == "" ? 0 : int.Parse(modelDictionary.ModelDictionary["Id"]),
                    ProductId    = Convert.ToInt32(modelDictionary.ModelDictionary["ProductId"]),
                    ProductName  = modelDictionary.ModelDictionary["ProductName"],
                    FileName     = modelDictionary.ModelDictionary["FileName"],
                    LinkWebStore = modelDictionary.ModelDictionary["LinkWebStore"],
                    LinkSupplier = modelDictionary.ModelDictionary["LinkSupplier"],
                    LocalPath    = modelDictionary.ModelDictionary["LocalPath"]
                };
                if (imageDto.Id > 0)
                {
                    facade.UpdateImage(imageDto);
                }
                else
                {
                    facade.AddImage(imageDto);
                }

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

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