//删除付款信息
        private void delPayTool_Click(object sender, EventArgs e)
        {
            if (dgvProviderPays.CurrentCell == null)
            {
                BathClass.printErrorMsg("未选择供应商付款信息!");
                return;
            }

            if (BathClass.printAskMsg("确认删除供应商付款信息?") != DialogResult.Yes)
            {
                return;
            }

            var p  = db.Provider.FirstOrDefault(x => x.name == dgvCustomerList.CurrentRow.Cells[0].Value.ToString());
            var pp = db.ProviderPays.FirstOrDefault(x => x.id.ToString() == dgvProviderPays.CurrentRow.Cells[0].Value.ToString());

            db.ProviderPays.DeleteOnSubmit(pp);
            db.SubmitChanges();

            int r = dgvCustomerList.CurrentCell.RowIndex;
            int c = dgvCustomerList.CurrentCell.ColumnIndex;

            dgvProviderList_show();
            dgvCustomerList.CurrentCell = dgvCustomerList[c, r];
            dgvProviderPays_show(p);
        }
Beispiel #2
0
        //检查软件使用次数是否超过10次
        private bool checkTrialTimes()
        {
            BathClass.printWarningMsg("您现在使用的是试用版,可以免费使用10次;");
            int tLong = 0;

            try
            {
                tLong = (int)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0);
                BathClass.printWarningMsg("您已经使用了" + tLong + "次!");
            }
            catch
            {
                Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0, RegistryValueKind.DWord);
            }
            if (tLong < 10)
            {
                int tTimes = tLong + 1;
                Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", tTimes);
                return(true);
            }
            else
            {
                if (BathClass.printAskMsg("试用次数已到!您是否需要注册?") != DialogResult.Yes)
                {
                    return(false);
                }
                RegisterForm regForm = new RegisterForm(db);
                if (regForm.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }
                return(true);
            }
        }
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            st = DateTime.Parse("2000-1-1 00:00:00");
            et = BathClass.Now(LogIn.connectionString);
            if (rmonth.Checked)
            {
                et = DateTime.Today.AddMonths(-Convert.ToInt32(month.Value));
            }
            else
            {
                st = startTime.Value;
                et = endTime.Value;
            }
            if (BathClass.printAskMsg("确定消除截止到" + et.ToString("yyyy年MM月dd日HH:mm") + "的记录?")
                != DialogResult.Yes)
            {
                return;
            }

            Thread td = new Thread(new ThreadStart(do_work));

            td.Start();

            m_form = new ProgressForm("工作进行中...", "正在删除记录,请稍等......");
            m_form.ShowDialog();

            this.DialogResult = DialogResult.OK;
        }
Beispiel #4
0
        //点击台位按钮
        private void btn_Click(object sender, EventArgs e)
        {
            var btn    = sender as Button;
            var strs   = btn.Text.Split('\n');
            var str    = strs.FirstOrDefault(x => x.Contains("房间"));
            var roomId = str.Split(':')[1];

            var room = db.Room.FirstOrDefault(x => x.name == roomId);

            if (room.status != "服务")
            {
                BathClass.printErrorMsg("客房不在服务状态,不能催钟");
                return;
            }

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

            var roomCall = new RoomCall();

            roomCall.roomId = roomId;
            roomCall.read   = false;
            roomCall.msg    = "催钟";

            db.RoomCall.InsertOnSubmit(roomCall);
            db.SubmitChanges();
            this.Close();
        }
Beispiel #5
0
 //退出
 private void toolExit_Click(object sender, EventArgs e)
 {
     if (BathClass.printAskMsg("是否退出?") == DialogResult.Yes)
     {
         this.Close();
     }
 }
