예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Model model = modelCRUD1.Model;

            try
            {
                if (!ModelHelper.Validate(model))
                {
                    CustomMessageBox.ShowError(ResourceHelper.GetResourceText("RequiredName"));
                    return;
                }
                List <ModelFactor> factors = modelCRUD1.ModelFactors;
                if (factors.Count == 0)
                {
                    CustomMessageBox.ShowMessage(ResourceHelper.GetResourceText("AtLeastOneFactor"));
                    return;
                }

                model = ModelHelper.Save(model);
                foreach (ModelFactor mf in factors)
                {
                    mf.IDModel = model.IDModel;
                    ModelFactorHelper.Save(mf);
                }
                CustomMessageBox.ShowMessage(ResourceHelper.GetResourceText("ModelSavedOk"));
                ViewManager.ShowStart();
                ViewManager.LoadModelsMenu();
            }
            catch (Exception exception)
            {
                CustomMessageBox.ShowError(ResourceHelper.GetResourceText("ModelSavingError") + exception.Message);
            }
        }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (ModelFactor f in OrderedModelFactors)
                {
                    ModelFactorHelper.Save(f);
                }

                CustomMessageBox.ShowMessage(ResourceHelper.GetResourceText("ModelSavedOk"));
                ViewManager.CloseView();
            }
            catch (Exception exception)
            {
                CustomMessageBox.ShowError(exception.Message);
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (modelCRUD1.FactorsChanged() && CustomMessageBox.ShowMessage(ResourceHelper.GetResourceText("FactorsChangedMessage"), CustomMessageBoxMessageType.Information, CustomMessageBoxButtonType.YesNo) == CustomMessageBoxReturnValue.Cancel)
            {
                return;
            }

            try
            {
                Model model = modelCRUD1.Model;
                if (!ModelHelper.Validate(model))
                {
                    CustomMessageBox.ShowError(ResourceHelper.GetResourceText("RequiredName"));
                    return;
                }
                List <ModelFactor> factors = modelCRUD1.ModelFactors;
                if (!factors.Any())
                {
                    CustomMessageBox.ShowError(ResourceHelper.GetResourceText("AtLeastOneFactor"));
                    return;
                }

                model = ModelHelper.Save(model);
                foreach (ModelFactor mf in factors)
                {
                    mf.IDModel = model.IDModel;
                    ModelFactorHelper.Save(mf);
                }
                CustomMessageBox.ShowMessage(ResourceHelper.GetResourceText("ModelSavedOk"));
                ViewManager.LoadModelsMenu();
                ViewManager.ShowStart();
                EventManager.RaiseModelUpdated();
            }
            catch (Exception exception)
            {
                CustomMessageBox.ShowError(exception.Message);
            }
        }