//停止消费
        private void btnOnClock_Click(object sender, EventArgs e)
        {
            InputSeatForm seatForm = new InputSeatForm(2);
            if (seatForm.ShowDialog() != DialogResult.OK)
                return;

            if (m_Seats.FirstOrDefault(x => x.text == seatForm.m_Seat.text) != null)
            {
                BathClass.printErrorMsg("转账手牌中已经包含该手牌,请重新输入");
                return;
            }

            string systemId = seatForm.m_Seat.systemId;
            foreach (Seat s in m_Seats)
            {
                var orderList = db.Orders.Where(x => x.systemId == s.systemId && x.deleteEmployee == null && !x.paid);
                foreach (Orders order in orderList)
                {
                    order.systemId = systemId;
                    if (order.priceType == "每小时")
                    {
                        order.priceType = "停止消费";
                        order.money = order.money * Math.Ceiling((GeneralClass.Now - order.inputTime).TotalHours);
                    }
                }
                s.status = 3;
            }
            db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
        }
Example #2
0
        //减少
        private void btnDec_Click(object sender, EventArgs e)
        {
            if (m_room.seatIds == null)
            {
                BathClass.printErrorMsg("已经为0!");
                return;
            }
            var ids = m_room.seatIds.Split('|').ToList();

            if (ids.Count == 0)
            {
                BathClass.printErrorMsg("已经为0!");
                return;
            }
            if (ids.Count == 1)
            {
                m_room.seatIds = null;
                dc.SubmitChanges();
                this.Close();
                return;
            }

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

            s.Add(2);
            s.Add(6);
            s.Add(7);
            InputSeatForm form = new InputSeatForm(s);

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

            var t = form.m_Seat.text;

            if (!ids.Contains(t))
            {
                BathClass.printErrorMsg("手牌:" + t + "不在该房间");
                return;
            }
            ids.Remove(t);
            if (ids.Count == 0)
            {
                m_room.seatIds = null;
            }
            else
            {
                m_room.seatIds = string.Join("|", ids.ToArray());
            }
            curPop.Text = m_room.seatIds;
        }
Example #3
0
        //押金离场
        private void btnDeposit_Click(object sender, EventArgs e)
        {
            List<int> s = new List<int>();
            s.Add(2);
            s.Add(7);
            InputSeatForm inputSeatForm = new InputSeatForm(s);
            if (inputSeatForm.ShowDialog() != DialogResult.OK)
                return;

            var seat = inputSeatForm.m_Seat;
            if (seat.status == SeatStatus.USING || seat.status == SeatStatus.DEPOSITLEFT)
            {
                DepositForm depositForm = new DepositForm(inputSeatForm.m_Seat);
                depositForm.ShowDialog();
            }
        }
Example #4
0
        //减少
        private void btnDec_Click(object sender, EventArgs e)
        {
            if (m_room.seatIds == null)
            {
                BathClass.printErrorMsg("已经为0!");
                return;
            }
            var ids = m_room.seatIds.Split('|').ToList();
            if (ids.Count == 0)
            {
                BathClass.printErrorMsg("已经为0!");
                return;
            }
            if (ids.Count == 1)
            {
                m_room.seatIds = null;
                dc.SubmitChanges();
                this.Close();
                return;
            }

            List<int> s = new List<int>();
            s.Add(2);
            s.Add(6);
            s.Add(7);
            InputSeatForm form = new InputSeatForm(s);
            if (form.ShowDialog() != DialogResult.OK)
                return;

            var t = form.m_Seat.text;
            if (!ids.Contains(t))
            {
                BathClass.printErrorMsg("手牌:" + t + "不在该房间");
                return;
            }
            ids.Remove(t);
            if (ids.Count == 0)
                m_room.seatIds = null;
            else
                m_room.seatIds = string.Join("|", ids.ToArray());
            curPop.Text = m_room.seatIds;
        }
