//设置 private void btnSet_Click(object sender, EventArgs e) { CardPortBaudForm cardPortBaudForm = new CardPortBaudForm(); if (cardPortBaudForm.ShowDialog() != DialogResult.OK) { return; } string card_port = cardPortBaudForm.card_port.ToString(); string card_baud = cardPortBaudForm.card_baud.ToString(); Int16 port = Convert.ToInt16(card_port); int baud = Convert.ToInt32(card_baud); int icdev = IC.ic_init(port, baud); if (icdev < 0) { BathClass.printErrorMsg("设置读卡机失败,请重试!"); } else { BathClass.printInformation("读卡机设置成功!"); int st = IC.ic_exit(icdev); } }
void btn_Click(object sender, EventArgs e) { Button btn = (Button)sender; string roomID = btn.Text.Split('\n')[0].Split(':')[1]; BathClass.printInformation(GetSeatIdByRoomNo(roomID)); }
private void btnGetSeatIdByRoomNo_Click(object sender, EventArgs e) { string RoomID = txtBoxRoomId.Text; if (RoomID == "") { BathClass.printWarningMsg("需要输入房间号!"); return; } string seatID = GetSeatIdByRoomNo(RoomID); BathClass.printInformation(seatID); }
//确定 private void btnOk_Click(object sender, EventArgs e) { if (btnOk.Text == "读卡") { get_member(); } else if (btnOk.Text == "充值" && money.Text != "") { CardCharge cardCharge = new CardCharge(); cardCharge.CC_CardNo = m_member.CI_CardNo; cardCharge.CC_DebitSum = Convert.ToDouble(money.Text); cardCharge.CC_ItemExplain = "会员卡充值-收"; cardCharge.CC_InputOperator = LogIn.m_User.id.ToString(); cardCharge.CC_InputDate = GeneralClass.Now; cardCharge.systemId = m_Seat.systemId; db.CardCharge.InsertOnSubmit(cardCharge); int sale_money = find_card_sale(); if (sale_money != 0) { CardCharge cardChargeSale = new CardCharge(); cardChargeSale.CC_CardNo = m_member.CI_CardNo; cardChargeSale.CC_ItemExplain = "优惠送"; cardChargeSale.CC_DebitSum = sale_money; cardChargeSale.CC_LenderSum = 0; cardChargeSale.CC_InputOperator = LogIn.m_User.id.ToString(); cardChargeSale.CC_InputDate = GeneralClass.Now; cardChargeSale.systemId = m_Seat.systemId; db.CardCharge.InsertOnSubmit(cardChargeSale); BathClass.printInformation("送" + sale_money + "元"); } //var menu = db.Menu.FirstOrDefault(x => x.name == type.Text+"充值"); Orders order = new Orders(); order.menu = "储值卡充值"; order.text = m_Seat.text; order.systemId = m_Seat.systemId; order.number = 1; order.inputTime = BathClass.Now(LogIn.connectionString); order.inputEmployee = LogIn.m_User.id.ToString(); order.paid = false; order.money = Convert.ToDouble(money.Text); db.Orders.InsertOnSubmit(order); db.SubmitChanges(); this.DialogResult = DialogResult.OK; } }
//查询手牌所在房间 private void btnFind_Click(object sender, EventArgs e) { if (seatId.Text == "") { BathClass.printErrorMsg("需要输入手牌号!"); return; } var t = seatId.Text; seatId.Text = ""; var db = new BathDBDataContext(LogIn.connectionString); Room room = null; var rooms = db.Room.Where(x => x.seat.Contains(t)); foreach (var r in rooms) { try { var seatIds = r.seat.Split('|').ToList(); var status = r.status.Split('|').ToList(); int i = seatIds.IndexOf(t); if (i != -1 && status[i] != "空闲" && status[i] != "null") { room = r; break; } } catch { } } //if (room != null) // return room.name; //else // return ""; //var room = db.Room.FirstOrDefault(x => x.seatId != null && x.seatId.Contains(t)); if (room == null) { BathClass.printInformation("未找到手牌号"); } else { BathClass.printInformation("手牌:" + t + ",在房间:" + room.name); } seatId.Focus(); }
//点击台位按钮 private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; btn.Enabled = false; btn.Enabled = true; BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var manuInput = BathClass.ToBool(db_new.Options.FirstOrDefault().允许手工输入手牌号结账); m_Seat = db_new.HotelRoom.FirstOrDefault(x => x.text == btn.Text); var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == m_Seat.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } switch (m_Seat.status) { case 1: //可用 case 3: //已经结账 break; case 2: //正在使用 case 6: //警告 case 7: //押金离场 case 8: //重新结账 if (m_Seat.note != null && m_Seat.note != "") { BathClass.printInformation(m_Seat.note); } SeatExpenseForm seatExpenseForm = new SeatExpenseForm(m_Seat); seatExpenseForm.ShowDialog(); break; case 4: //锁定 break; case 5: //停用 BathClass.printErrorMsg("台位已经停用!"); break; default: break; } }
//确定 private void btnOk_Click(object sender, EventArgs e) { String TypeStr = ""; String CopyRightToCOM = ""; String CopyRightStr = "//上海迅赛信息技术有限公司,网址www.xunsai.com//"; if (SmsClass.Sms_Connection(CopyRightStr, (uint)(port.SelectedIndex + 1), uint.Parse(baud.Text), out TypeStr, out CopyRightToCOM) != 1) { BathClass.printErrorMsg("设置出错,请重试!"); return; } BathClass.printInformation("设置成功!"); SmsClass.Sms_Disconnection(); IOUtil.set_config_by_key(ConfigKeys.KEY_SMSPORT, port.Text); IOUtil.set_config_by_key(ConfigKeys.KEY_CARD_BAUD, baud.Text); this.DialogResult = DialogResult.OK; }
private void btnGetSeatIdByRoomNo_Click(object sender, EventArgs e) { string RoomID = txtBoxRoomId.Text; if (RoomID == "") { BathClass.printWarningMsg("需要输入房间号!"); return; } var db = new BathDBDataContext(LogIn.connectionString); string seatID = db.Room.FirstOrDefault(x => x.name == RoomID).seat; if (seatID == "" || seatId == null) { BathClass.printErrorMsg("该房间号不存在,请重新输入!"); return; } else { BathClass.printInformation(seatID); } }
//赠送 private void BTExtend_Click(object sender, EventArgs e) { if (wxUser == null) { BathClass.printErrorMsg("需要选择赠送对象!"); return; } if (dgv.CurrentCell == null) { BathClass.printErrorMsg("需要选择赠送优惠券种类!"); return; } string errorDesc = ""; var couponIds = new List <int>(); var openIds = new List <string>(); var numbers = new List <int>(); foreach (DataGridViewRow r in dgvExtend.Rows) { couponIds.Add(MConvert <int> .ToTypeOrDefault(r.Cells[2].Value, 0)); openIds.Add(r.Cells[0].Value.ToString()); numbers.Add(MConvert <int> .ToTypeOrDefault(r.Cells[4].Value, 1)); } bool success = WxCouponManagement.extendMultiCoupon(LogIn.connectionIP, LogIn.options.company_Code, couponIds, openIds, numbers, out errorDesc); if (!success) { BathClass.printErrorMsg(errorDesc); return; } BathClass.printInformation("优惠券赠送成功!"); this.DialogResult = DialogResult.OK; this.Close(); }
//载入消费 private void btnReload_Click(object sender, EventArgs e) { var dc_new = new BathDBDataContext(LogIn.connectionString); if (seatText.Text != "") { m_Seat = dc_new.HotelRoom.FirstOrDefault(x => x.text == seatText.Text || x.oId == seatText.Text); seatText.Text = ""; if (m_Seat == null || m_Seat.status != 2 && m_Seat.status != 6 && m_Seat.status != 7 && m_Seat.status != 8) { BathClass.printErrorMsg("该手牌不在使用中,不能结账!"); return; } if (m_Seats.FirstOrDefault(x => x.text == m_Seat.text) == null) { if (m_Seat.note != null) { BathClass.printInformation(m_Seat.note); } string t = Convert.ToDateTime(m_Seat.openTime).ToShortTimeString(); dgvChain.Rows.Add(); dgvChain.Rows[dgvChain.Rows.Count - 1].Cells[0].Value = m_Seat.text; dgvChain.Rows[dgvChain.Rows.Count - 1].Cells[1].Value = use_oyd; dgvChain.Rows[dgvChain.Rows.Count - 1].Cells[2].Value = t; order_guoye(m_Seat, dc_new); m_Seats.Add(m_Seat); m_Seat.paying = true; dc_new.SubmitChanges(); //dgvChain_show(); dgvChain.CurrentCell = null; //chain = true; dgvExpense_show(dc_new); setStatus(dc_new); } } }
//查询 private void btnFind_Click(object sender, EventArgs e) { if (seatId.Text == "") { BathClass.printErrorMsg("需要输入手牌号!"); return; } var t = seatId.Text; seatId.Text = ""; var db = new BathDBDataContext(LogIn.connectionString); var room = db.Room.FirstOrDefault(x => x.seatIds != null && x.seatIds.Contains(t)); if (room == null) { BathClass.printInformation("未找到手牌号"); } else { BathClass.printInformation("手牌:" + t + ",在房间:" + room.name); } }
//发送单条短信 private void BtnSendOneMsg_Click(object sender, EventArgs e) { stop_flag = true; if (dgv.CurrentCell == null) { return; } String TypeStr = ""; String CopyRightToCOM = ""; String CopyRightStr = "//上海迅赛信息技术有限公司,网址www.xunsai.com//"; smsPort = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSPORT); smsBaud = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSBAUD); if (smsPort == "" || smsBaud == "") { SMmsForm smsForm = new SMmsForm(); if (smsForm.ShowDialog() != DialogResult.OK) { return; } smsPort = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSPORT); smsBaud = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSBAUD); } if (smsPort == "" || smsBaud == "" || msg.Text == "") { return; } if (SmsClass.Sms_Connection(CopyRightStr, uint.Parse(smsPort[3].ToString()), uint.Parse(smsBaud), out TypeStr, out CopyRightToCOM) != 1) { this.Invoke(new delegate_no_para(close_smsMsgForm)); BathClass.printErrorMsg("短信猫连接失败,请重试!"); return; } DataGridViewRow r = dgv.CurrentRow; change_row_color(r, Color.Cyan); string phone = MConvert <string> .ToTypeOrDefault(r.Cells[2].Value, ""); if (phone.Length != 11) { BathClass.printErrorMsg("电话号码格式不正确,需要11位电话号码"); change_row_color(r, Color.OrangeRed); } if (SmsClass.Sms_Send(phone, msg.Text) == 0) { BathClass.printErrorMsg("发送失败!"); change_row_color(r, Color.OrangeRed); } else { BathClass.printInformation("发送成功!"); change_row_color(r, Color.LightGreen); } SmsClass.Sms_Disconnection(); }
//F6开牌 private void tool_open_seat() { if (tSeat.Text == "") { return; } string text = tSeat.Text; tSeat.Text = ""; BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var manuInput = BathClass.ToBool(db_new.Options.FirstOrDefault().允许手工输入手牌号结账); var seat1 = db_new.HotelRoom.FirstOrDefault(x => x.text == text); var seat2 = db_new.HotelRoom.FirstOrDefault(x => x.oId == text); if (seat1 == null && seat2 == null) { BathClass.printErrorMsg("手牌不可用!"); return; } if (seat1 != null) { var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == seat1.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } int status = seat1.status; if (status == 2 || status == 6 || status == 7 || status == 8) { if (seat1.note != null && seat1.note != "") { BathClass.printInformation(seat1.note); } SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat1); seatExpenseForm.ShowDialog(); } else if (status == 4) { BathClass.printErrorMsg("台位已经锁定!"); } else if (status == 5) { BathClass.printErrorMsg("台位已经停用!"); } } else if (seat2 != null) { var mtype = db_new.HotelRoomType.FirstOrDefault(x => x.id == seat2.typeId); if (!manuInput && mtype.menuId != null) { BathClass.printErrorMsg("不允许手工输入手牌号结账!"); return; } int status = seat2.status; if (status == 2 || status == 6 || status == 7 || status == 8) { if (seat2.note != null && seat2.note != "") { BathClass.printInformation(seat2.note); } SeatExpenseForm seatExpenseForm = new SeatExpenseForm(seat2); seatExpenseForm.ShowDialog(); } else if (status == 4) { BathClass.printErrorMsg("台位已经锁定!"); } else if (status == 5) { BathClass.printErrorMsg("台位已经停用!"); } } }
//确定 private void btnOk_Click(object sender, EventArgs e) { if (btnOk.Text == "读卡") { get_member(); } else if (btnOk.Text == "充值") { string bank = tb_bank.Text.Trim(); string cash = tb_cash.Text.Trim(); string server = tb_server.Text.Trim(); if (cash == "" && bank == "" && server == "") { BathClass.printErrorMsg("需要输入充值金额"); return; } string serverEmployee = string.Empty; if (tb_server.Text.Trim() != "") { var form = new SignForFreeForm(); if (form.ShowDialog() != DialogResult.OK) { BathClass.printErrorMsg("需要输入赠送人姓名"); return; } serverEmployee = form.signature; } string pars = ""; string vals = ""; pars = "memberId"; vals = "'" + id.Text + "'"; if (balance.Text != "") { pars += ",balance"; vals += ",'" + balance.Text + "'"; } double money = 0; if (bank != "") { double b = Convert.ToDouble(bank); pars += ",bankUnion"; vals += ",'" + bank + "'"; money += b; } if (cash != "") { double c = Convert.ToDouble(cash); pars += ",cash"; vals += ",'" + cash + "'"; money += c; } if (server != "") { double s = Convert.ToDouble(server); pars += ",server"; vals += ",'" + server + "'"; money += s; pars += ",serverEmployee"; vals += ",'" + serverEmployee + "'"; } if (tb_seat.Text.Trim() != "") { pars += ",seat"; vals += ",'" + tb_seat.Text + "'"; } pars += ",macAddress"; vals += ",'" + PCUtil.getMacAddr_Local() + "'"; pars += ",explain"; vals += ",'会员充值'"; pars += ",payEmployee"; vals += ",'" + LogIn.m_User.id + "'"; pars += ",payTime"; vals += ",getdate()"; string cmd_str = @"insert into [CardSale](" + pars + ") values(" + vals + ") "; #region 会员充值 pars = "CC_CardNo"; vals = "'" + m_member.CI_CardNo + "'"; pars += ",CC_DebitSum"; vals += "," + money; pars += ",CC_ItemExplain"; vals += ",'会员卡充值-收'"; pars += ",CC_InputOperator"; vals += ",'" + LogIn.m_User.id + "'"; pars += ",CC_InputDate"; vals += ",getdate()"; if (m_Seat != null) { pars += ",systemId"; vals += ",'" + m_Seat.systemId + "'"; } cmd_str += @" insert into [CardCharge](" + pars + ") values(" + vals + ")"; #endregion #region 会员充值送 var sale_money = get_promotion_for_cardPop(money); if (sale_money != 0) { BathClass.printInformation("会员充值送" + sale_money.ToString()); pars = "CC_CardNo"; vals = "'" + m_member.CI_CardNo + "'"; pars += ",CC_DebitSum"; vals += "," + sale_money; pars += ",CC_ItemExplain"; vals += ",'会员卡充值-送'"; pars += ",CC_InputOperator"; vals += ",'" + LogIn.m_User.id + "'"; pars += ",CC_InputDate"; vals += ",getdate()"; if (m_Seat != null) { pars += ",systemId"; vals += ",'" + m_Seat.systemId + "'"; } cmd_str += @" insert into [CardCharge](" + pars + ") values(" + vals + ")"; } #endregion if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("会员充值失败,请重试!"); return; } Dictionary <string, string> pay_info = new Dictionary <string, string>(); if (bank != "") { pay_info["银联"] = bank; } if (cash != "") { pay_info["现金"] = cash; } if (server != "") { pay_info["招待"] = server + "$" + serverEmployee; } string bl = dao.get_member_balance(id.Text).ToString(); PrintMemberPopMsg.Print_DataGridView(id.Text, type.Text, bl, LogIn.m_User.id, DateTime.Now.ToString("MM-dd HH:mm"), LogIn.options.companyName, pay_info, tb_seat.Text); this.DialogResult = DialogResult.OK; this.Close(); } }