public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); //List<WebChannelVM> webChennelList = new List<WebChannelVM>(); //foreach (UIWebChannel uiChannel in CPApplication.Current.CurrentWebChannelList) //{ // webChennelList.Add(new WebChannelVM() { ChannelID = uiChannel.ChannelID, ChannelName = uiChannel.ChannelName }); //} //webChennelList.Insert(0, new WebChannelVM() { ChannelName = ResCommonEnum.Enum_Select }); //lstChannel.ItemsSource = webChennelList; //lstChannel.SelectedIndex = 0; List <KeyValuePair <SaleGiftStatus?, string> > statusList = EnumConverter.GetKeyValuePairs <SaleGiftStatus>(); statusList.Insert(0, new KeyValuePair <SaleGiftStatus?, string>(null, ResCommonEnum.Enum_Select)); cmbStatus.ItemsSource = statusList; cmbStatus.SelectedIndex = 0; List <KeyValuePair <SaleGiftType?, string> > typeList = EnumConverter.GetKeyValuePairs <SaleGiftType>(); typeList.Insert(0, new KeyValuePair <SaleGiftType?, string>(null, ResCommonEnum.Enum_Select)); cmbType.ItemsSource = typeList; cmbType.SelectedIndex = 0; _filterVM.ChannelID = "1"; gridFilter.DataContext = _filterVM; btnStackPanel.DataContext = _filterVM; _facade = new SaleGiftFacade(this); }
private void dgGiftProductLog_LoadingDataSource(object sender, LoadingDataEventArgs e) { SaleGiftFacade facade = new SaleGiftFacade(CPApplication.Current.CurrentPage); SaleGiftLogQueryFilterViewModel model = new SaleGiftLogQueryFilterViewModel(); model.ProductSysNo = ProductSysNo; model.PageInfo = new QueryFilter.Common.PagingInfo() { PageIndex = e.PageIndex, PageSize = e.PageSize, SortBy = e.SortField }; facade.QueryLog(model, (obj, args) => { var list = new List <dynamic>(); foreach (var row in args.Result.Rows) { list.Add(row); } this.dgGiftProductLog.ItemsSource = list; this.dgGiftProductLog.TotalCount = args.Result.TotalCount; }); }
public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); _facade = new SaleGiftFacade(this); int tempsysNo = -1; if (this.Request.QueryString != null && this.Request.QueryString.ContainsKey("sysno") && int.TryParse(this.Request.QueryString["sysno"].ToString().Trim(), out tempsysNo)) { currentSysNo = tempsysNo; if (this.Request.QueryString.ContainsKey("operation") && !string.IsNullOrEmpty(this.Request.QueryString["operation"].ToString().Trim())) { _operationType = this.Request.QueryString["operation"].ToString().ToLower(); } } if (_operationType == "edit") { //TODO:判断是否有编辑的权限,如果没有,则将自动变为view权限 } else if (_operationType == "mgt") { } else { } _saleGiftInfoVM.BeginDate = DateTime.Now; _saleGiftInfoVM.EndDate = DateTime.Now.AddDays(1); _facade.Load(currentSysNo, _saleGiftInfoVM, (obj, args) => { _saleGiftInfoVM = args.Result; this.DataContext = _saleGiftInfoVM; SetControlByOperation(); SetCanelAuditByRequest(); _discountBelongSnap = _saleGiftInfoVM.DisCountType; }); }
private void btnSaveProductRange_Click(object sender, RoutedEventArgs e) { SaleGiftInfoViewModel vm = this.DataContext as SaleGiftInfoViewModel; ValidationManager.Validate(this.ucLimitProduct.dgProductOnly); foreach (SaleGift_RuleSettingViewModel rowVM in vm.ProductCondition) { if (rowVM.HasValidationErrors) { return; } if (rowVM.RelProduct != null && rowVM.RelProduct.HasValidationErrors) { return; } } foreach (SaleGift_RuleSettingViewModel rm in vm.ProductOnlyList) { if (rm.HasValidationErrors) { return; } if (rm.RelProduct != null && rm.RelProduct.HasValidationErrors) { return; } } SaleGiftFacade facade = new SaleGiftFacade(CPApplication.Current.CurrentPage); facade.SetSaleGiftSaleRules(vm, (obj, args) => { CurrentWindow.Alert("主商品规则保存成功!"); }); }
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)); }); }
private void btnSaveGiftSetting_Click(object sender, RoutedEventArgs e) { SaleGiftInfoViewModel vm = this.DataContext as SaleGiftInfoViewModel; if (vm.GiftComboType == SaleGiftGiftItemType.GiftPool) { foreach (SaleGift_GiftItemViewModel giftitem in vm.GiftItemList) { giftitem.Count = "0"; if (string.IsNullOrEmpty(giftitem.PlusPrice)) { giftitem.PlusPrice = giftitem.CurrentPrice.GetValueOrDefault().ToString("f2"); } } int count = 0; int.TryParse(vm.ItemGiftCount, out count); if (string.IsNullOrEmpty(vm.ItemGiftCount) || count < 1) { tbItemGiftCount.Validation("赠品池任选总数量不能为空并且必须为大于0的整数!", vm, this.gridGiftType); return; } else { tbItemGiftCount.ClearValidationError(); } } else { tbItemGiftCount.ClearValidationError(); } List <SaleGift_GiftItemViewModel> list = dgGiftProduct.ItemsSource as List <SaleGift_GiftItemViewModel>; if (list == null || list.Count == 0) { CurrentWindow.Alert("请至少设置1个赠品!"); return; } if (vm.GiftComboType.Value == SaleGiftGiftItemType.AssignGift) { foreach (SaleGift_GiftItemViewModel item in list) { if (string.IsNullOrEmpty(item.Count) || item.Count.Equals("0")) { CurrentWindow.Alert("赠品数量必须大于0!"); return; } } } ValidationManager.Validate(this.dgGiftProduct); foreach (SaleGift_GiftItemViewModel rowVM in list) { if (rowVM.HasValidationErrors) { return; } } SaleGiftFacade facade = new SaleGiftFacade(CPApplication.Current.CurrentPage); if (vm.IsAccess) //有高级权限 { facade.CheckGiftStockResult(vm, (obj, arg) => { if (arg.FaultsHandle()) { return; } if (arg.Result.Length > 0) { CPApplication.Current.CurrentPage.Context.Window.Confirm(arg.Result + ";是否继续保存?", (objs, args) => { if (args.DialogResult == Newegg.Oversea.Silverlight.Controls.Components.DialogResultType.OK) { facade.SetSaleGiftGiftItemRules(vm, (o, a) => { if (a.FaultsHandle()) { return; } CurrentWindow.Alert("赠品规则保存成功!"); }); } }); } else { facade.SetSaleGiftGiftItemRules(vm, (o, a) => { if (a.FaultsHandle()) { return; } CurrentWindow.Alert("赠品规则保存成功!"); }); } }); } else { facade.SetSaleGiftGiftItemRules(vm, (o, a) => { if (a.FaultsHandle()) { return; } CurrentWindow.Alert("赠品规则保存成功!"); }); } }