Example #5
0
        //增加
        private void btnInc_Click(object sender, EventArgs e)
        {
            if (m_room.seatIds != null && m_room.seatIds.Split('|').Length == m_room.population)
            {
                BathClass.printErrorMsg("已经为达到入住上限!");
                return;
            }

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

            s.Add(2);
            s.Add(7);
            InputSeatForm form = new InputSeatForm(s);

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

            var t    = form.m_Seat.text;
            var room = dc.Room.FirstOrDefault(x => x.seatIds != null && x.seatIds.Contains(t));

            if (room != null)
            {
                BathClass.printErrorMsg("该手牌已经入住房间:" + room.name);
                return;
            }

            if (m_room.seatIds == null)
            {
                m_room.seatIds = t;
            }
            else
            {
                var ids = m_room.seatIds.Split('|').ToList();
                ids.Add(t);
                m_room.seatIds = string.Join("|", ids.ToArray());
            }
            curPop.Text = m_room.seatIds;
            //curPop.Text = (Convert.ToInt32(curPop.Text) + 1).ToString();
        }
Example #6
0
        //消费录入
        private void orderTool_Click(object sender, EventArgs e)
        {
            //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            if (!dao.get_authority(LogIn.m_User, "完整点单") &&
                !dao.get_authority(LogIn.m_User, "可见本人点单"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }
            List<int> sLst = new List<int>();
            sLst.Add(2);
            sLst.Add(6);

            InputSeatForm inputSeatForm = new InputSeatForm(sLst);
            if (inputSeatForm.ShowDialog() != DialogResult.OK)
                return;

            var seat = dao.get_seat("text", inputSeatForm.m_Seat.text);
            //var seat = db_new.Seat.FirstOrDefault(x => x.text == inputSeatForm.m_Seat.text);
            //seat.ordering = true;
            //db_new.SubmitChanges();

            OrderForm orderForm = new OrderForm(seat, LogIn.m_User, LogIn.connectionString, false);
            orderForm.ShowDialog();

            //seat.ordering = false;
            //db_new.SubmitChanges();
        }
