public static ISalesPromotion CreatePromotion(PromotionTypeEnum promotionType) { if (PromotionTypeEnum.MJ == promotionType) { return(new MJSalesPromotion()); } if (PromotionTypeEnum.Discount == promotionType) { return(new DiscountSalesPromotion()); } return(null); }
private void skinComboBoxPromotionType_SelectedIndexChanged(object sender, EventArgs e) { try { SkinComboBox box = (SkinComboBox)sender; //if (ruleCtrl != null) { // this.ruleCtrl.Hide(); //} curType = (PromotionTypeEnum)box.SelectedValue; switch (curType) { case PromotionTypeEnum.MJ: this.ruleCtrl = mjRuleCtrl1; this.ruleCtrl.Enabled = true; this.discountRuleCtrl1.Hide(); break; case PromotionTypeEnum.Discount: this.ruleCtrl = discountRuleCtrl1; this.ruleCtrl.Enabled = true; this.mjRuleCtrl1.Hide(); break; case PromotionTypeEnum.YKJ: this.ruleCtrl.Enabled = false; break; default: this.ruleCtrl = mjRuleCtrl1; this.ruleCtrl.Enabled = true; this.discountRuleCtrl1.Hide(); break; } this.ruleCtrl.Show(); } catch (Exception ex) { GlobalUtil.ShowError(ex); } }
public SalesPromotionCostumeSelectForm(JGNet.SalesPromotion curItem, PromotionTypeEnum curType, bool isSalesPromotionUse, bool filterValid) { try { InitializeComponent(); this.filterValid = filterValid; dataGridViewPagingSumCtrl = new DataGridViewPagingSumCtrl(this.dataGridViewQueryResults, dataGridViewPagingSumCtrl_CurrentPageIndexChanged, this.BaseButton_Search_Click); dataGridViewPagingSumCtrl.Initialize(); dataGridViewQueryResults.MultiSelect = true; this.dataGridViewQueryResults.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect; new DataGridViewPagingSumCtrl(this.dataGridViewTarget).Initialize(); dataGridViewTarget.MultiSelect = true; this.dataGridViewTarget.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect; if (curType == PromotionTypeEnum.YKJ) { dataGridViewPagingSumCtrl.AppendNotShowInColumnSettings(dataGridViewTextBoxColumnYear, dataGridViewTextBoxColumnSeason); dataGridViewPagingSumCtrl.RemoveNotShowInColumnSettings(CostPrice, Price); } else { dataGridViewPagingSumCtrl.RemoveNotShowInColumnSettings(dataGridViewTextBoxColumnYear, dataGridViewTextBoxColumnSeason); dataGridViewPagingSumCtrl.AppendNotShowInColumnSettings(CostPrice, Price); } if (curItem != null) { if (curType == PromotionTypeEnum.YKJ) { SetBuyout(curItem); } else { SetNormal(curItem); } this.skinCheckBoxJoin.Checked = curItem.ContainsSpecify; if (!String.IsNullOrEmpty(curItem.ID) && isSalesPromotionUse) { this.skinPanelQuery.Enabled = false; this.groupBoxQueryResult.Enabled = false; this.skinPanelSelectBtn.Enabled = false; this.skinPanelCheck.Enabled = false; } } try { SetYear(); // CommonGlobalUtil.SetSupplier(skinComboBoxSupplierID); SetParameterConfig(); GlobalUtil.SetBrand(skinComboBox_Brand); //skinComboBox_Brand.Initialize(); } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } }