//判断是否需要会员卡 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 zeroTool_Click(object sender, EventArgs e) { //1,选择挂账单位 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新客户信息 //5,更新台位信息 //6,更新客房信息 if (!zeroTool.Enabled) { return; } zeroTool.Enabled = false; if (check_if_combined()) { return; } try { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) { return; } Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerChooseForm.customerId); customer.money += m_money; //Account account = new Account(); set_account(); account.zero = m_money; db.Account.InsertOnSubmit(account); db.SubmitChanges(); set_order_paid(); update_seat_room(); insert_member_infor(); db.SubmitChanges(); this.DialogResult = DialogResult.OK; } catch (System.Exception ex) { handle_exception(ex); } }
//挂账 private void zeroTool_Click(object sender, EventArgs e) { //1,选择挂账单位 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新客户信息 //5,更新台位信息 //6,更新客房信息 if (!zeroTool.Enabled) return; zeroTool.Enabled = false; if (check_if_combined()) return; try { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) return; Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerChooseForm.customerId); customer.money += m_money; //Account account = new Account(); set_account(); account.zero = m_money; db.Account.InsertOnSubmit(account); db.SubmitChanges(); set_order_paid(); update_seat_room(); insert_member_infor(); db.SubmitChanges(); 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) { 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 zeroTool_Click(object sender, EventArgs e) { //1,选择挂账单位 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新客户信息 //5,更新台位信息 //6,更新客房信息 if (!zeroTool.Enabled) return; zeroTool.Enabled = false; if (check_if_combined()) { zeroTool.Enabled = true; btnOk.Enabled = true; return; } try { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) { zeroTool.Enabled = true; btnOk.Enabled = true; return; } set_account(); string cId = customerChooseForm.customerId.ToString(); //Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerChooseForm.customerId); //customer.money += m_money; string cmd_str = @"update customer set money=isnull(money,0)+" + m_money.ToString() + " where id=" + cId; //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 + "'"; } pars += ",zero"; vals += "," + m_money.ToString(); pars += ",name"; vals += ",'" + cId + "'"; 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; } ////Account account = new Account(); //set_account(); //account.zero = m_money; //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(); 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); }
//挂账 private void zeroTool_Click(object sender, EventArgs e) { //1,选择挂账单位 //2,更新订单信息,修改订单paid属性 //3,插入账单数据库,更新 //4,更新客户信息 //5,更新台位信息 //6,更新客房信息 if (!zeroTool.Enabled) { return; } zeroTool.Enabled = false; if (check_if_combined()) { zeroTool.Enabled = true; btnOk.Enabled = true; return; } try { CustomerChooseForm customerChooseForm = new CustomerChooseForm(); if (customerChooseForm.ShowDialog() != DialogResult.OK) { zeroTool.Enabled = true; btnOk.Enabled = true; return; } set_account(); string cId = customerChooseForm.customerId.ToString(); //Customer customer = db.Customer.FirstOrDefault(x => x.id.ToString() == customerChooseForm.customerId); //customer.money += m_money; string cmd_str = @"update customer set money=isnull(money,0)+" + m_money.ToString() + " where id=" + cId; //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 + "'"; } pars += ",zero"; vals += "," + m_money.ToString(); pars += ",name"; vals += ",'" + cId + "'"; 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; } ////Account account = new Account(); //set_account(); //account.zero = m_money; //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(); this.DialogResult = DialogResult.OK; } catch (System.Exception ex) { BathClass.printErrorMsg("系统出错:" + ex.Message + ",请重试!"); } }