예제 #1
0
    /// <summary>
    /// 绑定下拉框的数据
    /// </summary>
    public void refredatabind()
    {
        /*        绑定供应商        */
        //List<Provider> ps = new DAL.ProviderDAO().getAllProviders();
        //ListBox6.DataSource = ps;
        //ListBox6.DataTextField = "providerName";
        //ListBox6.DataValueField = "providerNum";
        //ListBox6.DataBind();
        //ListItem lt1 = new ListItem();
        //lt1.Value = "";
        //ListBox6.Items.Add(lt1);
        //ListBox6.SelectedValue = "";

        /*             绑定物品        */
        List <Goods> gs = new DAL.GoodsDAO().getAllGoods();

        //ListBox4.DataSource = cs;
        //ListBox4.DataTextField = "chestName";
        //ListBox4.DataValueField = "chestNum";
        //ListBox4.DataBind();

        DropDownList1.DataSource     = gs;
        DropDownList1.DataTextField  = "goodsname";
        DropDownList1.DataValueField = "goodsnum";
        DropDownList1.DataBind();
        ListItem lt2 = new ListItem();

        lt2.Value = "";
        DropDownList1.Items.Add(lt2);
        DropDownList1.SelectedValue = "";


        /*                绑定经办人           */
        //List<SysUser> sys = new DAL.SysUserDAO().getAllUsers();
        //ListBox5.DataSource = sys;
        //ListBox5.DataTextField = "userId";
        //ListBox5.DataValueField = "staffNum";
        //ListBox5.DataBind();
        //ListItem lt3 = new ListItem();
        //lt3.Value = "";
        //ListBox5.Items.Add(lt3);
        //ListBox5.SelectedValue = "";


        /*             绑定物品类别第一项        */
        List <GoodsType> gts = new DAL.GoodsTypeDAO().getParentGoodsTypes();

        ListBox1.DataSource     = gts;
        ListBox1.DataTextField  = "goodsTypeName";
        ListBox1.DataValueField = "goodsTypeNum";
        ListBox1.DataBind();
        ListItem lt4 = new ListItem();

        lt4.Value = "";
        ListBox1.Items.Add(lt4);
        ListBox1.SelectedValue = "";
    }
예제 #2
0
 protected void ListBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ListBox2.SelectedValue == "")
     {
         ListBox3.Items.Clear();
     }
     else
     {
         List <GoodsType> gts = new DAL.GoodsTypeDAO().getGoodsTypesByParentNum(ListBox2.SelectedValue.ToString());
         if (gts.Count > 0)
         {
             ListBox3.DataSource     = gts;
             ListBox3.DataTextField  = "goodsTypeName";
             ListBox3.DataValueField = "goodsTypeNum";
             ListBox3.DataBind();
             ListItem lt4 = new ListItem();
             lt4.Value = "";
             ListBox3.Items.Add(lt4);
             ListBox3.SelectedValue = "";
         }
     }
 }
