void UCProductRange_Loaded(object sender, RoutedEventArgs e) { if (isLoaded) { return; } CouponsInfoViewModel vm = this.DataContext as CouponsInfoViewModel; if (vm.ProductRangeType == CouponsProductRangeType.LimitCategoryBrand) { //expandeVendor.Visibility = Visibility.Visible; expanderBrand.Visibility = System.Windows.Visibility.Visible; expanderCategory.Visibility = System.Windows.Visibility.Visible; expanderProduct.Visibility = System.Windows.Visibility.Collapsed; } else if (vm.ProductRangeType == CouponsProductRangeType.LimitProduct) { expandeVendor.Visibility = Visibility.Collapsed; expanderBrand.Visibility = System.Windows.Visibility.Collapsed; expanderCategory.Visibility = System.Windows.Visibility.Collapsed; expanderProduct.Visibility = System.Windows.Visibility.Visible; } if (vm.IsOnlyViewMode) { OperationControlStatusHelper.SetControlsStatus(expanderCategory, true); OperationControlStatusHelper.SetControlsStatus(expanderBrand, true); OperationControlStatusHelper.SetControlsStatus(expandeVendor, true); OperationControlStatusHelper.SetControlsStatus(expanderProduct, true); } isLoaded = true; }
void UCSaleGiftRule_Loaded(object sender, RoutedEventArgs e) { if (isLoaded) { return; } chkGiftComboType.IsEnabled = true; tbItemGiftCount.IsEnabled = true; SaleGiftInfoViewModel vm = this.DataContext as SaleGiftInfoViewModel; if (vm.Type == SaleGiftType.Vendor) { chkGiftComboType.IsEnabled = false; chkGiftComboType.IsChecked = true; tbItemGiftCount.IsEnabled = false; } //if (vm.Type == SaleGiftType.Additional) //{ // chkGiftComboType.IsEnabled = false; // chkGiftComboType.IsChecked = false; //} this.dgGiftProduct.ItemsSource = vm.GiftItemList; this.dgGiftProduct.Bind(); if (vm.GiftComboType.Value == SaleGiftGiftItemType.GiftPool) { dgGiftProduct.Columns[dgGiftProduct.Columns.Count - 2].Visibility = System.Windows.Visibility.Collapsed; tbItemGiftCount.SetReadOnly(false); } else { dgGiftProduct.Columns[dgGiftProduct.Columns.Count - 2].Visibility = System.Windows.Visibility.Visible; tbItemGiftCount.SetReadOnly(true); tbItemGiftCount.Text = ""; } //如果是满额加购,需要设置加购价格 //if (vm.Type == SaleGiftType.Additional) //{ // tbItemGiftCount.Text = "1"; // gridGiftType.RowDefinitions[0].Height = new GridLength(0); // dgGiftProduct.Columns[dgGiftProduct.Columns.Count - 3].Visibility = System.Windows.Visibility.Visible; //} //else //{ // dgGiftProduct.Columns[dgGiftProduct.Columns.Count - 3].Visibility = System.Windows.Visibility.Collapsed; //} if (vm.IsOnlyViewMode) { OperationControlStatusHelper.SetControlsStatus(this.gridLayout, true); } isLoaded = true; }
void UCDiscount_Loaded(object sender, RoutedEventArgs e) { if (isLoaded) { return; } CouponsInfoViewModel vm = (CouponsInfoViewModel)this.DataContext; if (vm.IsDiscountAmount.HasValue && vm.IsDiscountAmount.Value) { rdoPre = this.rdoDiscountAmount; } if (vm.IsDiscountPercent.HasValue && vm.IsDiscountPercent.Value) { rdoPre = this.rdoDiscountPercent; } if (vm.IsDiscountSubtract.HasValue && vm.IsDiscountSubtract.Value) { rdoPre = this.rdoDiscountSubtract; } if (vm.IsDiscountFinal.HasValue && vm.IsDiscountFinal.Value) { rdoPre = this.rdoDiscountFinal; } if (rdoPre == null) { rdoPre = this.rdoDiscountAmount; } //SetDiscountInputType(rdoPre, true); SetControlVisible(false); if (vm.IsOnlyViewMode) { if (vm.PriceDiscountRule != null && vm.PriceDiscountRule.Count > 0) { this.dgDiscountProduct.Visibility = System.Windows.Visibility.Visible; } if (vm.OrderAmountDiscountRule.OrderAmountDiscountRank != null && vm.OrderAmountDiscountRule.OrderAmountDiscountRank.Count > 0) { this.dgDiscountAmount.Visibility = System.Windows.Visibility.Visible; } OperationControlStatusHelper.SetControlsStatus(expanderDiscount, true); } isLoaded = true; }
public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); facade = new InvoiceInputFacade(this); VerifyPermission(); if (!string.IsNullOrEmpty(this.Request.Param)) { int sysNo = 0; int.TryParse(this.Request.Param, out sysNo); facade.LoadAPInvoiceWithItemsBySysNo(sysNo, (obj, args) => { vm = args.Result.Convert <APInvoiceInfo, InvoiceInputMaintainVM>(); if (vm != null) { this.DataContext = vm; lastVM = Newegg.Oversea.Silverlight.Utilities.UtilityHelper.DeepClone <InvoiceInputMaintainVM>(vm); OperationControlStatusHelper.GetChildObjects <CheckBox>(DataGrid_POItem_Result, "chkbx_SelectAll")[0].IsChecked = true; CheckBox_Click(OperationControlStatusHelper.GetChildObjects <CheckBox>(DataGrid_POItem_Result, "chkbx_SelectAll")[0], null); //OperationControlStatusHelper.GetChildObjects<CheckBox>(DataGrid_POItem_Result, "chkbx_SelectAll")[0] OperationControlStatusHelper.GetChildObjects <CheckBox>(DataGrid_InvoiceItem_Result, "chkbx_SelectAll")[0].IsChecked = true; CheckBox_Click(OperationControlStatusHelper.GetChildObjects <CheckBox>(DataGrid_InvoiceItem_Result, "chkbx_SelectAll")[0], null); } else { Window.Alert(ResInvoiceInputMaintain.Msg_NoData); } SetControlStatus(); }); } else { this.DataContext = vm = new InvoiceInputMaintainVM(); vm.InvoiceDate = DateTime.Today; lastVM = Newegg.Oversea.Silverlight.Utilities.UtilityHelper.DeepClone <InvoiceInputMaintainVM>(vm); SetControlStatus(); } BuildValidateCondition(); }
void UCRule_Loaded(object sender, RoutedEventArgs e) { if (isLoaded) { return; } CouponsInfoViewModel vm = this.DataContext as CouponsInfoViewModel; if (vm.BindCondition.Value == CouponsBindConditionType.None) { //控制发放的优惠券有效期的显示 gridValidPeriod.Visibility = System.Windows.Visibility.Collapsed; } else { gridValidPeriod.Visibility = System.Windows.Visibility.Visible; } if (vm.ValidPeriod == CouponsValidPeriodType.CustomPeriod) { spCustomDateRange.Visibility = System.Windows.Visibility.Visible; } else { spCustomDateRange.Visibility = System.Windows.Visibility.Collapsed; } datepickerBindingDate.IsEnabled = vm.IsAutoBinding.Value; if (vm.IsOnlyViewMode) { OperationControlStatusHelper.SetControlsStatus(expanderRule, true); OperationControlStatusHelper.SetControlsStatus(expanderBind, true); } ShowUiControls(vm); isLoaded = true; }
void UCSaleGiftProductRange_Loaded(object sender, RoutedEventArgs e) { if (isLoaded) { return; } SaleGiftInfoViewModel vm = this.DataContext as SaleGiftInfoViewModel; if (vm.IsOnlyViewMode) { OperationControlStatusHelper.SetControlsStatus(this.ucLimitScope, true); OperationControlStatusHelper.SetControlsStatus(this.ucLimitProduct, true); } //if (vm.Type == SaleGiftType.Full) //{ // this.ucLimitProduct.dgProductOnly.Columns[8].Visibility = System.Windows.Visibility.Collapsed; //} isLoaded = true; }
void UCCustomerRange_Loaded(object sender, RoutedEventArgs e) { if (isLoaded) { return; } CouponsInfoViewModel vm = this.DataContext as CouponsInfoViewModel; if (vm.IsCustomerNoLimit.Value) { gridUserRankSetting.Visibility = System.Windows.Visibility.Collapsed; gridUserIDSetting.Visibility = System.Windows.Visibility.Collapsed; PreLimitType = LimitType.NoLimit; } else if (vm.IsCustomerRank.Value) { gridUserRankSetting.Visibility = System.Windows.Visibility.Visible; gridUserIDSetting.Visibility = System.Windows.Visibility.Collapsed; PreLimitType = LimitType.CustomerRank; } else if (vm.IsCustomerID.Value) { gridUserRankSetting.Visibility = System.Windows.Visibility.Collapsed; gridUserIDSetting.Visibility = System.Windows.Visibility.Visible; PreLimitType = LimitType.CustomerID; } if (vm.IsAreaNoLimit.Value) { gridArea.Visibility = System.Windows.Visibility.Collapsed; PreIsNoLimitArea = true; } else { gridArea.Visibility = System.Windows.Visibility.Visible; PreIsNoLimitArea = false; } ComboBoxItem defaultItem = new ComboBoxItem(); defaultItem.Content = "不限"; defaultItem.Tag = -1; defaultItem.IsSelected = false; cmbCustomerRank.Items.Add(defaultItem); foreach (var value in Enum.GetValues(typeof(CustomerRank))) { if (vm.CustomerCondition.RelCustomerRanks.CustomerRankList != null) { SimpleObjectViewModel sim = vm.CustomerCondition.RelCustomerRanks.CustomerRankList.FirstOrDefault(f => f.SysNo.Value == (int)value); if (sim != null) { CustomerRank cre = (CustomerRank)Enum.Parse(typeof(CustomerRank), value.ToString(), true); sim.Name = EnumConverter.GetDescription(cre); continue; } } ComboBoxItem item = new ComboBoxItem(); CustomerRank k = (CustomerRank)Enum.Parse(typeof(CustomerRank), value.ToString(), true); item.Content = EnumConverter.GetDescription(k); item.Tag = value; item.IsSelected = false; cmbCustomerRank.Items.Add(item); } if (cmbCustomerRank.Items.Count > 0) { cmbCustomerRank.SelectedIndex = 0; } AreaQueryFacade areaFacade = new AreaQueryFacade(); areaFacade.QueryProvinceAreaList((obj, args) => { if (args.FaultsHandle()) { return; } List <AreaInfo> areaList = args.Result; foreach (AreaInfo area in areaList) { if (vm.CustomerCondition.RelAreas.AreaList != null) { SimpleObjectViewModel sim = vm.CustomerCondition.RelAreas.AreaList.FirstOrDefault(f => f.SysNo == area.SysNo); if (sim != null) { sim.Name = area.ProvinceName; continue; } } ComboBoxItem item = new ComboBoxItem(); item.Content = area.ProvinceName; item.Tag = area.SysNo; item.IsSelected = false; cmbArea.Items.Add(item); } if (cmbArea.Items.Count > 0) { cmbArea.SelectedIndex = 0; } }); if (vm.IsOnlyViewMode) { OperationControlStatusHelper.SetControlsStatus(gridLayout, true); } isLoaded = true; }
private void SetControlByOperation() { spFunction.Visibility = System.Windows.Visibility.Collapsed; Visibility buttonVisibility = System.Windows.Visibility.Visible; if (!_couponsInfoVM.SysNo.HasValue) { SetTabItem(0); _couponsInfoVM.IsOnlyViewMode = false; } else { if (_operationType.ToLower() == "edit") { SetTabItem(0); _couponsInfoVM.IsOnlyViewMode = false; } else if (_operationType.ToLower() == "mgt") { SetTabItem(99); buttonVisibility = System.Windows.Visibility.Collapsed; _couponsInfoVM.IsOnlyViewMode = true; spFunction.Visibility = System.Windows.Visibility.Visible; } else { //浏览模式 SetTabItem(99); buttonVisibility = System.Windows.Visibility.Collapsed; _couponsInfoVM.IsOnlyViewMode = true; } } List <Button> list = new List <Button>(); list.Add(btnPreStep); list.Add(btnPreStep2); list.Add(btnPreStep3); list.Add(btnPreStep4); list.Add(btnSaveActivityRule); list.Add(btnSaveBasic); list.Add(btnSaveCustomerCondition); list.Add(btnSaveDiscountRule); list.Add(btnSaveProductCondition); list.Add(ucCouponCode.btnPreStep); list.Add(ucCouponCode.btnAddNewCode); list.Add(ucCouponCode.btnDeleteAllCode); list.Add(ucCouponCode.btnDeleteBachCode); if (list.Count > 0) { foreach (Button btn in list) { btn.Visibility = buttonVisibility; } } if (_couponsInfoVM.IsOnlyViewMode) { OperationControlStatusHelper.SetControlsStatus(ucBasic.expanderCategory, true); } if (_operationType.ToLower() == "mgt") { btnSubmitAudit.IsEnabled = false; btnCancelAudit.IsEnabled = false; btnAuditApprove.IsEnabled = false; btnAuditRefuse.IsEnabled = false; btnStop.IsEnabled = false; btnVoid.IsEnabled = false; switch (_couponsInfoVM.Status.Value) { case CouponsStatus.Init: btnSubmitAudit.IsEnabled = true; btnVoid.IsEnabled = true; break; case CouponsStatus.WaitingAudit: btnCancelAudit.IsEnabled = true; if (_couponsInfoVM.HasCouponCodeApprovePermission) { btnAuditApprove.IsEnabled = true; btnAuditRefuse.IsEnabled = true; } btnVoid.IsEnabled = true; break; case CouponsStatus.Ready: btnVoid.IsEnabled = true; break; case CouponsStatus.Run: if (_couponsInfoVM.HasCouponCodeStopApprovePermission) { btnStop.IsEnabled = true; } break; default: break; } } }
private void SetOperationButton() { OperationControlStatusHelper.SetAllButtonNotEnabled(ButtonPannel); btnRefresh.IsEnabled = true; if (CurrentSOVM.BaseInfoVM.Status == SOStatus.Split || CurrentSOVM.BaseInfoVM.Status == SOStatus.Abandon || CurrentSOVM.BaseInfoVM.Status == SOStatus.SystemCancel || CurrentSOVM.BaseInfoVM.Status == SOStatus.Reject) { btnPrintSO.IsEnabled = true; } if (CurrentSOVM.BaseInfoVM.Status == SOStatus.Origin) { btnForceAudit.IsEnabled = btnAudit.IsEnabled = AbandonButtonSet = btnHoldSO.IsEnabled = btnSplitInvoice.IsEnabled = btnPrintSO.IsEnabled = true; btnAuditNetPayAndSO.IsEnabled = CurrentSOVM.BaseInfoVM.IsNet ?? false; if (CurrentSOVM.BaseInfoVM.SplitType == SOSplitType.Customer || CurrentSOVM.BaseInfoVM.SplitType == SOSplitType.Force) { btnSplit.IsEnabled = true; btnAudit.IsEnabled = btnForceAudit.IsEnabled = btnAuditNetPayAndSO.IsEnabled = false; } } else if (CurrentSOVM.BaseInfoVM.Status == SOStatus.WaitingOutStock) { btnCancelAudit.IsEnabled = btnHoldSO.IsEnabled = AbandonButtonSet = btnPrintSO.IsEnabled = true; } else if (CurrentSOVM.BaseInfoVM.Status == SOStatus.WaitingManagerAudit) { btnForceManagerAudit.IsEnabled = btnCancelAudit.IsEnabled = btnManagerAudit.IsEnabled = btnHoldSO.IsEnabled = btnPrintSO.IsEnabled = true; } else if (CurrentSOVM.BaseInfoVM.Status == SOStatus.OutStock) { btnSplitInvoice.IsEnabled = btnPrintSO.IsEnabled = btnHoldSO.IsEnabled = true; } if (CurrentSOVM.InvoiceInfoVM.IsVAT == true) { btnHoldSO.IsEnabled = true; } if (CurrentSOVM.ShippingInfoVM.StockType == BizEntity.Invoice.StockType.MET) { btnSplit.IsEnabled = btnCancelAudit.IsEnabled = false; switch (CurrentSOVM.BaseInfoVM.Status) { case SOStatus.WaitingOutStock: btnSplitInvoice.IsEnabled = AbandonButtonSet = btnHoldSO.IsEnabled = false; break; case SOStatus.OutStock: btnSplitInvoice.IsEnabled = false; break; default: break; } } if (CurrentSOVM != null && CurrentSOVM.BaseInfoVM != null && CurrentSOVM.BaseInfoVM.Status == SOStatus.OutStock) { new OtherDomainQueryFacade(Page).GetSOIncomeBySOSysNo(SOSysNo, (soIncomeInfo) => { CurrentSOIncomeInfo = soIncomeInfo; if (CurrentSOVM.BaseInfoVM.SOType != SOType.PhysicalCard)//礼品卡订单不允许报关申报作废 { btnReportedFaulure.IsEnabled = true; } }); } else { btnReportedFaulure.IsEnabled = false; } if (btnAbandon.IsEnabled) { new OtherDomainQueryFacade(Page).GetSOIncomeBySOSysNo(SOSysNo, (soIncomeInfo) => { CurrentSOIncomeInfo = soIncomeInfo; SOFacade.ConfirmOperationSubSO(CurrentSOVM, SetAbandon, SetAOAbondon); }); } if (CurrentSOVM != null && CurrentSOVM.BaseInfoVM != null && CurrentSOVM.BaseInfoVM.Status == SOStatus.Reject) { btnHoldSO.IsEnabled = false; } btnSplit.Visibility = System.Windows.Visibility.Collapsed; btnSplitInvoice.Visibility = System.Windows.Visibility.Collapsed; }
private void SetControlByOperation() { tabItemProductRange.Visibility = System.Windows.Visibility.Collapsed; tabItemGiftRule.Visibility = System.Windows.Visibility.Collapsed; if (_saleGiftInfoVM.SysNo.HasValue) { tabItemProductRange.Visibility = System.Windows.Visibility.Visible; tabItemGiftRule.Visibility = System.Windows.Visibility.Visible; } if (_saleGiftInfoVM.Type.Value == SaleGiftType.Full) { ucBasic.tbMinAmount.SetReadOnly(false); } else { ucBasic.tbMinAmount.SetReadOnly(true); } spFunction.Visibility = System.Windows.Visibility.Collapsed; _saleGiftInfoVM.IsOnlyViewMode = true; if (_saleGiftInfoVM.SysNo.HasValue) { this.ucBasic.cmbType.IsEnabled = false; if (_operationType == "edit") { _saleGiftInfoVM.IsOnlyViewMode = false; //this.Title = string.Format("赠品[{0}]-编辑", _saleGiftInfoVM.SysNo); this.Title = string.Format(ResSaleGiftMaitain.Msg_GiftEdit, _saleGiftInfoVM.SysNo); } else if (_operationType == "mgt") { //this.Title = string.Format("赠品[{0}]-管理", _saleGiftInfoVM.SysNo); this.Title = string.Format(ResSaleGiftMaitain.Msg_GiftManage, _saleGiftInfoVM.SysNo); spFunction.Visibility = System.Windows.Visibility.Visible; } else { // this.Title = string.Format("赠品[{0}]-浏览", _saleGiftInfoVM.SysNo); this.Title = string.Format(ResSaleGiftMaitain.Msg_GiftView, _saleGiftInfoVM.SysNo); } } else { _saleGiftInfoVM.IsOnlyViewMode = false; this.ucBasic.cmbType.IsEnabled = true; //this.Title = string.Format("赠品-新增"); this.Title = string.Format(ResSaleGiftMaitain.Msg_AddNew); } if (_saleGiftInfoVM.Type.Value == SaleGiftType.Full) //|| _saleGiftInfoVM.Type.Value == SaleGiftType.FirstOrder || _saleGiftInfoVM.Type.Value == SaleGiftType.Additional) { if (!currentSysNo.HasValue) { _saleGiftInfoVM.IsGlobalProduct = true; } this.ucProductRange.ucLimitProduct.Visibility = System.Windows.Visibility.Collapsed; this.ucProductRange.rowLimitProduct.SetValue(RowDefinition.HeightProperty, new GridLength(0, GridUnitType.Auto));//加上这句防止页面出现大量空白区域 this.ucProductRange.ucLimitScope.Visibility = System.Windows.Visibility.Visible; } else { //对于非“买满即送”,是否整网商品永远是False _saleGiftInfoVM.IsGlobalProduct = false; this.ucProductRange.ucLimitProduct.Visibility = System.Windows.Visibility.Visible; this.ucProductRange.ucLimitScope.Visibility = System.Windows.Visibility.Collapsed; this.ucProductRange.rowLimitScope.SetValue(RowDefinition.HeightProperty, new GridLength(0, GridUnitType.Auto));//加上这句防止页面出现大量空白区域 } if (_operationType.ToLower() == "mgt") { btnSubmitAudit.Visibility = System.Windows.Visibility.Collapsed; btnCancelAudit.Visibility = System.Windows.Visibility.Collapsed; btnAuditApprove.Visibility = System.Windows.Visibility.Collapsed; btnAuditRefuse.Visibility = System.Windows.Visibility.Collapsed; btnStop.Visibility = System.Windows.Visibility.Collapsed; btnVoid.Visibility = System.Windows.Visibility.Collapsed; switch (_saleGiftInfoVM.Status.Value) { case SaleGiftStatus.Init: btnSubmitAudit.Visibility = System.Windows.Visibility.Visible; break; case SaleGiftStatus.WaitingAudit: btnCancelAudit.Visibility = System.Windows.Visibility.Visible; btnAuditApprove.Visibility = System.Windows.Visibility.Visible; btnAuditRefuse.Visibility = System.Windows.Visibility.Visible; break; case SaleGiftStatus.Ready: btnCancelAudit.Visibility = System.Windows.Visibility.Visible; btnVoid.Visibility = System.Windows.Visibility.Visible; break; case SaleGiftStatus.Run: btnStop.Visibility = System.Windows.Visibility.Visible; break; default: break; } } if (_saleGiftInfoVM.IsOnlyViewMode) { this.btnSaveBasic.Visibility = System.Windows.Visibility.Collapsed; OperationControlStatusHelper.SetControlsStatus(this.ucBasic, true); OperationControlStatusHelper.SetControlsStatus(this.ucGiftRule, true); OperationControlStatusHelper.SetControlsStatus(this.ucProductRange, true); } }