Esempio n. 1
0
        //宾客付款
        private void payTool_Click(object sender, EventArgs e)
        {
            BathDBDataContext dc = new BathDBDataContext(LogIn.connectionString);

            HintForm hintForm = new HintForm("请插入会员卡...");
            if (hintForm.ShowDialog() != DialogResult.OK)
                return;

            MemberCardUsingForm memberCardUsingForm = new MemberCardUsingForm(Convert.ToDouble(moneyPayable.Text));
            if (memberCardUsingForm.ShowDialog() != DialogResult.OK)
                return;

            if (m_Member == null)
                m_Member = memberCardUsingForm.m_member;

            Account account = new Account();
            account.text = m_Seat.text;
            account.systemId = m_Seat.systemId;
            account.openTime = m_Seat.openTime.ToString();
            account.openEmployee = m_Seat.openEmployee;
            account.payTime = DateTime.Now;
            account.payEmployee = LogIn.m_User.id.ToString();
            account.macAddress = PCUtil.getMacAddr_Local();
            if (m_promotion_Member != null)
            {
                account.promotionMemberId = m_promotion_Member.CI_CardNo;
                account.promotionAmount = discount_money;
            }
            if (m_Member != null)
                account.memberId = memberCardUsingForm.m_member.CI_CardNo;

            account.creditCard = Convert.ToInt32(moneyPayable.Text);
            db.Account.InsertOnSubmit(account);

            db.SubmitChanges();

            var orderList = db.Orders.Where(x => x.systemId == m_Seat.systemId && !x.paid);
            foreach (Orders order in orderList)
            {
                order.paid = true;
                order.accountId = account.id;
            }

            m_Seat.status = 3;
            var room = db.Room.FirstOrDefault(x => x.seat == m_Seat.text);
            if (room != null)
                room.status = "等待清洁";

            insert_member_infor(account);
            db.SubmitChanges();

            var act_old = dc.Account.FirstOrDefault(x => x.systemId == m_Seat.systemId && x.abandon != null);
            if (act_old == null)
            {
                printTool_Click("结账单");
                printTool_Click("存根单");
            }
            else
            {
                printTool_Click("补救单");
            }

            var act = dc.Account.FirstOrDefault(x => x.systemId == m_Seat.systemId && x.abandon == null);
        }
Esempio n. 2
0
        //宾客付款
        private void payTool_Click(object sender, EventArgs e)
        {
            BathDBDataContext dc = new BathDBDataContext(LogIn.connectionString);

            HintForm hintForm = new HintForm("请插入会员卡...");

            if (hintForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            MemberCardUsingForm memberCardUsingForm = new MemberCardUsingForm(Convert.ToDouble(moneyPayable.Text));

            if (memberCardUsingForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (m_Member == null)
            {
                m_Member = memberCardUsingForm.m_member;
            }

            Account account = new Account();

            account.text         = m_Seat.text;
            account.systemId     = m_Seat.systemId;
            account.openTime     = m_Seat.openTime.ToString();
            account.openEmployee = m_Seat.openEmployee;
            account.payTime      = DateTime.Now;
            account.payEmployee  = LogIn.m_User.id.ToString();
            account.macAddress   = PCUtil.getMacAddr_Local();
            if (m_promotion_Member != null)
            {
                account.promotionMemberId = m_promotion_Member.CI_CardNo;
                account.promotionAmount   = discount_money;
            }
            if (m_Member != null)
            {
                account.memberId = memberCardUsingForm.m_member.CI_CardNo;
            }

            account.creditCard = Convert.ToInt32(moneyPayable.Text);
            db.Account.InsertOnSubmit(account);

            db.SubmitChanges();

            var orderList = db.Orders.Where(x => x.systemId == m_Seat.systemId && !x.paid);

            foreach (Orders order in orderList)
            {
                order.paid      = true;
                order.accountId = account.id;
            }

            m_Seat.status = 3;
            var room = db.Room.FirstOrDefault(x => x.seat == m_Seat.text);

            if (room != null)
            {
                room.status = "等待清洁";
            }

            insert_member_infor(account);
            db.SubmitChanges();

            var act_old = dc.Account.FirstOrDefault(x => x.systemId == m_Seat.systemId && x.abandon != null);

            if (act_old == null)
            {
                printTool_Click("结账单");
                printTool_Click("存根单");
            }
            else
            {
                printTool_Click("补救单");
            }

            var act = dc.Account.FirstOrDefault(x => x.systemId == m_Seat.systemId && x.abandon == null);
        }