示例#1
0
        private void formCGAdd_Load(object sender, EventArgs e)
        {
            //下拉菜单
            this.comboBoxformCGGYS.Items.Add("全部");
            string        sql = "select distinct GYS from GYSAllFood";
            SqlDataReader dr  = db.DB_Red(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.comboBoxformCGGYS.Items.Add(dr[0].ToString());
                    this.comboBoxformCGGYS.SelectedIndex = 0;
                }
                dr.Close();
            }
            //表格
            this.dataGridViewformCG.AutoGenerateColumns = false;
            string         sql1 = "select * from GYSAllFood";
            SqlDataAdapter da   = db.DB_Adp(sql1);
            DataTable      dt   = new DataTable();

            da.Fill(dt);
            this.dataGridViewformCG.DataSource = dt;
            this.dataGridViewformCG.Columns[1].DataPropertyName = dt.Columns["GYS"].ToString();
            this.dataGridViewformCG.Columns[2].DataPropertyName = dt.Columns["GYSFoodName"].ToString();
            this.dataGridViewformCG.Columns[3].DataPropertyName = dt.Columns["GYSFoodType"].ToString();
            this.dataGridViewformCG.Columns[4].DataPropertyName = dt.Columns["GYSDM"].ToString();
            this.dataGridViewformCG.Columns[5].DataPropertyName = dt.Columns["GYSDiscountL"].ToString();
            this.dataGridViewformCG.Columns[6].DataPropertyName = dt.Columns["GYSQuantity"].ToString();
            this.dataGridViewformCG.Columns[7].DataPropertyName = dt.Columns["GYSText"].ToString();
            this.dataGridViewformCG.Columns[8].DataPropertyName = "";
        }
示例#2
0
        private void mainWindow1_Load(object sender, EventArgs e)
        {
            //formCGAdd frmcgadd = new formCGAdd();
            //frmcgadd.biaoge += new formCGAdd.caigou(mainWindow1.biaoge);

            this.mainWindow1.tabControlMainWindow.TabPages.Clear();
            this.mainWindow1.tabPageDataAll.Parent = mainWindow1.tabControlMainWindow;

            //我的仓库*********************************************************************************************************************
            //商品类型下拉单
            this.mainWindow1.tbKCXSJG.ReadOnly = true;
            this.mainWindow1.comboBoxKCFoodType.Items.Add("全部");
            string        sqlcgsplx = "select distinct KCFoodType from KC";
            SqlDataReader dr        = db.DB_Red(sqlcgsplx);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.mainWindow1.comboBoxKCFoodType.Items.Add(dr[0].ToString());
                    this.mainWindow1.comboBoxKCFoodType.SelectedIndex = 0;
                }
            }
            dr.Close();
            this.mainWindow1.dataGridViewCG.AutoGenerateColumns = false;
            string         sql1 = "select * from KC";
            SqlDataAdapter da   = db.DB_Adp(sql1);
            DataTable      dt   = new DataTable();

            da.Fill(dt);
            this.mainWindow1.dataGridViewKC.AutoGenerateColumns         = false;
            this.mainWindow1.dataGridViewKC.DataSource                  = dt;
            this.mainWindow1.dataGridViewKC.Columns[0].DataPropertyName = dt.Columns["KCGYS"].ToString();
            this.mainWindow1.dataGridViewKC.Columns[1].DataPropertyName = dt.Columns["KCFoodName"].ToString();
            this.mainWindow1.dataGridViewKC.Columns[2].DataPropertyName = dt.Columns["KCFoodType"].ToString();
            this.mainWindow1.dataGridViewKC.Columns[3].DataPropertyName = dt.Columns["KCBM"].ToString();
            this.mainWindow1.dataGridViewKC.Columns[4].DataPropertyName = dt.Columns["KCSJ"].ToString();
            this.mainWindow1.dataGridViewKC.Columns[5].DataPropertyName = dt.Columns["KCQuantity"].ToString();

            this.mainWindow1.tabControlMainWindow.DrawMode   = TabDrawMode.OwnerDrawFixed;
            this.mainWindow1.tabControlMainWindow.Padding    = new System.Drawing.Point(Width_SIZE, Height_SIZE);
            this.mainWindow1.tabControlMainWindow.DrawItem  += new DrawItemEventHandler(tabControlMainWindow_DrawItem);
            this.mainWindow1.tabControlMainWindow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControlMainWindow_MouseDown);
        }