//对话框载入
        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();
        }
 partial void DeleteGroupBuyPromotion(GroupBuyPromotion instance);
 partial void UpdateGroupBuyPromotion(GroupBuyPromotion instance);
 partial void InsertGroupBuyPromotion(GroupBuyPromotion instance);
 //构造函数
 public GroupBuyItemAddForm(BathDBDataContext dc, GroupBuyPromotion promotion)
 {
     db = dc;
     m_Promotion = promotion;
     InitializeComponent();
 }
Exemple #6
0
        //拆分优惠方案
        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;
        }