Пример #1
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            //_viewModel.GroupBuyingTypeSysNo = (int)cmbGroupBuyingCategoryType.SelectedValue;
            _viewModel.GroupBuyingTypeSysNo = 0;
            if (ValidationManager.Validate(Grid) && ValidationManager.Validate(gridPrice))
            {
                if (_viewModel.BeginDate == null)
                {
                    //Window.Alert("开始日期不能为空");
                    Window.Alert(ResGroupBuyingMaintain.Info_StartDateNotNull);
                    return;
                }
                if (_viewModel.EndDate == null)
                {
                    //Window.Alert("结束日期不能为空");
                    Window.Alert(ResGroupBuyingMaintain.Info_EndDateNotNull);
                    return;
                }
                if (_viewModel.CategoryType == GroupBuyingCategoryType.Virtual && string.IsNullOrEmpty(_viewModel.CouponValidDate))
                {
                    //Window.Alert("虚拟团购有效日期不能为空");
                    Window.Alert(ResGroupBuyingMaintain.Info_ActiveDateNotNull);
                    return;
                }
                if (_viewModel.GroupBuyingTypeSysNo != 6)
                {
                    if (string.IsNullOrWhiteSpace(_viewModel.ProductID) || _viewModel.ProductSysNo == null)
                    {
                        Window.Alert(ResGroupBuyingMaintain.Msg_IsProductNull);
                        return;
                    }
                    int _sysNoTmp = -1;
                    if (!int.TryParse(_viewModel.ProductSysNo.ToString(), out _sysNoTmp))
                    {
                        Window.Alert(ResGroupBuyingMaintain.Msg_IsProductSysNoFormatError);
                        return;
                    }
                }

                if (this._viewModel.CategoryType == GroupBuyingCategoryType.Virtual)
                {
                    if (this._viewModel.GroupBuyingVendorSysNo == null)
                    {
                        //Window.Alert("请选择商家!", MessageType.Warning);
                        Window.Alert(ResGroupBuyingMaintain.Info_SelectMerchant, MessageType.Warning);
                        return;
                    }
                    if (this._viewModel.VendorStoreList.Where(prop => prop.IsChecked).Count() == 0)
                    {
                        //Window.Alert("请选择门店!", MessageType.Warning);
                        Window.Alert(ResGroupBuyingMaintain.Info_SelectShop, MessageType.Warning);
                        return;
                    }
                }

                if (_viewModel.GroupBuyingTypeSysNo != 6)
                {
                    _Facade.LoadMarginRateInfo(_viewModel, (obj0, args0) =>
                    {
                        if (args0.FaultsHandle())
                        {
                            return;
                        }

                        UCGroupBuySaveInfo saveInfoView = new UCGroupBuySaveInfo();
                        saveInfoView.MsgListVM          = args0.Result;
                        saveInfoView.vm     = _viewModel;
                        saveInfoView.Dialog = Window.ShowDialog(ResGroupBuyingMaintain.Msg_MakeSure, saveInfoView, (o, arg) =>
                        {
                            if (arg.DialogResult == DialogResultType.OK)
                            {
                                SaveAction();
                            }
                        });
                    });
                }
                else
                {
                    SaveAction();
                }
            }
        }