public static int UPCB(ConsumerBills c) { string sql = "update dbo.ConsumerBill set CBClose=1,VipID=@VipID,CBDiscount=@CBDiscount,CBEndDate=GETDATE(),AdminID=@AdminID,CBSale=@CBSale where CBID=@CBID"; SqlParameter[] sp = { new SqlParameter("@CBID", c.CBID), new SqlParameter("@VipID", c.VipID), new SqlParameter("@CBDiscount", c.CBDiscount), new SqlParameter("@AdminID", c.AdminID), new SqlParameter("@CBSale", c.CBSale), }; return(DBhelper.MyExecuteNonQuery(sql, sp)); }
/// <summary> /// 增加消费 /// </summary> /// <param name="c"></param> /// <returns></returns> public static int AddCB(ConsumerBills c) { string sql = @"insert into ConsumerBill(CBID,TableID,CBAmount,CBStartDate,CBClose) values(@CBID,@TableID,@CBAmount,@CBStartDate,@CBClose)"; SqlParameter[] sp = { new SqlParameter("@CBID", c.CBID), new SqlParameter("@TableID", c.TableID), new SqlParameter("@CBAmount", c.CBAmount), new SqlParameter("@CBStartDate", c.CBStartDate), new SqlParameter("@CBClose", c.CBClose) }; return(DBhelper.MyExecuteNonQuery(sql, sp)); }
private void button1_Click(object sender, EventArgs e) { if (txt_Count.Text.Trim().Length <= 0) { new Warning("人数不能为空", 图标.Erro).Show(); return; } try { #region 获取单号 string MaxCB = ConsumerBillBLL.GetMaxDT(); if (MaxCB == "") { MaxCB = "ZD" + DateTime.Now.ToString("yyyyMMdd") + "0000"; } int day = int.Parse(MaxCB.Substring(MaxCB.Length - 4, 4)) + 1; string dayCB = "ZD" + DateTime.Now.ToString("yyyyMMdd") + day.ToString().PadLeft(4, '0'); #endregion #region 开单消费 ConsumerBills c = new ConsumerBills(); c.CBID = dayCB; c.TableID = int.Parse(TableID); c.CBAmount = txt_Count.Text; c.CBStartDate = DateTime.Now.ToString(); c.CBClose = 0; //添加餐桌插入单号 if (ConsumerBillBLL.AddCB(c) > 0) { CBState.isTrue = true; //开单成功修改桌子状态 TablesBLL.UpdateTables(Convert.ToInt32(TableID), 1); if (checkBox1.Checked) { CBState.isCheknd = true; } this.Close(); } #endregion } catch (Exception) { MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static int UPCB(ConsumerBills c) { return(ConsumerBillDAL.UPCB(c)); }
public static int AddCB(ConsumerBills c) { return(ConsumerBillDAL.AddCB(c)); }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text.Length <= 0) { new Warning("结账失败,请输入金额", 图标.Erro).Show(); return; } try { if ((double.Parse(textBox2.Text) - (price * VGDiscount)) >= 0) { //获取数据 ConsumerBills c = new ConsumerBills(); c.CBID = label2.Text; c.VipID = textBox1.Text; c.CBDiscount = label17.Text; c.AdminID = admins.UserId; c.CBSale = double.Parse(label10.Text); //修改支付状态 if (ConsumerBillBLL.UPCB(c) > 0) { ZD.cg = 1; if (checkBox1.Checked) { FileStream fs = new FileStream(label2.Text + ".txt", FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.Default); string tt = "餐饮系统标题"; #region 获取发票抬头 FileStream fsr = new FileStream("配置文件.ini", FileMode.Open); StreamReader rd = new StreamReader(fsr, Encoding.Default); while (!rd.EndOfStream) { string r = rd.ReadLine(); string r1 = r.Split(':')[0]; switch (r1) { case "发票打印抬头": tt = r.Split(':')[1]; break; default: break; } } rd.Close(); fsr.Close(); #endregion sw.WriteLine("====" + tt + "===="); sw.WriteLine("订单号:" + label2.Text); sw.WriteLine("菜名\t数量\t价格"); sw.WriteLine("===\t===\t==="); if (dataGridView1.Rows.Count > 0) { foreach (DataGridViewRow item in dataGridView1.Rows) { sw.WriteLine(item.Cells[0].Value + "\t" + item.Cells[1].Value + "\t" + item.Cells[2].Value); } } else { sw.WriteLine("====无====="); } sw.WriteLine("================"); sw.WriteLine("实收金额:" + label10.Text); sw.WriteLine("会员优惠:" + label22.Text); sw.Close(); fs.Close(); System.Diagnostics.Process.Start(label2.Text + ".txt"); } this.Close(); } } else { new Warning("支付余额不足", 图标.Erro).Show(); } } catch (Exception) { MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }