Beispiel #1
0
        //查询服务
        private void btnCheck_Click(object sender, EventArgs e)
        {
            Employee user;

            if (user_card)
            {
                var form = new InputEmployeeByCard(connectionString);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                user = form.employee;
            }
            else
            {
                var form = new InputEmployeeByPwd(connectionString);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                user = form.employee;
            }

            CheckForm checkForm = new CheckForm(user);

            checkForm.ShowDialog();
            techId.Focus();
        }
        //扣卡
        private void toolDeduct_Click(object sender, EventArgs e)
        {
            //if (m_thread != null && m_thread.IsAlive)
            //    m_thread.Abort();

            var dc = new BathDBDataContext(LogIn.connectionString);
            DeductedCardForm form = new DeductedCardForm();

            if (BathClass.getAuthority(dc, LogIn.m_User, "扣卡"))
            {
                form.ShowDialog();
            }
            else
            {
                InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
                if (inputEmployee.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (!BathClass.getAuthority(dc, inputEmployee.employee, "扣卡"))
                {
                    BathClass.printErrorMsg(inputEmployee.employee.id + "不具有扣卡权限!");
                    return;
                }
                form.ShowDialog();
            }
        }
Beispiel #3
0
        //锁定解锁
        private void CtxLock_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            var seat = getContextSenderSeat(db_new, sender);

            if (BathClass.getAuthority(db_new, LogIn.m_User, "锁定解锁"))
            {
                lock_unlock(seat, db_new, LogIn.m_User);
                return;
            }

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

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

            if (!BathClass.getAuthority(db_new, inputEmployee.employee, "锁定解锁"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }
            lock_unlock(seat, db_new, inputEmployee.employee);
        }
Beispiel #4
0
        //更换手牌
        private void CtxChangeSeat_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

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

            if (!BathClass.getAuthority(db_new, inputEmployee.employee, "更换手牌"))
            {
                BathClass.printErrorMsg(inputEmployee.employee.id + "不具有更换手牌操作权限!");
                return;
            }

            if (seat.status != 2)
            {
                BathClass.printErrorMsg("该手牌目前不在使用中,不能换台!");
                return;
            }

            List <int> sLst = new List <int>();

            sLst.Add(1);
            sLst.Add(3);
            InputSeatForm inputSeatForm = new InputSeatForm(sLst);

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

            Seat newSeat = db_new.Seat.FirstOrDefault(x => x == inputSeatForm.m_Seat);
            var  orders  = db_new.Orders.Where(x => x.systemId == seat.systemId);

            foreach (Orders order in orders)
            {
                order.text = newSeat.text;
            }

            newSeat.systemId     = seat.systemId;
            newSeat.name         = seat.name;
            newSeat.population   = seat.population;
            newSeat.openTime     = BathClass.Now(LogIn.connectionString);
            newSeat.openEmployee = LogIn.m_User.name;
            newSeat.phone        = seat.phone;
            newSeat.chainId      = seat.chainId;
            newSeat.status       = seat.status;
            newSeat.note         = seat.note;
            newSeat.ordering     = seat.ordering;

            BathClass.reset_seat(seat);
            db_new.SubmitChanges();
        }
