コード例 #1
0
        //删除
        private void toolDel_Click(object sender, EventArgs e)
        {
            if (dgvDetails.CurrentCell == null)
            {
                return;
            }

            if (BathClass.printAskMsg("确定删除?") != DialogResult.Yes)
            {
                return;
            }

            string offer = dgvDetails.Rows[dgvDetails.CurrentCell.RowIndex].Cells[0].Value.ToString();

            var m = db.Menu.FirstOrDefault(x => x.name == offer);

            if (m != null)
            {
                m_Offer.Remove(m.id.ToString());
            }
            else
            {
                m_Offer.Remove(offer);
            }

            m_Promotion.menuIds = BathClass.assemble(m_Offer);
            db.SubmitChanges();
            dgvDetails_show();
        }
コード例 #2
0
        //添加
        private void btnAdd_Click(object sender, EventArgs e)
        {
            PromotionItemAddForm f = new PromotionItemAddForm(db, m_Promotion);

            if (f.ShowDialog() == DialogResult.OK)
            {
                m_Offer.Add(f.m_Offer, f.m_discoutType + "#" + f.m_discout.ToString());
                m_Promotion.menuIds = BathClass.assemble(m_Offer);
                dgv_show();
            }
        }
コード例 #3
0
        //添加
        private void toolAdd_Click(object sender, EventArgs e)
        {
            GroupBuyItemAddForm f = new GroupBuyItemAddForm(db, m_Promotion);

            if (f.ShowDialog() == DialogResult.OK)
            {
                m_Offer.Add(f.m_Offer, f.m_discoutType + "#" + f.m_discout.ToString());
                m_Promotion.menuIds = BathClass.assemble(m_Offer);
                db.SubmitChanges();
                dgvDetails_show();
            }
        }
コード例 #4
0
        //删除
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (dgv.CurrentCell == null)
            {
                return;
            }

            string offer = dgv.Rows[dgv.CurrentCell.RowIndex].Cells[0].Value.ToString();

            var m = db.Menu.FirstOrDefault(x => x.name == offer);

            if (m != null)
            {
                m_Offer.Remove(m.id.ToString());
            }
            else
            {
                m_Offer.Remove(offer);
            }

            m_Promotion.menuIds = BathClass.assemble(m_Offer);
            dgv_show();
        }