Beispiel #6
0
        //停止计时、继续计时
        private void btnTiming_Click(object sender, EventArgs e)
        {
            string orderId = dgvExpense.CurrentRow.Cells[0].Value.ToString();

            //var order = db.Orders.FirstOrDefault(x => x.id == orderId);
            if (BathClass.printAskMsg("确定停止计时?") != DialogResult.Yes)
            {
                return;
            }

            if (btnTiming.Text == "停止计时" && btnTiming.Visible)//停止计时状态
            {
                var cmd_str = "update [Orders] set money=money*ceiling(datediff(minute,inputTime, getdate())/60.0),"
                              + "priceType='停止消费' where id=" + orderId + " and priceType='每小时'";
                if (!dao.execute_command(cmd_str))
                {
                    BathClass.printErrorMsg("停止计时失败!");
                    return;
                }
                //var orders = db.Orders.Where(x => x.systemId == order.systemId && x.menu == order.menu &&
                //    x.deleteEmployee == null && !x.paid);
                //foreach (var od in orders)
                //{
                //    od.stopTiming = true;
                //    if (od.priceType == "每小时")
                //    {
                //        od.priceType = "停止消费";
                //        od.money = order.money * Math.Ceiling((DateTime.Now - order.inputTime).TotalHours);
                //    }
                //}
            }

            //db.SubmitChanges();
            btnTiming.Visible = false;
        }
Beispiel #7
0
 private void BTMenu_Click(object sender, EventArgs e)
 {
     if (BathClass.printAskMsg("确定同步项目数据?") != DialogResult.Yes)
     {
         return;
     }
 }
Beispiel #8
0
        //押金离场
        private void btnDeposit_Click(object sender, EventArgs e)
        {
            List <int> s = new List <int>();

            s.Add(2);
            s.Add(7);
            var inputSeatForm = new InputRoomForm(s);

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

            var seat = inputSeatForm.m_Seat;

            if (seat.status == 2)
            {
                DepositForm depositForm = new DepositForm(inputSeatForm.m_Seat);
                depositForm.ShowDialog();
            }
            else if (seat.status == 7 && BathClass.printAskMsg("是否取消押金离场状态") == DialogResult.Yes)
            {
                var db_new   = new BathDBDataContext(LogIn.connectionString);
                var seat_new = db_new.HotelRoom.FirstOrDefault(x => x.text == seat.text);
                seat_new.status = 2;
                seat_new.note   = null;
                db_new.SubmitChanges();
            }
        }
        //删除
        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();
        }
        private void p_BtnUrgentClicked(object sender, EventArgs e)
        {
            LogPanel logPanel = sender as LogPanel;
            var      log      = db.DepartmentLog.FirstOrDefault(x => x.id == logPanel.id);

            if (MConvert <bool> .ToTypeOrDefault(log.done, false))
            {
                if (BathClass.printAskMsg("事件已完成,加急将会把事件改成未完成状态,确定继续?") != DialogResult.Yes)
                {
                    return;
                }

                log.done = false;
                logPanel.set_btnDone_text("已完成");
            }

            if (!MConvert <bool> .ToTypeOrDefault(log.urgent, false))
            {
                log.urgent     = true;
                log.urgentDate = DateTime.Now;
            }
            else
            {
                log.urgent = false;
            }
            db.SubmitChanges();

            bool done = MConvert <bool> .ToTypeOrDefault(log.done, false);

            bool urgent = MConvert <bool> .ToTypeOrDefault(log.urgent, false);

            logPanel.set_panel_status(done, urgent, log.doneDate, log.urgentDate, log.dueTime);
        }
Beispiel #11
0
        //删除
        private void ToolDel_Click(object sender, EventArgs e)
        {
            if (dgv.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要先选择优惠券所在行!");
                return;
            }
            if (BathClass.printAskMsg("确认删除优惠券?") != DialogResult.Yes)
            {
                return;
            }

            string errorDesc = "";
            string isDeleted = (dgv.CurrentRow.Cells[4].EditedFormattedValue.ToString() == "False" ? "y" : "n");
            int    id        = MConvert <int> .ToTypeOrDefault(dgv.CurrentRow.Cells[0].Value, 0);

            double value = MConvert <double> .ToTypeOrDefault(dgv.CurrentRow.Cells[2].Value, 0);

            bool success = WxCouponManagement.uploadCoupon(LogIn.connectionIP, id, LogIn.options.company_Code,
                                                           value, "", "", isDeleted, out errorDesc);

            if (!success)
            {
                BathClass.printErrorMsg("删除失败,原因:" + errorDesc);
            }
            dgv_show();
        }