Beispiel #5
0
        //留牌操作 F9
        //private void toolKeep_Click(object sender, EventArgs e)
        //{
        //    List<int> sLst = new List<int>();
        //    sLst.Add(2);
        //    sLst.Add(6);
        //    sLst.Add(7);
        //    InputSeatForm inputseatForm = new InputSeatForm(sLst);
        //    if (inputseatForm.ShowDialog() != DialogResult.OK)
        //        return;


        //    var seat = inputseatForm.m_Seat;
        //    if (m_Seats.FirstOrDefault(x=>x.text==seat.text) == null)
        //    {
        //        m_Seats.Add(seat);
        //        var dc_new = new BathDBDataContext(LogIn.connectionString);
        //        dc_new.HotelRoom.FirstOrDefault(x => x.text == inputseatForm.m_Seat.text).paying = false;
        //        dc_new.SubmitChanges();
        //    }

        //    dgvChain_show();

        //    dgvChain.CurrentCell = null;
        //    //chain = true;

        //    //dgvExpense_show();
        //    //setStatus();
        //}

        //联牌账务
        //private void btnChain_Click(object sender, EventArgs e)
        //{
        //    //chain = true;
        //    dgvChain.CurrentCell = null;
        //    dgvExpense_show();
        //    setStatus();
        //}

        //退单 F10
        private void toolReturn_Click(object sender, EventArgs e)
        {
            BathDBDataContext dc = new BathDBDataContext(LogIn.connectionString);

            if (dgvExpense.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要输入订单!");
                return;
            }

            int orderId = Convert.ToInt32(dgvExpense.CurrentRow.Cells[0].Value);
            var order   = dc.Orders.FirstOrDefault(x => x.id == orderId);

            if (order == null || order.menu.Contains("套餐"))
            {
                BathClass.printErrorMsg("不能删除套餐优惠!");
                return;
            }

            InputEmployeeByPwd inputServerForm = new InputEmployeeByPwd();

            Employee del_employee;

            if (BathClass.getAuthority(dc, LogIn.m_User, "退单"))
            {
                del_employee = LogIn.m_User;
            }
            else if (inputServerForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            else if (!BathClass.getAuthority(dc, inputServerForm.employee, "退单"))
            {
                BathClass.printErrorMsg("没有退单权限");
                return;
            }
            else
            {
                del_employee = inputServerForm.employee;
            }

            order.deleteEmployee = del_employee.id.ToString();

            Employee employee = dc.Employee.FirstOrDefault(x => x.id.ToString() == order.technician);

            if (employee != null)
            {
                employee.status = "空闲";
            }

            dc.SubmitChanges();

            find_combo(dc, order);
            dgvExpense_show(dc);
            setStatus(dc);
        }
Beispiel #6
0
        //重新结账
        private void CtxRepay_Click(object sender, EventArgs e)
        {
            //TableCashierCheckForm tableCashierSummaryForm = new TableCashierCheckForm();
            //tableCashierSummaryForm.ShowDialog();

            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

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

            if (!BathClass.getAuthority(db_new, inputEmployee.employee, "重新结账"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }

            if (seat.status != 3)
            {
                BathClass.printErrorMsg("手牌未结账,不能重新结账");
                return;
            }

            var act   = db_new.Account.FirstOrDefault(x => x.systemId.Contains(seat.systemId) && x.abandon == null);
            var ids   = act.systemId.Split('|');
            var seats = db_new.Seat.Where(x => ids.Contains(x.systemId));

            foreach (var s in seats)
            {
                if (s.status == 2 || s.status == 6 || s.status == 7)
                {
                    BathClass.printErrorMsg("已经重新开牌,请先更换手牌");
                    return;
                }
                s.status = 8;
                var orders = db_new.Orders.Where(x => x.systemId == s.systemId);
                foreach (var order in orders)
                {
                    order.paid = false;
                }
            }
            act.abandon = inputEmployee.employee.id;
            var cc = db_new.CardCharge.FirstOrDefault(x => act.systemId == x.CC_AccountNo);

            if (cc != null)
            {
                db_new.CardCharge.DeleteOnSubmit(cc);
            }
            db_new.SubmitChanges();
        }
Beispiel #7
0
        //退单 F10
        private void toolReturn_Click(object sender, EventArgs e)
        {
            BathDBDataContext dc = new BathDBDataContext(LogIn.connectionString);

            if (dgvExpense.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要输入订单!");
                return;
            }

            int orderId = Convert.ToInt32(dgvExpense.CurrentRow.Cells[0].Value);
            var order   = dc.Orders.FirstOrDefault(x => x.id == orderId);

            if (order == null || order.menu.Contains("套餐"))
            {
                BathClass.printErrorMsg("不能删除套餐优惠!");
                return;
            }

            InputEmployeeByPwd inputServerForm = new InputEmployeeByPwd();

            if (inputServerForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            order.deleteEmployee = inputServerForm.employee.id.ToString();

            Employee employee = dc.Employee.FirstOrDefault(x => x.id.ToString() == order.technician);

            if (employee != null)
            {
                employee.status = "空闲";
            }

            var menu = dc.Menu.FirstOrDefault(x => x.name == order.menu);

            if (dc.Catgory.FirstOrDefault(x => x.id == menu.catgoryId).name == "会员卡")
            {
                var cardno = dc.CardCharge.FirstOrDefault(x => x.systemId == order.systemId).CC_CardNo;
                dc.CardCharge.DeleteAllOnSubmit(dc.CardCharge.Where(x => x.systemId == order.systemId));

                if (!order.menu.Contains("充值") && BathClass.printAskMsg("是否删除售卡记录?") == DialogResult.Yes)
                {
                    dc.CardInfo.DeleteOnSubmit(dc.CardInfo.FirstOrDefault(x => x.CI_CardNo == cardno));
                }
            }
            dc.SubmitChanges();

            Seat seat = dc.Seat.FirstOrDefault(x => x.systemId == order.systemId);

            //BathClass.find_combo(dc, seat, null);
            dgvExpense_show();
            setStatus();
        }
Beispiel #8
0
        //退单
        private void btnReturn_Click(object sender, EventArgs e)
        {
            if (dgvExpense.CurrentCell == null)
            {
                GeneralClass.printErrorMsg("需要输入订单!");
                return;
            }

            int orderId = Convert.ToInt32(dgvExpense.CurrentRow.Cells[0].Value);
            var order   = db.Orders.FirstOrDefault(x => x.id == orderId);

            if (order == null || order.menu.Contains("套餐"))
            {
                GeneralClass.printErrorMsg("输入订单编号错误!");
                return;
            }

            if (m_Orders.Contains(order))
            {
                if (GeneralClass.printAskMsg("没入数据库,直接删除?") == DialogResult.Yes)
                {
                    db.Orders.DeleteOnSubmit(order);
                    db.SubmitChanges();
                    dgvExpense_show();
                }
                return;
            }

            InputEmployeeByPwd inputServerForm = new InputEmployeeByPwd();

            if (inputServerForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            order.deleteEmployee = inputServerForm.employee.id.ToString();

            Employee employee = db.Employee.FirstOrDefault(x => x.id.ToString() == order.technician);

            if (employee != null)
            {
                employee.status = "空闲";
            }

            db.SubmitChanges();

            find_combo();
            dgvExpense_show();

            m_Orders.Remove(order);
        }
Beispiel #9
0
        //锁定解锁
        private void CtxLock_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

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

            if (!BathClass.getAuthority(db_new, inputEmployee.employee, "锁定解锁"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }


            if (seat.status == 1 || seat.status == 2)
            {
                seat.status = 4;
            }
            else if (seat.status == 4)
            {
                Operation op = new Operation();
                op.employee     = inputEmployee.employee.name;
                op.seat         = seat.text;
                op.openEmployee = seat.openEmployee;
                op.openTime     = seat.openTime;
                op.explain      = "解锁手牌";
                op.opTime       = BathClass.Now(LogIn.connectionString);
                db_new.Operation.InsertOnSubmit(op);

                if (seat.systemId == null)
                {
                    seat.status = 1;
                }
                else
                {
                    seat.status = 2;
                }
            }

            db_new.SubmitChanges();
        }
Beispiel #10
0
        //扣卡
        private void btnDeduct_Click(object sender, EventArgs e)
        {
            if (BathClass.getAuthority(db, LogIn.m_User, "扣卡"))
            {
                id.ReadOnly = false;
            }
            else
            {
                InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
                if (inputEmployee.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (!BathClass.getAuthority(db, inputEmployee.employee, "扣卡"))
                {
                    BathClass.printErrorMsg(inputEmployee.employee.id + "不具有扣卡权限!");
                    return;
                }
                id.ReadOnly = false;
            }
        }
Beispiel #11
0
        //停用启用
        private void CtxSop_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

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

            if (!BathClass.getAuthority(db_new, inputEmployee.employee, "停用启用"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }

            if (seat.status == 2 || seat.status == 6 || seat.status == 7 || seat.status == 8)
            {
                BathClass.printErrorMsg("手牌正在使用不能停用");
                return;
            }
            else if (seat.status == 4)
            {
                BathClass.printErrorMsg("手牌已经锁定,不能停用");
                return;
            }
            else if (seat.status == 1 || seat.status == 3)
            {
                seat.status = 5;
            }
            else if (seat.status == 5)
            {
                seat.status = 1;
            }

            db_new.SubmitChanges();
        }
        private void unWarnTool_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);

            if (seat.status != 6)
            {
                return;
            }

            Employee op_user;

            if (BathClass.getAuthority(db_new, LogIn.m_User, "解除警告"))
            {
                op_user = LogIn.m_User;
            }
            else
            {
                InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
                if (inputEmployee.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                if (BathClass.getAuthority(db_new, inputEmployee.employee, "解除警告"))
                {
                    op_user = inputEmployee.employee;
                }
                else
                {
                    BathClass.printErrorMsg("不具有权限!");
                    return;
                }
            }

            seat.status = 2;
            seat.unwarn = op_user.id;
            db_new.SubmitChanges();
        }
Beispiel #13
0
        //扣卡
        private void btnDeduct_Click(object sender, EventArgs e)
        {
            if (dao.get_authority(LogIn.m_User, "扣卡"))
            {
                id.Enabled = true;
                id.Focus();
            }
            else
            {
                InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
                if (inputEmployee.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (!dao.get_authority(inputEmployee.employee, "扣卡"))
                {
                    BathClass.printErrorMsg(inputEmployee.employee.id + "不具有扣卡权限!");
                    return;
                }
                id.Enabled = true;
                id.Focus();
            }
        }
Beispiel #14
0
        //手工打折
        private void discountTool_Click(object sender, EventArgs e)
        {
            var      dc   = new BathDBDataContext(LogIn.connectionString);
            Employee oper = null;

            if (BathClass.getAuthority(dc, LogIn.m_User, "手工打折"))
            {
                oper = LogIn.m_User;
            }

            if (oper == null)
            {
                InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
                if (inputEmployee.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (BathClass.getAuthority(dc, inputEmployee.employee, "手工打折"))
                {
                    oper = inputEmployee.employee;
                }
                else
                {
                    BathClass.printErrorMsg("没有手工打折权限");
                    return;
                }
            }
            if (oper == null)
            {
                return;
            }


            InputNumber inputNumberForm = new InputNumber("输入折扣率(<10)");

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

            double number       = inputNumberForm.number;
            double discountRate = 0;

            if (number < 1)
            {
                discountRate = number;
            }
            else
            {
                discountRate = number / 10.0;
            }
            var os = dc.Orders.Where(x => m_Seats.Select(y => y.systemId).Contains(x.systemId) && x.deleteEmployee == null);

            foreach (Orders o in os)
            {
                o.money = Math.Round(o.money * discountRate);
            }

            foreach (HotelRoom seat in m_Seats)
            {
                seat.discount         = inputNumberForm.number;
                seat.discountEmployee = oper.id;
            }

            Operation op = new Operation();

            op.employee     = oper.name;
            op.seat         = string.Join("|", m_Seats.Select(y => y.text).ToArray());
            op.openEmployee = string.Join("|", m_Seats.Select(y => y.openEmployee).ToArray());
            //op.openTime = seat.openTime;
            op.explain = "手工打折";
            op.note1   = number.ToString();
            op.note2   = string.Join("|", m_Seats.Select(y => y.systemId).ToArray());
            op.opTime  = BathClass.Now(LogIn.connectionString);
            dc.Operation.InsertOnSubmit(op);

            dc.SubmitChanges();
            dgvExpense_show(dc);
            setStatus(dc);
        }
Beispiel #15
0
        //重新结账
        private void CtxRepay_Click(object sender, EventArgs e)
        {
            //TableCashierCheckForm tableCashierSummaryForm = new TableCashierCheckForm();
            //tableCashierSummaryForm.ShowDialog();

            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            var seat = getContextSenderSeat(db_new, sender);

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

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

            if (!BathClass.getAuthority(db_new, inputEmployee.employee, "重新结账"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }

            if (seat.status != 3)
            {
                BathClass.printErrorMsg("手牌未结账,不能重新结账");
                return;
            }

            RepayActListForm form = new RepayActListForm(seat, inputEmployee.employee);

            form.ShowDialog();

            /*var act = db_new.Account.FirstOrDefault(x => x.systemId.Contains(seat.systemId) && x.abandon == null);
             * if (act == null)
             * {
             *  if (BathClass.printAskMsg("手牌未结账,是否直接恢复手牌?") != DialogResult.Yes)
             *      return;
             *
             *  seat.status = 2;
             *  db_new.SubmitChanges();
             *  return;
             * }
             * var ids = act.systemId.Split('|');
             * var seats = db_new.Seat.Where(x => ids.Contains(x.systemId));
             * foreach (var s in seats)
             * {
             *  if (s.status == 2 || s.status == 6 || s.status == 7)
             *  {
             *      BathClass.printErrorMsg("已经重新开牌,请先更换手牌");
             *      return;
             *  }
             *  s.status = 2;
             *  var orders = db_new.HisOrders.Where(x => x.systemId == s.systemId);
             *  foreach (var order in orders)
             *  {
             *      var ho = new Orders();
             *      ho.menu = order.menu;
             *      ho.text = order.text;
             *      ho.systemId = order.systemId;
             *      ho.number = order.number;
             *      ho.priceType = order.priceType;
             *      ho.money = order.money;
             *      ho.technician = order.technician;
             *      ho.techType = order.techType;
             *      ho.inputTime = order.inputTime;
             *      ho.inputEmployee = order.inputEmployee;
             *      ho.deleteEmployee = order.deleteEmployee;
             *      ho.donorEmployee = order.donorEmployee;
             *      ho.comboId = order.comboId;
             *      ho.paid = false;
             *      ho.accountId = order.accountId;
             *      ho.billId = order.billId;
             *      db_new.HisOrders.DeleteOnSubmit(order);
             *      db_new.Orders.InsertOnSubmit(ho);
             *  }
             * }
             * act.abandon = inputEmployee.employee.id;
             * var cc = db_new.CardCharge.Where(x => act.id.ToString() == x.CC_AccountNo);
             * if (cc.Any())
             *  db_new.CardCharge.DeleteAllOnSubmit(cc);
             * db_new.SubmitChanges();*/
        }
Beispiel #16
0
        //取消开牌
        private void CtxCancelOpen_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

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

            if (!BathClass.getAuthority(db_new, inputEmployee.employee, "取消开牌"))
            {
                BathClass.printErrorMsg(inputEmployee.employee.id + "不具有取消开台权限!");
                return;
            }

            if (seat.status != 2)
            {
                BathClass.printErrorMsg("该台位不在使用中,不能取消开台!");
                return;
            }

            if (db_new.Options.Count() != 0)
            {
                Options options = db_new.Options.FirstOrDefault();
                var     q       = options.取消开牌时限;
                if (q != null && BathClass.Now(LogIn.connectionString) - seat.openTime >= TimeSpan.Parse("00:" + q.ToString() + ":00"))
                {
                    BathClass.printErrorMsg("已超过取消开牌时限!");
                    return;
                }
            }
            var orders = db_new.Orders.Where(x => x.systemId == seat.systemId);

            if (orders.Count() > 2)
            {
                BathClass.printErrorMsg("已经点单,不能取消开台");
                return;
            }

            if (BathClass.printAskMsg("确认取消开台?") != DialogResult.Yes)
            {
                return;
            }

            Operation op = new Operation();

            op.employee     = inputEmployee.employee.id;
            op.seat         = seat.text;
            op.openEmployee = seat.openEmployee;
            op.openTime     = seat.openTime;
            op.explain      = "取消开牌";
            op.opTime       = BathClass.Now(LogIn.connectionString);
            db_new.Operation.InsertOnSubmit(op);

            db_new.Orders.DeleteAllOnSubmit(db_new.Orders.Where(x => x.systemId == seat.systemId));
            BathClass.reset_seat(seat);
            db_new.SubmitChanges();
        }
Beispiel #17
0
        //退单
        private void btnReturn_Click(object sender, EventArgs e)
        {
            if (dgvExpense.CurrentCell == null)
            {
                GeneralClass.printErrorMsg("需要输入订单!");
                return;
            }

            int orderId = Convert.ToInt32(dgvExpense.CurrentRow.Cells[0].Value);
            var order = db.Orders.FirstOrDefault(x => x.id == orderId);
            if (order == null || order.menu.Contains("套餐"))
            {
                GeneralClass.printErrorMsg("输入订单编号错误!");
                return;
            }

            if (m_Orders.Contains(order))
            {
                if (GeneralClass.printAskMsg("没入数据库,直接删除?") == DialogResult.Yes)
                {
                    db.Orders.DeleteOnSubmit(order);
                    db.SubmitChanges();
                    dgvExpense_show();
                }
                return;
            }

            InputEmployeeByPwd inputServerForm = new InputEmployeeByPwd();
            if (inputServerForm.ShowDialog() != DialogResult.OK)
                return;
            order.deleteEmployee = inputServerForm.employee.id.ToString();

            Employee employee = db.Employee.FirstOrDefault(x => x.id.ToString() == order.technician);
            if (employee != null)
                employee.status = "空闲";

            db.SubmitChanges();

            find_combo();
            dgvExpense_show();

            m_Orders.Remove(order);
        }
Beispiel #18
0
        private void cancel_open(BathDBDataContext db_new, HotelRoom seat)
        {
            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

            if (BathClass.getAuthority(db_new, LogIn.m_User, "取消开牌") ||
                (inputEmployee.ShowDialog() != DialogResult.OK &&
                 BathClass.getAuthority(db_new, inputEmployee.employee, "取消开牌")))
            {
                if (seat.status != 2)
                {
                    BathClass.printErrorMsg("该台位不在使用中,不能取消开台!");
                    return;
                }

                if (db_new.Options.Count() != 0)
                {
                    Options options = db_new.Options.ToList()[0];
                    var     q       = options.取消开牌时限;
                    if (q != null && BathClass.Now(LogIn.connectionString) - seat.openTime >= TimeSpan.Parse("00:" + q.ToString() + ":00"))
                    {
                        BathClass.printErrorMsg("已超过取消开牌时限!");
                        return;
                    }
                }
                var orders = db_new.Orders.Where(x => x.systemId == seat.systemId);
                if (orders.Count() > 2)
                {
                    BathClass.printErrorMsg("已经点单,不能取消开台");
                    return;
                }

                if (BathClass.printAskMsg("确认取消开台?") != DialogResult.Yes)
                {
                    return;
                }

                Operation op = new Operation();

                if (inputEmployee.employee != null)
                {
                    op.employee = inputEmployee.employee.id;
                }
                else
                {
                    op.employee = LogIn.m_User.id;
                }
                op.seat         = seat.text;
                op.openEmployee = seat.openEmployee;
                op.openTime     = seat.openTime;
                op.explain      = "取消开牌";
                op.opTime       = BathClass.Now(LogIn.connectionString);
                db_new.Operation.InsertOnSubmit(op);

                db_new.Orders.DeleteAllOnSubmit(db_new.Orders.Where(x => x.systemId == seat.systemId));
                BathClass.reset_seat(seat);
                db_new.SubmitChanges();
                dgv_shoe_show();
            }
            else
            {
                BathClass.printErrorMsg("不具有取消开牌权限!");
            }
        }