Example #1
0
    public void BindGv()
    {
        if (!string.IsNullOrEmpty(base.Request["id"].ToString()))
        {
            string strWhere = "AND r.ResourceId IN ( select CID from Res_ResourceRelation where FID='" + base.Request["id"].ToString() + "')";
            //string strWhere = " AND r.ResourceId IN ('067ef1eb-3386-4a00-8133-d33154337057','0842da52-2cf1-40ba-86e4-058a1e8fc16d')";
            cn.justwin.BLL.Resource resource = new cn.justwin.BLL.Resource();
            DataTable table = resource.Query(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, strWhere, "");//string condition, string priceTypeCondition);
            System.Collections.Generic.IList <PriceType> priceTypes = PriceType.GetPriceTypes(base.UserCode);
            if (this.gvResource.Columns.Count < 14 + priceTypes.Count)
            {
                int num = 9;
                foreach (PriceType current in priceTypes)
                {
                    BoundField boundField = new BoundField();
                    boundField.DataField  = current.PriceTypeName;
                    boundField.HeaderText = current.PriceTypeName;
                    this.gvResource.Columns.Insert(num++, boundField);
                }
            }
            //table.Columns.Remove("采购价");
            //table.Columns.Remove("目标成本价");
            //table.Columns.Remove("最后采购价");

            table.Columns.Add("NUM");
            foreach (DataRow dr in table.Rows)
            {
                DataTable dt = publicDbOpClass.DataTableQuary("select NUM from Res_ResourceRelation where CID ='" + dr["ResourceId"].ToString() + "' and FID='" + base.Request["id"].ToString() + "'");
                if (dt.Rows.Count == 1)
                {
                    dr["NUM"] = dt.Rows[0]["NUM"];
                }
                else
                {
                    dr["NUM"] = "0";
                }
            }
            this.gvResource.DataSource = table;
            this.gvResource.DataBind();
        }
        else
        {
            this.gvResource.DataSource = null;
            this.gvResource.DataBind();
        }
    }
Example #2
0
    public void BindGv()
    {
        DataTable table = this.GetTable();

        System.Collections.Generic.IList <PriceType> priceTypes = PriceType.GetPriceTypes(base.UserCode);
        if (this.gvResource.Columns.Count < 14 + priceTypes.Count)
        {
            int num = 9;
            foreach (PriceType current in priceTypes)
            {
                BoundField boundField = new BoundField();
                boundField.DataField  = current.PriceTypeName;
                boundField.HeaderText = current.PriceTypeName;
                this.gvResource.Columns.Insert(num++, boundField);
            }
        }
        this.gvResource.DataSource = table;
        this.gvResource.DataBind();
    }
    public void BindGv()
    {
        this.resTypeId = base.Request.QueryString["id"];
        this.AspNetPager1.RecordCount = this.GetCount();
        DataTable table = this.GetTable();

        System.Collections.Generic.IList <PriceType> priceTypes = PriceType.GetPriceTypes(base.UserCode);
        if (this.gvResource.Columns.Count < 14 + priceTypes.Count)
        {
            int num = 9;
            foreach (PriceType current in priceTypes)
            {
                BoundField boundField = new BoundField();
                boundField.DataField  = current.PriceTypeName;
                boundField.HeaderText = current.PriceTypeName;
                this.gvResource.Columns.Insert(num++, boundField);
            }
        }
        this.gvResource.DataSource = table;
        this.gvResource.DataBind();
    }
 private void BindDropPriceType()
 {
     this.dropPriceType.DataSource = PriceType.GetPriceTypes();
     this.dropPriceType.DataBind();
     this.dropPriceType.Items.Insert(0, new ListItem("", ""));
 }