Esempio n. 1
0
        //删除
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvExpense.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要输入订单!");
                return;
            }

            string orderId = dgvExpense.CurrentRow.Cells[0].Value.ToString();

            //var order = db.Orders.FirstOrDefault(x => x.id == orderId);
            //if (order == null)
            //{
            //    BathClass.printErrorMsg("输入订单编号错误!");
            //    return;
            //}
            if (m_Orders.Contains(orderId))
            {
                BathClass.printErrorMsg("已点订单,不能删除!");
                return;
            }

            if (!dao.execute_command("delete from [Orders] where id=" + orderId))
            {
                BathClass.printErrorMsg("删除订单失败!");
                return;
            }
            //db.Orders.DeleteOnSubmit(order);
            //db.SubmitChanges();

            BathClass.find_combo(m_con_str, m_Seat.systemId, m_Seat.text);
            //m_Orders.Remove(order);
            //BathClass.find_combo(db, m_Seat, m_Orders);
            dgvExpense_show();
        }
Esempio n. 2
0
        //退单
        private void return_order(string orderId, Employee del_employee)
        {
            var form = new DeleteExplainForm();

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

            string deleteExpalin = form.txt;
            string cmd_str       = @"update [Orders] set deleteEmployee='" + del_employee.id + "', deleteExplain='"
                                   + deleteExpalin + "', deleteTime=getdate() where id=" + orderId;

            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("退单失败!");
                return;
            }

            BathClass.find_combo(m_con_str, m_Seat.systemId, m_Seat.text);
            dgvExpense_show();

            if (!dao.execute_command("update [OrderStockOut] set deleteEmployee='" + del_employee.id + "' where orderId=" + orderId))
            {
                BathClass.printErrorMsg("退换消耗品失败!");
            }
        }
Esempio n. 3
0
        //退单
        private void btnReturn_Click(object sender, EventArgs e)
        {
            if (dgvExpense.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要输入订单!");
                return;
            }

            string orderId = dgvExpense.CurrentRow.Cells[0].Value.ToString();

            //var order = db.Orders.FirstOrDefault(x => x.id == orderId);
            if (dgvExpense.CurrentRow.Cells[3].Value.ToString().Contains("套餐优惠"))
            {
                BathClass.printErrorMsg("输入订单编号错误!");
                return;
            }
            if (!m_Orders.Contains(orderId))
            {
                if (BathClass.printAskMsg("没入数据库,直接删除?") == DialogResult.Yes)
                {
                    string cmd_str = "delete from [Orders] where id=" + orderId;
                    if (!dao.execute_command(cmd_str))
                    {
                        BathClass.printErrorMsg("退单失败,请重试!");
                        return;
                    }
                    //db.Orders.DeleteOnSubmit(order);
                    //db.SubmitChanges();

                    BathClass.find_combo(m_con_str, m_Seat.systemId, m_Seat.text);
                    //BathClass.find_combo(db, m_Seat, m_Orders);
                    //m_Orders.Remove(order);
                    dgvExpense_show();
                }
                return;
            }

            if (dao.get_authority(m_user, "退单"))
            {
                return_order(orderId, m_user);
                return;
            }

            InputEmployeeByPwd inputServerForm = new InputEmployeeByPwd(m_con_str);

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

            if (!dao.get_authority(inputServerForm.employee, "退单"))
            {
                BathClass.printErrorMsg("权限不够");
                return;
            }

            return_order(orderId, inputServerForm.employee);
        }
Esempio n. 4
0
        //清屏
        private void btnClear_Click(object sender, EventArgs e)
        {
            string state_str = "";
            int    count     = dgvExpense.Rows.Count;

            for (int i = 0; i < count; i++)
            {
                string orderId = dgvExpense.Rows[i].Cells[0].Value.ToString();
                if (m_Orders.Contains(orderId))
                {
                    continue;
                }
                state_str += "id=" + dgvExpense.Rows[i].Cells[0].Value.ToString();
                if (i != count - 1)
                {
                    state_str += " or ";
                }
            }

            if (state_str == "")
            {
                BathClass.printErrorMsg("当前没有点单,不能清屏!");
                return;
            }
            string cmd_str = "delete from [Orders] where(" + state_str + ")";

            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("清屏失败!");
                return;
            }
            //db.Orders.DeleteAllOnSubmit(m_Orders.ToArray());
            //db.SubmitChanges();

            //m_Orders.Clear();

            //修改
            BathClass.find_combo(m_con_str, m_Seat.systemId, m_Seat.text);
            //BathClass.find_combo(db, m_Seat, m_Orders);
            dgvExpense_show();
        }
Esempio n. 5
0
        private void order_menu(CMenu menu)
        {
            string pars = "menu,text,systemId,number,money,inputTime,paid";
            string vals = "'" + menu.name + "','" + m_Seat.text + "','" + m_Seat.systemId + "',1," + menu.price + ",getdate(),'False'";

            if (inputBillId)
            {
                var form = new InputNumberStr("输入单据编号");
                if (form.ShowDialog() != DialogResult.OK)
                {
                    BathClass.printErrorMsg("需要输入单据编号");
                    return;
                }
                pars += ",billId";
                vals += ",'" + form.str + "'";
            }

            if (menu.technician)
            {
                pars += ",technician";
                if (!m_has_user)
                {
                    InputEmployee techForm = new InputEmployee("请输入技师号...");
                    if (techForm.ShowDialog() != DialogResult.OK)
                    {
                        BathClass.printErrorMsg("需要选择技师!");
                        return;
                    }
                    vals += ",'" + techForm.employee.id + "'";
                }
                else
                {
                    vals += ",'" + m_user.id + "'";
                }

                //是否需要输入点钟轮钟
                if (inputTechType)
                {
                    var form = new DianLunForm();
                    if (form.ShowDialog() != DialogResult.OK)
                    {
                        BathClass.printErrorMsg("需要输入上钟类型!");
                        return;
                    }
                    pars += ",techType";
                    vals += ",'" + form.tech_type + "'";
                }
            }
            if (!m_has_user && MConvert <bool> .ToTypeOrDefault(menu.waiter, false))
            {
                InputEmployee techForm = new InputEmployee("请输入服务员工号...");
                if (techForm.ShowDialog() != DialogResult.OK)
                {
                    BathClass.printErrorMsg("需要输入录单员!");
                    return;
                }
                pars += ",inputEmployee";
                vals += ",'" + techForm.employee.id + "'";
            }
            else
            {
                pars += ",inputEmployee";
                vals += ",'" + m_user.id + "'";
            }

            string cmd_str = @"insert into [Orders](" + pars + ") values(" + vals + ")";

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

            //BathClass.find_combo_duplicated(m_con_str, m_Seat.systemId, m_Seat.text);
            BathClass.find_combo(m_con_str, m_Seat.systemId, m_Seat.text);
            dgvExpense_show();
            Thread td = new Thread(delegate() { print_kitchen(menu); });

            td.Start();
        }