예제 #1
0
        private void SubscribeToEvents()
        {
            parametersDetailUC.SaveParametersDetailEventRaised += (sender, modelDictionary) =>
            {
                ParametersDtoModel parameterDto = new ParametersDtoModel
                {
                    Id          = modelDictionary.ModelDictionary["Id"] == "" ? 0 : int.Parse(modelDictionary.ModelDictionary["Id"]),
                    ProductId   = int.Parse(modelDictionary.ModelDictionary["ProductId"]),
                    ProductName = modelDictionary.ModelDictionary["ProductName"],
                    Name        = modelDictionary.ModelDictionary["Name"],
                    UnitId      = int.Parse(modelDictionary.ModelDictionary["UnitId"]),
                    UnitName    = modelDictionary.ModelDictionary["UnitName"],
                    Value       = modelDictionary.ModelDictionary["Value"],
                };
                if (parameterDto.Id > 0)
                {
                    facade.UpdateParameter(parameterDto);
                }
                else
                {
                    facade.AddParameter(parameterDto);
                }

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

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