Beispiel #12
0
        //删除供应商
        private void delProviderTool_Click(object sender, EventArgs e)
        {
            if (dgvCustomerList.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要选择行!");
                return;
            }

            var p = db.Provider.FirstOrDefault(x => x.name == dgvCustomerList.CurrentRow.Cells[0].Value.ToString());

            if (db.StockIn.Any(x => x.providerId == p.id) || db.ProviderPays.Any(x => x.providerId == p.id))
            {
                BathClass.printErrorMsg("与供应商已有账务往来,不能删除!");
                return;
            }

            if (BathClass.printAskMsg("确认删除供应商" + p.name) != DialogResult.Yes)
            {
                return;
            }

            db.Provider.DeleteOnSubmit(p);
            db.SubmitChanges();
            dgvProviderList_show();
        }
Beispiel #13
0
        //上下班
        private void btnClock_Click(object sender, EventArgs e)
        {
            if (m_tech_id == "-1")
            {
                BathClass.printErrorMsg("请先选择技师!");
                return;
            }

            var           tech_index = dao.get_techIndex("select * from [TechIndex] where dutyid=" + m_tech.jobId);
            List <string> old_index  = null;

            if (tech_index != null)
            {
                old_index = tech_index.ids.Split('%').ToList();
            }

            string cmd_str = "";

            if (m_tech.techStatus != null && m_tech.techStatus == "下班")
            {
                cmd_str = "update [Employee] set techStatus='空闲',startTime=null, seat=null,serverTime=null,room=null,OrderClock=null" +
                          " where id='" + m_tech_id + "'";
                if (tech_index != null)
                {
                    old_index.Add(m_tech_id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }
            else
            {
                if (m_tech.techStatus != null && m_tech.techStatus != "空闲")
                {
                    if (BathClass.printAskMsg("技师正在上钟,确认下班?") != DialogResult.Yes)
                    {
                        return;
                    }
                }
                cmd_str = "update [Employee] set techStatus='下班' where id='" + m_tech_id + "'";
                if (tech_index != null)
                {
                    old_index.Remove(m_tech_id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }

            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("技师上下班失败!");
                return;
            }
            else
            {
                var btn = (Button)(tPanel.Controls.Find(m_tech_id, false).FirstOrDefault());
                btn.ImageIndex = -1;

                m_tech_id = "-1";
                m_tech    = null;
            }
        }
Beispiel #14
0
        //刷卡改变技师状态
        private void change_tech_status()
        {
            if (techId.Text == "")
            {
                return;
            }

            var tech = dao.get_Employee("id='" + techId.Text + "'");

            if (tech == null)
            {
                BathClass.printErrorMsg("技师号不存在!");
                return;
            }

            var           tech_index = dao.get_techIndex("select * from [TechIndex] where dutyid=" + tech.jobId);
            List <string> old_index  = null;

            if (tech_index != null)
            {
                old_index = tech_index.ids.Split('%').ToList();
            }

            string cmd_str = "";

            if (tech.techStatus != null && tech.techStatus == "下班")
            {
                cmd_str = "update [Employee] set status='空闲',startTime=null, seat=null," +
                          "serverTime=null,room=null,OrderClock=null where id='" + tech.id + "'";
                if (tech_index != null)
                {
                    old_index.Add(tech.id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }
            else
            {
                if (tech.techStatus != null && tech.techStatus != "空闲")
                {
                    if (BathClass.printAskMsg("技师正在上钟,确认下班?") != DialogResult.Yes)
                    {
                        return;
                    }
                }
                cmd_str = "update [Employee] set status='下班' where id='" + tech.id + "'";
                if (tech_index != null)
                {
                    old_index.Remove(tech.id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }

            techId.Text = "";
            techId.Focus();
            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("技师上下班失败,请重试!");
            }
        }
Beispiel #15
0
        //显示清单
        public void dgv_show(BathDBDataContext db)
        {
            DgvFemale.Rows.Clear();
            DgvMale.Rows.Clear();
            if (!db.TechIndex.Any())
            {
                if (BathClass.printAskMsg("没有检测到排钟表,是否初始化?") != DialogResult.Yes)
                {
                    return;
                }

                toolReArrange_Click(null, null);
            }
            string typeSelName = seatTypeTree.SelectedNode.Text;

            if (typeSelName == "所有技师")
            {
                return;
            }

            var jobId = db.Job.FirstOrDefault(x => x.name == typeSelName).id;

            var techIdex_Female = db.TechIndex.FirstOrDefault(x => x.dutyid == jobId && x.gender == "女");

            if (techIdex_Female != null)
            {
                var techIndex_Female_ids = techIdex_Female.ids;
                var tech_ids             = techIndex_Female_ids.Split('%');
                foreach (var tech_id_index in tech_ids)
                {
                    var tech_id = tech_id_index.Split('=')[0];
                    var user    = db.Employee.FirstOrDefault(x => x.id == tech_id);
                    if (user == null)
                    {
                        continue;
                    }
                    DgvFemale.Rows.Add(tech_id, user.name);
                }
            }

            var techIdex_Male = db.TechIndex.FirstOrDefault(x => x.dutyid == jobId && x.gender == "男");

            if (techIdex_Male != null)
            {
                var techIndex_Male_ids = techIdex_Male.ids;
                var tech_ids           = techIndex_Male_ids.Split('%');
                foreach (var tech_id_index in tech_ids)
                {
                    var tech_id = tech_id_index.Split('=')[0];
                    var user    = db.Employee.FirstOrDefault(x => x.id == tech_id);
                    if (user == null)
                    {
                        continue;
                    }
                    DgvMale.Rows.Add(tech_id, user.name);
                }
            }
        }
Beispiel #16
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);
        }
Beispiel #17
0
        //右键下班
        private void  班ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item  = sender as ToolStripMenuItem;
            ContextMenuStrip  cmenu = item.GetCurrentParent() as ContextMenuStrip;
            Button            bt    = cmenu.SourceControl as Button;

            var dc   = new BathDBDataContext(m_connectionString);
            var user = dc.Employee.FirstOrDefault(x => x.id == bt.Name);

            if (user == null)
            {
                return;
            }

            var           tech_index = dao.get_techIndex("select * from [TechIndex] where dutyid=" + user.jobId);
            List <string> old_index  = null;

            if (tech_index != null)
            {
                old_index = tech_index.ids.Split('%').ToList();
            }

            string cmd_str = "";

            if (user.techStatus != "下班")
            {
                if (user.techStatus != null && user.techStatus != "空闲")
                {
                    if (BathClass.printAskMsg("技师正在上钟,确认下班?") != DialogResult.Yes)
                    {
                        return;
                    }
                }
                cmd_str = "update [Employee] set techStatus='下班' where id='" + user.id + "'";
                if (tech_index != null)
                {
                    old_index.Remove(user.id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }
            else
            {
                cmd_str = "update [Employee] set techStatus='空闲',startTime=null, seat=null,serverTime=null,room=null,OrderClock=null" +
                          " where id='" + user.id + "'";
                if (tech_index != null)
                {
                    old_index.Add(user.id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }

            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("技师上下班失败!");
                return;
            }
        }
Beispiel #18
0
        //退出
        private void btnExit_Click(object sender, EventArgs e)
        {
            if (BathClass.printAskMsg("确定退出?") != DialogResult.Yes)
            {
                return;
            }

            this.Close();
        }
Beispiel #19
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 #20
0
        //补卡
        private bool resumCard()
        {
            var    cc_new = db.CardCharge.Where(x => x.CC_CardNo == id.Text);
            double debit  = BathClass.ToInt(cc_new.Sum(x => x.CC_DebitSum));
            double lend   = BathClass.ToInt(cc_new.Sum(x => x.CC_LenderSum));

            if (BathClass.printAskMsg("卡号:" + id.Text + "已有金额:" + (debit - lend).ToString() + "元,确认补卡?") != DialogResult.OK)
            {
                return(false);
            }

            var cc = db.CardCharge.Where(x => x.CC_CardNo == m_Member.CI_CardNo);

            foreach (var c in cc)
            {
                c.CC_CardNo = id.Text;
            }

            var ci = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == id.Text);

            bool newCi = false;

            if (ci == null)
            {
                newCi        = true;
                ci           = new CardInfo();
                ci.CI_CardNo = id.Text;//前台发卡
            }

            ci.CI_CardTypeNo       = m_Member.CI_CardTypeNo;
            ci.CI_Name             = m_Member.CI_Name;
            ci.CI_Sexno            = m_Member.CI_Sexno;
            ci.CI_SendCardDate     = m_Member.CI_SendCardDate;
            ci.CI_SendCardOperator = LogIn.m_User.id.ToString();
            ci.state = "在用";

            if (newCi)
            {
                db.CardInfo.InsertOnSubmit(ci);
            }

            var cm = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == m_Member.CI_CardNo);

            if (cm != null)
            {
                db.CardInfo.DeleteOnSubmit(cm);
            }

            db.SubmitChanges();
            return(true);
        }
Beispiel #21
0
        private void toolWarn_Click(object sender, EventArgs e)
        {
            if (BathClass.printAskMsg("确定预警?") != DialogResult.Yes)
            {
                return;
            }

            var dc_new = new BathDBDataContext(LogIn.connectionString);
            var warn   = new RoomWarn();

            warn.msg = "警告";
            dc_new.RoomWarn.InsertOnSubmit(warn);
            dc_new.SubmitChanges();
        }
Beispiel #22
0
        private void toolWarn_Click(object sender, EventArgs e)
        {
            if (BathClass.printAskMsg("确定预警?") != DialogResult.Yes)
            {
                return;
            }

            if (!dao.execute_command("insert into [RoomWarn](msg) values('警告')"))
            {
                BathClass.printErrorMsg("预警失败!");
                return;
            }
            //var dc_new = new BathDBDataContext(LogIn.connectionString);
            //var warn = new RoomWarn();
            //warn.msg = "警告";
            //dc_new.RoomWarn.InsertOnSubmit(warn);
            //dc_new.SubmitChanges();
        }
Beispiel #23
0
        //退换押金取消押金离场状态
        private void btnRestore_Click(object sender, EventArgs e)
        {
            if (BathClass.printAskMsg("确认退换押金?") != DialogResult.Yes)
            {
                return;
            }

            string cmd_str = @"update [Seat] set deposit=null, status=2 where text='" + m_Seat.text + "'";

            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("退换押金失败,请重试!");
                return;
            }
            //m_Seat.deposit = null;
            //m_Seat.status = 2;
            //db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
        }
Beispiel #24
0
        //点击台位按钮
        private void btn_Click(object sender, EventArgs e)
        {
            var btn        = sender as Button;
            var strs       = btn.Text.Split('\n');
            var str        = strs.FirstOrDefault(x => x.Contains("房间"));
            var roomId_str = str.Split(':')[1];
            var room_str   = roomId_str.Split('-');
            var roomId     = room_str[0];
            var room       = db.Room.FirstOrDefault(x => x.name == roomId);

            int index = 0;

            if (room.population != 1)
            {
                index = Convert.ToInt32(room_str[1]) - 1;
            }

            var status = room.status.Split('|');

            if (status.Length <= index || status[index] != "服务")
            {
                BathClass.printErrorMsg("客房不在服务状态,不能催钟");
                return;
            }

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

            var roomCall = new RoomCall();

            roomCall.roomId = roomId;
            roomCall.seatId = room.seat.Split('|')[index];
            roomCall.read   = false;
            roomCall.msg    = "催钟";

            db.RoomCall.InsertOnSubmit(roomCall);
            db.SubmitChanges();

            this.Close();
        }
Beispiel #25
0
        //删除商品
        private void delGoods_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (dgv.CurrentCell == null)
            {
                BathClass.printErrorMsg("未选择商品!");
                return;
            }
            if (BathClass.printAskMsg("确认删除商品?") != DialogResult.Yes)
            {
                return;
            }

            var goods = db.StorageList.FirstOrDefault(x => x.name == dgv.CurrentRow.Cells[0].Value.ToString());

            db.StorageList.DeleteOnSubmit(goods);
            db.SubmitChanges();
            dgv_show();
        }
Beispiel #26
0
        //绑定快捷键
        private void MainWindow_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                if (BathClass.printAskMsg("是否退出?") == DialogResult.Yes)
                {
                    this.Close();
                }
                break;

            case Keys.F1:
                //table_Click(null, null);
                break;

            case Keys.F2:
                //member_Click(null, null);
                break;

            case Keys.F3:
                //document_Click(null, null);
                break;

            case Keys.F4:
                //stock_Click(null, null);
                break;

            case Keys.F5:
                //reception_Click(null, null);
                break;

            case Keys.F6:
                //data_Click(null, null);
                break;

            default:
                break;
            }
        }
