>> >>public OrderDetailEntity ShowOrderDetailLine(int detailPK) >>{ >> OrderDetailEntity orderDetailEntity; >> this.GetEntity("SELECT * FROM OrderDetail WHERE ProductID = @ProductID", >> this.CreateParameter("@ProductID", detailPK)); >> >> // to display locally which I don't recommend, I think you should pass it back to the UI to display it regardless of how >> // you could just refer to the this.Entity.fieldNames here >> >> // then pass back the entity >> return orderDetailEntity; >>} >> >> >>In the button click above I would display the entity once it is returned back >>I had this in there >>oOrderDetail.ShowOrderDetailLine(pkVal); >> >>Just add this: >>Debug.WriteLine("ProductID is: " + oOrderDetail.Entity.ProductID.ToString() + "Product Name is: " + oOrderDetail.Entity.Name etc...); >> >>>>
> public void ShowProduct(int orderPK, int productID) > { > OrderDetailEntity ode; > ode = GetEntity("OrderDetailsSelectByPK", > this.CreateParameter("@OrderID", orderPK),this.CreateParameter("@ProductID", productID)); > > Console.WriteLine("in orderdetail.partial: OrderID is " + ode.OrderID.ToString() + " ProductID is: " + ode.ProductID.ToString() + " qty is: " + ode.Quantity); > } > >>
// In my form I have this: protected DisplayItems oItems; protected DataSet dsNews; protected DataSet dsEvents; // Get News Items this.dsNews = this.oItems.GetItemsDataSetByType(DisplayItemType.News, false, "News"); if (this.dsNews.Tables[0].Rows.Count > 0) { this.grdNews.DataSource = dsNews; this.grdNews.DataBind(); } else this.lblNews.Visible = false; // Get Event Items this.dsEvents = this.oItems.GetItemsDataSetByType(DisplayItemType.Events, false, "Events"); if (this.dsEvents.Tables[0].Rows.Count > 0) { this.grdEvents.DataSource = dsEvents; this.grdEvents.DataBind(); } else this.lblEvents.Visible = false; // In my business object I have this: public DataSet GetItemsDataSetByType(DisplayItemType itemType, bool isPrivate, string tableName) { // 1-18-2008 Adding a check for expire date DateTime rightNow = DateTime.Now; return this.GetDataSet("SELECT * FROM DisplayItems WHERE ItemType = @Type AND MarkPrivate = @Private AND @RightNow > BeginDate AND @RightNow < ExpireDate ORDER BY DateOfItem DESC", tableName, this.CreateParameter("@Type", itemType), this.CreateParameter("@Private", isPrivate), this.CreateParameter("@RightNow", rightNow)); }Now I wouldn't necessarily do my code the same as above today, but using it as an example.