コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {

                busPurchaseOrder busPurchase = new busPurchaseOrder();
                FrameWork.PurchaseOrders[] frmDRSI;

                frmDRSI = busPurchase.allPO();
                GridView1.DataSource = frmDRSI;
                GridView1.DataBind();

            }
        }
コード例 #2
0
        protected void drpSupplier_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable dt = (DataTable)ViewState["Supplier"];
            DataRow[] foundRows;
            string selectValue = "ID = " + this.drpSupplier.SelectedValue;
            string sortOrder = "ID ASC";
            foundRows = dt.Select(selectValue, sortOrder);
            for (int i = 0; i < foundRows.Length; i++)
                Console.WriteLine(foundRows[i][2]);
            if (foundRows != null)
            {
                this.lblAddress.Text = foundRows[0]["Address"].ToString();
                this.lblTin.Text = foundRows[0]["TIN"].ToString();
                //this.lblEmail.Text = foundRows[0]["EmailAddress"].ToString();
                this.lbltel.Text = foundRows[0]["BusinessPhone"].ToString();
                FrameWork.PurchaseOrders[] dt1;
                busPurchaseOrder buspurchase = new busPurchaseOrder();
                this.drpPurchase.Items.Clear();
                this.drpPurchase.Items.Add(new ListItem("select one", "0"));
                dt1 = buspurchase.allPO();

                 var x = dt1.Where(a => a.SupplierID == int.Parse(this.drpSupplier.SelectedValue)).Select(a=> a.ID);
                 foreach (var dec in x)
                 {
                     this.drpPurchase.Items.Add(new ListItem(dec.ToString(), dec.ToString()));
                 }
            }
        }