//对话框载入 private void PromotionForm_Load(object sender, EventArgs e) { db = new BathDBDataContext(LogIn.connectionString); m_Promotion = db.GroupBuyPromotion.FirstOrDefault(); if (m_Promotion == null) { m_Promotion = new GroupBuyPromotion(); db.GroupBuyPromotion.InsertOnSubmit(m_Promotion); db.SubmitChanges(); } m_Offer = BathClass.disAssemble(db, m_Promotion); dgvDetails_show(); }
//拆分优惠方案 public static Dictionary <string, string> disAssemble(BathDBDataContext db, GroupBuyPromotion promotion) { Dictionary <string, string> menuIdList = new Dictionary <string, string>(); if (promotion.menuIds == null) { return(menuIdList); } string[] menuIds = promotion.menuIds.Split(';'); foreach (string menuId in menuIds) { if (menuId == "") { continue; } string[] tps = menuId.Split('='); menuIdList.Add(tps[0], tps[1]); } return(menuIdList); }
public string m_discoutType; //折扣形式 //构造函数 public GroupBuyItemAddForm(BathDBDataContext dc, GroupBuyPromotion promotion) { db = dc; m_Promotion = promotion; InitializeComponent(); }