Example #7
0
        //更换手牌
        private void CtxChangeSeat_Click(object sender, EventArgs e)
        {
            //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            var seat = getContextSenderSeat(sender);

            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
            if (inputEmployee.ShowDialog() != DialogResult.OK)
                return;

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

            if (seat.status != SeatStatus.USING)
            {
                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;

            StringBuilder sb = new StringBuilder();
            sb.Append(@"update [Orders] set text='" + inputSeatForm.m_Seat.text + "' where systemId='" + seat.systemId + "' ");
            //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;

            sb.Append(@"update [Seat] set systemId='" + seat.systemId + "',name='" + seat.name + "',population=" + seat.population);
            sb.Append(",openTime=getdate(),openEmployee='" + LogIn.m_User.id + "',chainId='" + seat.chainId + "',status=" + seat.status);
            sb.Append(",note='" + seat.note + "',ordering='False'");
            //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;

            sb.Append(dao.reset_seat_string() + "text='" + seat.text + "')");
            if (!dao.execute_command(sb.ToString()))
            {
                BathClass.printErrorMsg("更换手牌失败,请重试!");
                return;
            }

            //BathClass.reset_seat(seat);
            //db_new.SubmitChanges();
        }
        //宾客转账
        private void transferTool_Click(object sender, EventArgs e)
        {
            InputSeatForm seatForm = new InputSeatForm(2);
            if (seatForm.ShowDialog() != DialogResult.OK)
                return;

            if (m_Seats.FirstOrDefault(x => x.text == seatForm.m_Seat.text) != null)
            {
                BathClass.printErrorMsg("转账手牌中已经包含该手牌,请重新输入");
                return;
            }

            var dc = new BathDBDataContext(LogIn.connectionString);
            string systemId = seatForm.m_Seat.systemId;
            foreach (HotelRoom s in m_Seats)
            {

                var orderList = dc.Orders.Where(x => x.systemId == s.systemId && x.deleteEmployee == null && !x.paid);
                foreach (Orders order in orderList)
                {
                    order.systemId = systemId;
                    if (order.priceType == "每小时")
                    {
                        order.priceType = "停止消费";
                        order.money = order.money * Math.Ceiling((GeneralClass.Now - order.inputTime).TotalHours);
                    }
                    order.stopTiming = true;
                }
                dc.HotelRoom.FirstOrDefault(x=>x.text==s.text).status = 3;
            }
            dc.SubmitChanges();

            List<string> printCols = new List<string>();
            printCols.Add("手牌");
            printCols.Add("项目名称");
            printCols.Add("技师");
            printCols.Add("单价");
            printCols.Add("数量");
            printCols.Add("金额");
            PrintSeatBill.Print_DataGridView(m_Seats, "转账确认单", dgvExpense, printCols, moneyPayable.Text, companyName);
            this.DialogResult = DialogResult.OK;
        }
Example #9
0
        //消费查看
        private void BtnExpense_Click(object sender, EventArgs e)
        {
            List<int> sList = new List<int>();
            sList.Add(2);
            sList.Add(6);
            sList.Add(7);

            InputSeatForm inputSeatForm = new InputSeatForm(sList);
            if (inputSeatForm.ShowDialog() == DialogResult.OK)
            {
                //修改
                //OrderCheckForm seatExpenseForm = new OrderCheckForm(inputSeatForm.m_Seat, connectionString);
                //seatExpenseForm.ShowDialog();
            }
        }
Example #10
0
        //消费录入
        private void orderTool_Click(object sender, EventArgs e)
        {
            if (!dao.get_authority(LogIn.m_User, "完整点单") &&
                !dao.get_authority(LogIn.m_User, "可见本人点单"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }
            List<int> sLst = new List<int>();
            sLst.Add(2);
            sLst.Add(6);

            InputSeatForm inputSeatForm = new InputSeatForm(sLst);
            if (inputSeatForm.ShowDialog() != DialogResult.OK)
                return;

            OrderForm orderForm = new OrderForm(inputSeatForm.m_Seat, LogIn.m_User, LogIn.connectionString, false);
            orderForm.ShowDialog();
        }
Example #11
0
        //增加
        private void btnInc_Click(object sender, EventArgs e)
        {
            if (m_room.seatIds!=null && m_room.seatIds.Split('|').Length == m_room.population)
            {
                BathClass.printErrorMsg("已经为达到入住上限!");
                return;
            }

            List<int> s = new List<int>();
            s.Add(2);
            s.Add(7);
            InputSeatForm form = new InputSeatForm(s);
            if (form.ShowDialog() != DialogResult.OK)
                return;

            var t = form.m_Seat.text;
            var room = dc.Room.FirstOrDefault(x => x.seatIds != null && x.seatIds.Contains(t));
            if (room != null)
            {
                BathClass.printErrorMsg("该手牌已经入住房间:" + room.name);
                return;
            }

            if (m_room.seatIds == null)
                m_room.seatIds = t;
            else
            {
                var ids = m_room.seatIds.Split('|').ToList();
                ids.Add(t);
                m_room.seatIds = string.Join("|", ids.ToArray());
            }
            curPop.Text = m_room.seatIds;
            //curPop.Text = (Convert.ToInt32(curPop.Text) + 1).ToString();
        }
Example #12
0
        //更换手牌
        private void CtxChangeSeat_Click(object sender, EventArgs e)
        {
            var seat = getContextSenderSeat(sender);

            Employee oper = null;
            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

            if (dao.get_authority(LogIn.m_User, "更换手牌"))
            {
                oper = LogIn.m_User;
            }
            else if (inputEmployee.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            else
            {
                if (dao.get_authority(inputEmployee.employee, "更换手牌"))
                {
                    oper = inputEmployee.employee;
                }
                else
                {
                    BathClass.printErrorMsg(inputEmployee.employee.id + "不具有更换手牌操作权限!");
                    return;
                }
            }

            if (seat.status != SeatStatus.USING)
            {
                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;

            StringBuilder sb = new StringBuilder();
            sb.Append(@"update [Orders] set text='" + inputSeatForm.m_Seat.text + "' where systemId='" + seat.systemId + "' ");
            sb.Append(@"update [Seat] set systemId='" + seat.systemId + "'");
            sb.Append(",openTime=getdate(),openEmployee='" + oper.id + "',chainId='" + seat.chainId);
            sb.Append("',status=" + (int)seat.status + ",ordering='False'");
            if (seat.name != null && seat.name != "")
                sb.Append(",name='" + seat.name + "'");

            if (seat.population != null)
                sb.Append(",population=" + seat.population);

            if (seat.note != null && seat.name != "")
                sb.Append(",note='" + seat.note + "'");

            sb.Append(" where id=" + inputSeatForm.m_Seat.id);
            sb.Append(dao.reset_seat_string() + "text='" + seat.text + "')");
            if (!dao.execute_command(sb.ToString()))
            {
                BathClass.printErrorMsg("更换手牌失败,请重试!");
                return;
            }
        }
Example #13
0
        private void change_seat(CSeat seat)
        {
            if (!dao.get_authority(LogIn.m_User, "更换手牌"))
            {
                BathClass.printErrorMsg(LogIn.m_User.name + "不具有更换手牌操作权限!");
                return;
            }

            if (seat.status != SeatStatus.USING)
            {
                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);
            StringBuilder sb = new StringBuilder();
            sb.Append(@"update [Orders] set text='" + inputSeatForm.m_Seat.text + "' where systemId='" + seat.systemId + "' ");
            //var orders = db_new.Orders.Where(x => x.systemId == seat.systemId);
            //foreach (Orders order in orders)
            //    order.text = newSeat.text;

            sb.Append(@"update [Seat] set systemId='" + seat.systemId + "'");
            sb.Append(",openTime=getdate(),openEmployee='" + LogIn.m_User.id + "',chainId='" + seat.chainId
                + "',status=" + (int)seat.status + ",ordering='False'");
            if (seat.name != null && seat.name != "")
                sb.Append(",name='" + seat.name + "'");

            if (seat.population != null)
                sb.Append(",population=" + seat.population);

            if (seat.note != null && seat.name != "")
                sb.Append(",note='" + seat.note + "'");

            sb.Append(" where id=" + inputSeatForm.m_Seat.id);
            //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.money = seat.money;
            //newSeat.phone = seat.phone;
            //newSeat.chainId = seat.chainId;
            //newSeat.status = seat.status;
            //newSeat.note = seat.note;
            //newSeat.ordering = seat.ordering;

            sb.Append(dao.reset_seat_string() + "text='" + seat.text + "')");
            if (!dao.execute_command(sb.ToString()))
            {
                BathClass.printErrorMsg("更换手牌失败,请重试!");
                return;
            }
            //BathClass.reset_seat(seat);
            //db_new.SubmitChanges();
            dgv_shoe_show();
        }
Example #14
0
 //更换手牌
 private void changeSeatTool_Click(object sender, EventArgs e)
 {
     //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
     InputSeatForm inputSeatForm = new InputSeatForm(2);
     if (inputSeatForm.ShowDialog() != DialogResult.OK)
         return;
     //var seat = db_new.Seat.FirstOrDefault(x => x.Equals(inputSeatForm.m_Seat));
     change_seat(inputSeatForm.m_Seat);
 }
Example #15
0
        //查看手牌所在包厢
        private void toolCab_Click(object sender, EventArgs e)
        {
            InputSeatForm seatForm = new InputSeatForm(2);
            if (seatForm.ShowDialog() != DialogResult.OK)
                return;

            string seatId = seatForm.m_Seat.text;
            string room_name = dao.get_seat_room(seatId);
            if (room_name == "")
            {
                BathClass.printInformation("未找到手牌所在包厢");
            }
            else
            {
                BathClass.printInformation("手牌所在包为:" + room_name);
            }
        }
Example #16
0
        //更换手牌
        private void CtxChangeSeat_Click(object sender, EventArgs e)
        {
            var seat = getContextSenderSeat(sender);

            Employee oper = null;
            InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();

            if (dao.get_authority(LogIn.m_User, "更换手牌"))
            {
                oper = LogIn.m_User;
            }
            else if (inputEmployee.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            else
            {
                if (dao.get_authority(inputEmployee.employee, "更换手牌"))
                {
                    oper = inputEmployee.employee;
                }
                else
                {
                    BathClass.printErrorMsg(inputEmployee.employee.id + "不具有更换手牌操作权限!");
                    return;
                }
            }

            if (seat.status != SeatStatus.USING)
            {
                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;
        }
Example #17
0
        //宾客转账
        private void transferTool_Click(object sender, EventArgs e)
        {
            InputSeatForm seatForm = new InputSeatForm(2);
            if (seatForm.ShowDialog() != DialogResult.OK)
                return;

            if (m_Seats.FirstOrDefault(x => x.text == seatForm.m_Seat.text) != null)
            {
                BathClass.printErrorMsg("转账手牌中已经包含该手牌,请重新输入");
                return;
            }

            //var dc = new BathDBDataContext(LogIn.connectionString);
            string systemId = seatForm.m_Seat.systemId;

            string cmd_str = @"update [Orders] set systemId='" + systemId + "' where deleteEmployee is null and paid='False' and (";

            string id_str = "";
            int count = m_Seats.Count;
            for (int i = 0; i < count; i++ )
            {
                id_str += @"systemId='" + m_Seats[i].systemId + "'";
                if (i != count - 1)
                    id_str += " or ";
                else
                    id_str += ")";
                m_rooms.Add(dao.get_seat_room(m_Seats[i].text));
            }
            cmd_str += id_str;
            cmd_str += @"update [Orders] set priceType='停止消费', "
                     + @"money=money*ceiling(datediff(minute,inputTime, getdate())/60.0)"
                     + @" where deleteEmployee is null and paid='False' and priceType='每小时' and (";
            cmd_str += id_str;
            cmd_str += @"update [Seat] set status='3' where (";
            cmd_str += id_str;

            cmd_str += " insert into [Operation](employee, explain,opTime, note1, note2) values('" +
                LogIn.m_User.id + "', '转账', getdate(),'" + string.Join("\n", m_Seats.Select(x => x.text).ToArray()) + "','" +
                seatForm.m_Seat.text + "')";

            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("转账失败,请重试!");
                return;
            }

            //if (auto_shoe)
            //{
            //    var pars = new List<string>();
            //    pars.Add("text");
            //    pars.Add("payEmployee");
            //    pars.Add("payTime");
            //    pars.Add("processed");

            //    var vals = new List<string>();
            //    vals.Add(string.Join("|", m_Seats.Select(x => x.name).ToArray()));
            //    vals.Add(LogIn.m_User.id);
            //    vals.Add(DateTime.Now.ToString());
            //    vals.Add("False");

            //    dao.insert_table_row("ShoeMsg", pars, vals);
            //}

            List<string> printCols = new List<string>();
            printCols.Add("手牌");
            if (use_pad)
                printCols.Add("房间");
            printCols.Add("项目名称");
            printCols.Add("技师");
            printCols.Add("单价");
            printCols.Add("数量");
            printCols.Add("金额");
            PrintSeatBill.Print_DataGridView(m_Seats, m_rooms,seatForm.m_Seat.text, "转账确认单", dgvExpense, printCols, moneyPayable.Text, companyName);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #18
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();
        }