Пример #1
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string        name = textBox1.Text;
            ProductsModel pm   = new ProductsModel();

            pm.ProductJP1 = name;
            for (int i = 0; i < tv.Nodes.Count; i++)
            {
                if (tv.Nodes[i].Name.Contains(name))
                {
                    tv.Nodes[i].ImageIndex = 1;
                }
            }
            if (tabControl1.TabPages[0].Text == "项目清单")
            {
                DataTable dt = ConsumerBillBLL.getTableSS(pm);
                dataGridView1.DataSource = dt;
            }
            if (tabControl1.TabPages[1].Text == "项目列表")
            {
                tv.Nodes.Clear();
                //列表
                DataTable dt2 = ConsumerBillBLL.getTableLB();
                for (int i = 0; i < dt2.Rows.Count; i++)
                {
                    TreeNode root = new TreeNode(dt2.Rows[i]["PTName"].ToString());
                    root.Name       = dt2.Rows[i]["PTName"].ToString();
                    root.ImageIndex = 1;
                    tv.Nodes.Add(root);
                    ProductTypeModel ptype = new ProductTypeModel();
                    ptype.PTName1 = dt2.Rows[i]["PTName"].ToString();
                    DataTable dt3 = ConsumerBillBLL.getTableSSLB(ptype, pm);
                    for (int j = 0; j < dt3.Rows.Count; j++)
                    {
                        TreeNode node = new TreeNode(dt3.Rows[j]["项目名称"].ToString());
                        node.Name = dt3.Rows[j]["项目名称"].ToString();
                        root.Nodes.Add(node);
                    }
                }
                //tabPage2.Controls.Add(tv2);
            }
        }
Пример #2
0
        private void AddForm_Load(object sender, EventArgs e)
        {
            //标题
            this.Text = "增加消费";
            //桌号
            lblNo.Text = tables.TableName1;
            //背景
            dataGridView1.BackgroundColor = Color.White;
            //禁止添加
            dataGridView1.AllowUserToAddRows = false;
            //禁止调整列
            dataGridView1.AllowUserToResizeColumns = false;
            //禁止调整行
            dataGridView1.AllowUserToResizeRows = false;
            //取消头列
            dataGridView1.RowHeadersVisible = false;
            //禁止多选
            dataGridView1.MultiSelect = false;
            //加载数据
            DataTable dt = ConsumerBillBLL.getTableZD();

            dataGridView1.DataSource         = dt;
            dataGridView1.Columns[0].Visible = false;
            //禁止编辑
            dataGridView1.ReadOnly = true;
            //选中突出
            listView1.FullRowSelect = true;

            tv           = new TreeView();
            tv.Dock      = DockStyle.Fill;
            tv.ImageList = imageList1;
            //列表
            DataTable dt2 = ConsumerBillBLL.getTableLB();

            for (int i = 0; i < dt2.Rows.Count; i++)
            {
                TreeNode root = new TreeNode(dt2.Rows[i]["PTName"].ToString());
                root.Name       = dt2.Rows[i]["PTName"].ToString();
                root.ImageIndex = 0;
                tv.Nodes.Add(root);
                ProductTypeModel ptype = new ProductTypeModel();
                ptype.PTName1 = dt2.Rows[i]["PTName"].ToString();
                DataTable dt3 = ConsumerBillBLL.getTableLB(ptype);
                for (int j = 0; j < dt3.Rows.Count; j++)
                {
                    TreeNode node = new TreeNode(dt3.Rows[j]["项目名称"].ToString());
                    node.Name       = dt3.Rows[j]["项目名称"].ToString();
                    node.ImageIndex = 1;
                    root.Nodes.Add(node);
                }
            }

            tabPage2.Controls.Add(tv);

            //数量
            txtCount.Text = "1";
            //加载消费列表
            DataTable dt4 = ConsumerDetailsBLL.getTableXF(tables.TableID1);

            for (int i = 0; i < dt4.Rows.Count; i++)
            {
                ListViewItem lvi = new ListViewItem(dt4.Rows[i]["商品编号"].ToString());
                lvi.SubItems.Add(dt4.Rows[i]["单价"].ToString());
                lvi.SubItems.Add(dt4.Rows[i]["数量"].ToString());
                lvi.SubItems.Add(dt4.Rows[i]["金额"].ToString());
                lvi.SubItems.Add(dt4.Rows[i]["点单时间"].ToString());
                lvi.SubItems.Add(dt4.Rows[i]["项目类别"].ToString());
                lvi.SubItems.Add(dt4.Rows[i]["CDID"].ToString());
                listView1.Items.Add(lvi);
            }
            //金额和数量
            getMoneyANDCount();
            //最后隐藏
            listView1.Columns[6].Width = 0;
        }