private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count == 0)
            {
                MessageBox.Show("请先完善销售单!");
                return;
            }
            if (tbCustomer.TextLength == 0)
            {
                MessageBox.Show("请选择客户!");
                return;
            }
            if (cbPayment.Text.Length == 0)
            {
                MessageBox.Show("请选择支付方式!");
                return;
            }
            DataBaseOperationDLL db = new DataBaseOperationDLL();
            string dateTime         = dateTimePicker1.Text + " " + dateTimePicker1.Value.ToShortTimeString();
            int    paymentId        = db.GetPaymentId(cbPayment.Text);//获取员工编号
            int    chack            = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                chack += db.InsertSaleTable(lbSaleNumber.Text,
                                            int.Parse(row.Cells[9].Value.ToString()),
                                            float.Parse(row.Cells[4].Value.ToString()),
                                            double.Parse(row.Cells[6].Value.ToString()),
                                            InfoShareDLL.staffId,
                                            customerID,
                                            dateTime,
                                            paymentId,
                                            row.Cells["note"].Value.ToString()
                                            );
            }
            if (chack == dataGridView1.Rows.Count)
            {
                MessageBox.Show("开单成功!");
                form.Visible = true;
                this.Close();
                return;
            }
            MessageBox.Show("开单失败!");
        }
        private void btSave_Click(object sender, EventArgs e)
        {
            if (cbPayment.Text.Length == 0)
            {
                MessageBox.Show("请选择支付方式!");
                return;
            }
            if (dataGridView1.Rows.Count < 1)
            {
                MessageBox.Show("请先保存修改!");
                return;
            }
            string dateTime  = dateTimePicker1.Text + " " + dateTimePicker1.Value.ToShortTimeString();
            int    paymentId = db.GetPaymentId(cbPayment.Text);//获取支付编号
            int    chack     = 0;
            int    delete    = db.DeleteSalesData(lbSaleNumber.Text);

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                chack += db.InsertSaleTable(lbSaleNumber.Text,
                                            int.Parse(row.Cells["product_id"].Value.ToString()),
                                            float.Parse(row.Cells["count"].Value.ToString()),
                                            double.Parse(row.Cells["unitPrice"].Value.ToString()),
                                            int.Parse(salesRow.Cells["staffId"].Value.ToString()),
                                            int.Parse(row.Cells["customer_Id"].Value.ToString()),
                                            dateTime,
                                            paymentId,
                                            row.Cells["note"].Value.ToString());
            }
            if (chack == delete && chack == dataGridView1.Rows.Count)
            {
                MessageBox.Show("保存成功!");
                return;
            }
            MessageBox.Show("保存失败!");
        }