private void Button_Save_Click(object sender, RoutedEventArgs e) { if (_GiftBatchInfoVM.HasValidationErrors) { return; } if (!ValidationManager.Validate(this.Grid_PrimaryInfo)) { return; } if (DateTime.Parse(_GiftBatchInfoVM.BeginDate) > DateTime.Parse(_GiftBatchInfoVM.EndDate)) { //Window.Alert("开始时间不能大于结束时间!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_StartDateMoreThanEndDate", CurrentCulture)); return; } if (_GiftBatchInfoVM.SaleGiftType != SaleGiftType.Vendor && string.IsNullOrEmpty(_GiftBatchInfoVM.PromotionName)) { //Window.Alert("规则名称不能为空!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_RuleNameNotNull", CurrentCulture)); return; } if (!_GiftBatchInfoVM.IsSpecifiedGift && string.IsNullOrEmpty(this._GiftBatchInfoVM.TotalQty)) { //Window.Alert("非指定赠品总数量不能为空!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_QuantityNotNull", CurrentCulture)); return; } if (_GiftBatchInfoVM.SaleGiftType.HasValue) { foreach (ProductItemVM gift in _GiftBatchInfoVM.Gifts) { if (string.IsNullOrEmpty(gift.Priority)) { //Window.Alert("优先级不能为空!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_PriorityNotNull", CurrentCulture)); return; } if (_GiftBatchInfoVM.IsSpecifiedGift && string.IsNullOrEmpty(gift.HandselQty)) { // Window.Alert("指定赠品赠送数量不能为空!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_TheQuantityNotNull", CurrentCulture)); return; } } if (_GiftBatchInfoVM.SaleGiftType == SaleGiftType.Multiple) { foreach (ProductItemVM gift in _GiftBatchInfoVM.ProductItems1) { if (gift.HasValidationErrors) { return; } if (string.IsNullOrEmpty(gift.PurchasingAmount)) { //Window.Alert("左侧购买数量不能为空!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_LeftBuyQuantityNotNull", CurrentCulture)); return; } } foreach (ProductItemVM gift in _GiftBatchInfoVM.ProductItems2) { if (gift.HasValidationErrors) { return; } if (string.IsNullOrEmpty(gift.PurchasingAmount)) { //Window.Alert("右侧购买数量不能为空!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_RightBuyQuantityNotNull", CurrentCulture)); return; } } } } if (!ValidateGiftGrid()) { return; } string errorInfo = ""; if (!this._GiftBatchInfoVM.ValidateQty(out errorInfo)) { CurrentWindow.Alert(errorInfo); return; } SaleGiftFacade facade = new SaleGiftFacade(CPApplication.Current.CurrentPage); facade.BatchCreateSaleGift(_GiftBatchInfoVM, (s, args) => { //Window.Alert("保存成功!"); Window.Alert(ResBatchCreateSaleGift.ResourceManager.GetString("Tips_SaveSuccess", CurrentCulture)); }); }