/// <summary> /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToOrderDetails(OrderDetail orderDetail) { base.AddObject("OrderDetails", orderDetail); }
private static XmlElement GetSpecialItemRow(XmlElement rowTemplate, OrderDetail orderItem) { XmlElement newRow = (XmlElement)rowTemplate.CloneNode(true); newRow.RemoveAttribute("Name"); var tableCells = newRow.GetElementsByTagName("TableCell"); foreach (XmlElement cell in tableCells) { var node = cell.FirstChild; if (cell.FirstChild == null) node = cell; node.InnerText = node.InnerText.Replace("@Barcode", orderItem.Barcode); node.InnerText = node.InnerText.Replace("@ItemName", orderItem.ItemName); node.InnerText = node.InnerText.Replace("@Price", orderItem.Price.ToString("N0")); node.InnerText = node.InnerText.Replace("@MRP", orderItem.MRP.ToString("N0")); node.InnerText = node.InnerText.Replace("@Discount", orderItem.Discount.ToString("P")); node.InnerText = node.InnerText.Replace("@Quantity", orderItem.Quantity.ToString("N0")); node.InnerText = node.InnerText.Replace("@Amount", orderItem.LineTotal.ToString("N0")); } return newRow; }
/// <summary> /// Create a new OrderDetail object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="mRP">Initial value of the MRP property.</param> /// <param name="price">Initial value of the Price property.</param> /// <param name="quantity">Initial value of the Quantity property.</param> /// <param name="discount">Initial value of the Discount property.</param> /// <param name="orderId">Initial value of the OrderId property.</param> public static OrderDetail CreateOrderDetail(global::System.Guid id, global::System.Double mRP, global::System.Double price, global::System.Double quantity, global::System.Double discount, global::System.Guid orderId) { OrderDetail orderDetail = new OrderDetail(); orderDetail.Id = id; orderDetail.MRP = mRP; orderDetail.Price = price; orderDetail.Quantity = quantity; orderDetail.Discount = discount; orderDetail.OrderId = orderId; return orderDetail; }
private static XmlElement GetItemRow(XmlElement rowTemplate, OrderDetail orderItem) { XmlElement newRow = (XmlElement)rowTemplate.CloneNode(true); newRow.RemoveAttribute("Name"); var tableCells = newRow.GetElementsByTagName("TableCell"); foreach (XmlElement cell in tableCells) { if (cell.HasAttribute("Name")) { switch (cell.Attributes["Name"].Value.ToString()) { case "Barcode": cell.FirstChild.InnerText = orderItem.Barcode; break; case "ItemName": cell.FirstChild.InnerText = orderItem.ItemName; break; case "MRP": cell.FirstChild.InnerText = orderItem.MRP.ToString("F2"); break; case "Price": cell.FirstChild.InnerText = orderItem.Price.ToString("F2"); break; case "Quantity": cell.FirstChild.InnerText = orderItem.Quantity.ToString("N0"); break; case "Discount": cell.FirstChild.InnerText = orderItem.Discount.ToString("P"); break; case "Amount": cell.FirstChild.InnerText = orderItem.LineTotal.ToString("F2"); break; } cell.RemoveAttribute("Name"); } } return newRow; }