Beispiel #27
0
        //修改技师号
        private void dgvExpense_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvExpense.CurrentCell == null)
            {
                return;
            }

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

            //var order = db.Orders.FirstOrDefault(x => x.id.ToString() == dgvExpense.CurrentRow.Cells[0].Value.ToString());
            if (techId == null || techId == "")
            {
                return;
            }

            if (BathClass.printAskMsg("当前技师为" + techId + "确认更换技师?") != DialogResult.Yes)
            {
                return;
            }

            var form = new InputEmployee("请输入技师号...");

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

            if (!dao.execute_command("update [Orders] set technician='" + form.employee.id + "' where id=" + orderId))
            {
                BathClass.printErrorMsg("技师号修改失败,请重试!");
                return;
            }
            dgvExpense.CurrentRow.Cells[4].Value = form.employee.id;
            //var tech = form.employee;
            //order.technician = tech.id;
            //db.SubmitChanges();
            //dgvExpense_show();
        }
Beispiel #28
0
        //创建技师排钟
        private void create_tech_panel()
        {
            try
            {
                var db = new BathDBDataContext(connectionString);
                if (!db.TechIndex.Any())
                {
                    if (BathClass.printAskMsg("没有检测到排钟表,是否初始化?") != DialogResult.Yes)
                    {
                        return;
                    }

                    reArrange_all_techs(db);
                }

                create_tech_panel_gender(db, "男", SplitGender.Panel2);
                create_tech_panel_gender(db, "女", SplitGender.Panel1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #29
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 #30
0
        //绑定快捷键
        private void Form_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                if (BathClass.printAskMsg("是否退出?") == DialogResult.Yes)
                {
                    this.Close();
                }
                break;

            case Keys.Enter:
                tool_open_seat();
                break;

            case Keys.F2:
                orderTool_Click(null, null);
                break;

            case Keys.F4:
                btnRoom_Click(null, null);
                break;

            case Keys.F10:
                toolPwd_Click(null, null);
                break;

            case Keys.D0:
            case Keys.NumPad0:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "0";
                }
                break;

            case Keys.D1:
            case Keys.NumPad1:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "1";
                }
                break;

            case Keys.D2:
            case Keys.NumPad2:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "2";
                }
                break;

            case Keys.D3:
            case Keys.NumPad3:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "3";
                }
                break;

            case Keys.D4:
            case Keys.NumPad4:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "4";
                }
                break;

            case Keys.D5:
            case Keys.NumPad5:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "5";
                }
                break;

            case Keys.D6:
            case Keys.NumPad6:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "6";
                }
                break;

            case Keys.D7:
            case Keys.NumPad7:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "7";
                }
                break;

            case Keys.D8:
            case Keys.NumPad8:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "8";
                }
                break;

            case Keys.D9:
            case Keys.NumPad9:
                if (!tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text += "9";
                }
                break;

            case Keys.Back:
                if (tSeat.Text != "" && !tSeat.TextBox.ContainsFocus)
                {
                    tSeat.Text = tSeat.Text.Substring(0, tSeat.Text.Length - 1);
                }
                break;

            default:
                break;
            }
        }