예제 #3
0
    /// <summary>
    /// 绑定下拉框的数据
    /// </summary>
    public void refredatabind()
    {
        ListItem lt1 = new ListItem();

        lt1.Value = "";
        /*        绑定供应商        */
        List <Provider> ps = new DAL.ProviderDAO().getAllProviders();

        ListBox6.DataSource     = ps;
        ListBox6.DataTextField  = "providerName";
        ListBox6.DataValueField = "providerNum";
        ListBox6.DataBind();

        ListBox6.Items.Add(lt1);
        ListBox6.SelectedValue = "";

        /*             绑定库柜        */
        List <Chest> cs = new DAL.ChestDAO().getAllChests();

        ListBox4.DataSource     = cs;
        ListBox4.DataTextField  = "chestName";
        ListBox4.DataValueField = "chestNum";
        ListBox4.DataBind();

        ListBox4.Items.Add(lt1);
        ListBox4.SelectedValue = "";

        /*                绑定经办人           */
        List <SysUser> sys = new DAL.SysUserDAO().getAllUsers();

        ListBox5.DataSource     = sys;
        ListBox5.DataTextField  = "userId";
        ListBox5.DataValueField = "staffnum";
        ListBox5.DataBind();

        ListBox5.Items.Add(lt1);
        ListBox5.SelectedValue = "";


        /*             绑定物品类别第一项        */
        List <GoodsType> gts = new DAL.GoodsTypeDAO().getParentGoodsTypes();

        ListBox1.DataSource     = gts;
        ListBox1.DataTextField  = "goodsTypeName";
        ListBox1.DataValueField = "goodsTypeNum";
        ListBox1.DataBind();

        ListBox1.Items.Add(lt1);
        ListBox1.SelectedValue = "";


        /*            绑定gridview数据源            */
        BoundField bf1 = new BoundField(); bf1.HeaderText = "序号";
        BoundField bf2 = new BoundField(); bf2.DataField = "inID"; bf2.HeaderText = "编号";
        BoundField bf3 = new BoundField(); bf3.DataField = "goods.goodsName"; bf3.HeaderText = "物品名称";
        BoundField bf4 = new BoundField(); bf4.DataField = "goods.goodsType.goodsTypeName"; bf4.HeaderText = "物品类别";
        BoundField bf5 = new BoundField(); bf5.DataField = "position.positionNum"; bf5.HeaderText = "库位编号";
        BoundField bf6 = new BoundField(); bf6.DataField = "date"; bf6.HeaderText = "入库时间";
        BoundField bf7 = new BoundField(); bf7.DataField = "inAmount"; bf7.HeaderText = "入库量";
        BoundField bf8 = new BoundField(); bf8.DataField = "batch.provider.providername"; bf8.HeaderText = "供应商";
        BoundField bf9 = new BoundField(); bf9.DataField = "sysuser.staff.staffname"; bf9.HeaderText = "经办人";

        GridView1.Columns.Add(bf1);
        GridView1.Columns.Add(bf2);
        GridView1.Columns.Add(bf3);
        GridView1.Columns.Add(bf4);
        GridView1.Columns.Add(bf5);
        GridView1.Columns.Add(bf6);
        GridView1.Columns.Add(bf7);
        GridView1.Columns.Add(bf8);
        GridView1.Columns.Add(bf9);

        BoundField bf11 = new BoundField(); bf11.HeaderText = "序号";
        BoundField bf12 = new BoundField(); bf12.DataField = "ouID"; bf12.HeaderText = "编号";
        BoundField bf13 = new BoundField(); bf13.DataField = "goods.goodsName"; bf13.HeaderText = "物品名称";
        BoundField bf14 = new BoundField(); bf14.DataField = "goods.goodsType.goodsTypeName"; bf14.HeaderText = "物品类别";
        BoundField bf15 = new BoundField(); bf15.DataField = "position.positionNum"; bf15.HeaderText = "库位编号";
        BoundField bf16 = new BoundField(); bf16.DataField = "date"; bf16.HeaderText = "出库时间";
        BoundField bf17 = new BoundField(); bf17.DataField = "outAmount"; bf17.HeaderText = "出库量";
        BoundField bf18 = new BoundField(); bf18.DataField = "batch.receiver.receivername"; bf18.HeaderText = "收货商";
        BoundField bf19 = new BoundField(); bf19.DataField = "sysuser.staff.staffname"; bf19.HeaderText = "经办人";

        GridView2.Columns.Add(bf11);
        GridView2.Columns.Add(bf12);
        GridView2.Columns.Add(bf13);
        GridView2.Columns.Add(bf14);
        GridView2.Columns.Add(bf15);
        GridView2.Columns.Add(bf16);
        GridView2.Columns.Add(bf17);
        GridView2.Columns.Add(bf18);
        GridView2.Columns.Add(bf19);
    }