//储值卡结账 private void creditCardTool_Click(object sender, EventArgs e) { //1,刷会员卡 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新台位信息 //5,更新客房信息 if (!creditCardTool.Enabled) { return; } creditCardTool.Enabled = false; if (check_if_combined()) { return; } try { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(moneyPayable.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) { return; } if (m_Member_List == null) { m_Member_List = memberCardUsingForm.m_memberList; } //Account account = new Account(); set_account(); account.creditCard = m_money; db.Account.InsertOnSubmit(account); db.SubmitChanges(); set_order_paid(); update_seat_room(); insert_member_infor(); db.SubmitChanges(); BathClass.sendMessageToCamera(db, m_Seats[0].systemId); this.DialogResult = DialogResult.OK; } catch (System.Exception ex) { handle_exception(ex); } }
//判断是否需要会员卡 private bool memberCardNeed() { if (creditCard.Text != "") { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(creditCard.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) { return(false); } m_Member_List = memberCardUsingForm.m_memberList; if (watch) { BathClass.sendMessageToCamera(db, m_Seats[0].systemId); } } if (coupon.Text != "" && watch) { BathClass.sendMessageToCamera(db, m_Seats[0].systemId); } if (zero.Text != "") { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) { return(false); } customerId = customerChooseForm.customerId; Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerId); customer.money += Convert.ToDouble(zero.Text); db.SubmitChanges(); } if (sign.Text != "") { SignForFreeForm inputSerForm = new SignForFreeForm(); if (inputSerForm.ShowDialog() != DialogResult.OK) { return(false); } signature = inputSerForm.signature; } return(true); }
//判断是否需要会员卡 private bool memberCardNeed() { if (creditCard.Text != "") { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(creditCard.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) return false; m_Member_List = memberCardUsingForm.m_memberList; if (watch) BathClass.sendMessageToCamera(db, m_Seats[0].systemId); } if (coupon.Text != "" && watch) BathClass.sendMessageToCamera(db, m_Seats[0].systemId); if (zero.Text != "") { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) return false; customerId = customerChooseForm.customerId; Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerId); customer.money += Convert.ToDouble(zero.Text); db.SubmitChanges(); } if (sign.Text != "") { SignForFreeForm inputSerForm = new SignForFreeForm(); if (inputSerForm.ShowDialog() != DialogResult.OK) return false; signature = inputSerForm.signature; } return true; }
//储值卡结账 private void creditCardTool_Click(object sender, EventArgs e) { //1,刷会员卡 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新台位信息 //5,更新客房信息 if (!creditCardTool.Enabled) return; creditCardTool.Enabled = false; if (check_if_combined()) return; try { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(moneyPayable.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) return; if (m_Member_List == null) m_Member_List = memberCardUsingForm.m_memberList; //Account account = new Account(); set_account(); account.creditCard = m_money; db.Account.InsertOnSubmit(account); db.SubmitChanges(); set_order_paid(); update_seat_room(); insert_member_infor(); db.SubmitChanges(); BathClass.sendMessageToCamera(db, m_Seats[0].systemId); this.DialogResult = DialogResult.OK; } catch (System.Exception ex) { handle_exception(ex); } }
//判断是否需要会员卡 private bool memberCardNeed() { if (creditCard.Text != "") { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(creditCard.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) return false; m_Member_List = memberCardUsingForm.m_memberList; if (watch) { if (!BathClass.sendMessageToCamera(dao, m_Seats[0].systemId)) { BathClass.printErrorMsg("发送消息给摄像头失败,请重试!"); return false; } } } if (coupon.Text != "" && watch) { if (!BathClass.sendMessageToCamera(dao, m_Seats[0].systemId)) { BathClass.printErrorMsg("发送消息给摄像头失败,请重试!"); return false; } } if (zero.Text != "") { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) return false; customerId = customerChooseForm.customerId; string cmd_str = "update [Customer] set money=isnull(money,0)+" + zero.Text + " where id=" + customerId.ToString(); if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("客户累计金额失败,请重试!"); return false; } ////Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerId); ////customer.money += Convert.ToDouble(zero.Text); ////db.SubmitChanges(); } if (sign.Text != "") { SignForFreeForm inputSerForm = new SignForFreeForm(); if (inputSerForm.ShowDialog() != DialogResult.OK) return false; signature = inputSerForm.signature; } return true; }
//储值卡结账 private void creditCardTool_Click(object sender, EventArgs e) { //1,刷会员卡 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新台位信息 //5,更新客房信息 if (!creditCardTool.Enabled) return; creditCardTool.Enabled = false; if (check_if_combined()) { creditCardTool.Enabled = true; btnOk.Enabled = true; return; } try { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(moneyPayable.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) { creditCardTool.Enabled = true; btnOk.Enabled = true; return; } if (m_Member_List == null) m_Member_List = memberCardUsingForm.m_memberList; //Account account = new Account(); string cmd_str = ""; set_account(); //if (!dao.exist_instance("Account", "systemId='" + account.systemId + "' and abandon is null")) //{ string pars = @"text,systemId,openTime,openEmployee,payTime,payEmployee,macAddress"; string vals = "'" + account.text + "','" + account.systemId + "','" + account.openTime + "','" + account.openEmployee + "',getdate(),'" + account.payEmployee + "','" + account.macAddress + "'"; if (account.promotionMemberId != null) { pars += ",promotionMemberId"; vals += ",'" + account.promotionMemberId + "'"; } if (account.promotionAmount != null) { pars += ",promotionAmount"; vals += ",'" + account.promotionAmount + "'"; } if (account.memberId != null) { pars += ",memberId"; vals += ",'" + account.memberId + "'"; } pars += ",creditCard"; vals += "," + m_money.ToString(); cmd_str = @"declare @NewAct TABLE (id INT NOT NULL PRIMARY KEY)"; cmd_str += @" insert into [Account](" + pars + ") output inserted.id into @NewAct values(" + vals + ") "; //} cmd_str += " " + set_order_paid(); cmd_str += " " + insert_member_infor(); cmd_str += " " + update_seat_room(); cmd_str += " select id from @NewAct"; if (!dao.insert_account(cmd_str, ref _newAccountId)) { btnOk.Enabled = true; BathClass.printErrorMsg("结账失败,请重试!"); return; } //var act = db.Account.FirstOrDefault(x => x.systemId == account.systemId && x.abandon == null); //if (act == null) //{ // db.Account.InsertOnSubmit(account); // db.SubmitChanges(); //} //else //{ // account = act; //} //set_order_paid(); //insert_member_infor(); //db.SubmitChanges(); //update_seat_room(); //db.SubmitChanges(); //BathClass.sendMessageToCamera(db, m_Seats[0].systemId); this.DialogResult = DialogResult.OK; } catch (System.Exception ex) { BathClass.printErrorMsg("系统出错:" + ex.Message + ",请重试!"); } }
//储值卡结账 private void creditCardTool_Click(object sender, EventArgs e) { //1,刷会员卡 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新台位信息 //5,更新客房信息 if (!creditCardTool.Enabled) { return; } creditCardTool.Enabled = false; if (check_if_combined()) { creditCardTool.Enabled = true; btnOk.Enabled = true; return; } try { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(moneyPayable.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) { creditCardTool.Enabled = true; btnOk.Enabled = true; return; } if (m_Member_List == null) { m_Member_List = memberCardUsingForm.m_memberList; } //Account account = new Account(); string cmd_str = ""; set_account(); //if (!dao.exist_instance("Account", "systemId='" + account.systemId + "' and abandon is null")) //{ string pars = @"text,systemId,openTime,openEmployee,payTime,payEmployee,macAddress"; string vals = "'" + account.text + "','" + account.systemId + "','" + account.openTime + "','" + account.openEmployee + "',getdate(),'" + account.payEmployee + "','" + account.macAddress + "'"; if (account.promotionMemberId != null) { pars += ",promotionMemberId"; vals += ",'" + account.promotionMemberId + "'"; } if (account.promotionAmount != null) { pars += ",promotionAmount"; vals += ",'" + account.promotionAmount + "'"; } if (account.memberId != null) { pars += ",memberId"; vals += ",'" + account.memberId + "'"; } pars += ",creditCard"; vals += "," + m_money.ToString(); cmd_str = @"declare @NewAct TABLE (id INT NOT NULL PRIMARY KEY)"; cmd_str += @" insert into [Account](" + pars + ") output inserted.id into @NewAct values(" + vals + ") "; //} cmd_str += " " + set_order_paid(); cmd_str += " " + insert_member_infor(); cmd_str += " " + update_seat_room(); cmd_str += " select id from @NewAct"; if (!dao.insert_account(cmd_str, ref _newAccountId)) { btnOk.Enabled = true; BathClass.printErrorMsg("结账失败,请重试!"); return; } //var act = db.Account.FirstOrDefault(x => x.systemId == account.systemId && x.abandon == null); //if (act == null) //{ // db.Account.InsertOnSubmit(account); // db.SubmitChanges(); //} //else //{ // account = act; //} //set_order_paid(); //insert_member_infor(); //db.SubmitChanges(); //update_seat_room(); //db.SubmitChanges(); //BathClass.sendMessageToCamera(db, m_Seats[0].systemId); this.DialogResult = DialogResult.OK; } catch (System.Exception ex) { BathClass.printErrorMsg("系统出错:" + ex.Message + ",请重试!"); } }
//判断是否需要会员卡 private bool memberCardNeed() { if (creditCard.Text != "") { CardUsingForm memberCardUsingForm = new CardUsingForm(Convert.ToDouble(creditCard.Text)); if (memberCardUsingForm.ShowDialog() != DialogResult.OK) { return(false); } m_Member_List = memberCardUsingForm.m_memberList; if (watch) { if (!BathClass.sendMessageToCamera(dao, m_Seats[0].systemId)) { BathClass.printErrorMsg("发送消息给摄像头失败,请重试!"); return(false); } } } if (coupon.Text != "" && watch) { if (!BathClass.sendMessageToCamera(dao, m_Seats[0].systemId)) { BathClass.printErrorMsg("发送消息给摄像头失败,请重试!"); return(false); } } if (zero.Text != "") { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) { return(false); } customerId = customerChooseForm.customerId; string cmd_str = "update [Customer] set money=isnull(money,0)+" + zero.Text + " where id=" + customerId.ToString(); if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("客户累计金额失败,请重试!"); return(false); } ////Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerId); ////customer.money += Convert.ToDouble(zero.Text); ////db.SubmitChanges(); } if (sign.Text != "") { SignForFreeForm inputSerForm = new SignForFreeForm(); if (inputSerForm.ShowDialog() != DialogResult.OK) { return(false); } signature = inputSerForm.signature; } return(true); }