示例#1
0
        /// <summary>
        /// Insert new record on Order tabel
        /// </summary>
        /// <param name="pMemberID">String</param>
        /// <param name="pAmount">Decimal</param>
        /// <param name="pDescription">String</param>
        /// <param name="pRemarks">Remarks</param>
        /// <returns></returns>
        public static bool Add(string pOrderId,string pMemberID, decimal pAmount, string pDescription, string pRemarks, DateTime pOrderDate, bool pIsDelivered, bool pIsPaid, DateTime? pDeliveredDate,DateTime? pPaidDate)
        {
            using (NetworkEntities context = new NetworkEntities())
            {
                Order objOder = new Order();
                objOder.OrderID = pOrderId;
                objOder.MembershipID = pMemberID;
                objOder.OrderDate = Convert.ToDateTime(pOrderDate);
                objOder.Amount = pAmount;
                objOder.IsDelivered = false;
                objOder.Description = pDescription;
                objOder.Remarks = pRemarks;
                objOder.IsDelivered = pIsDelivered;
                objOder.DeliveredDate = pDeliveredDate;
                objOder.IsPaid = pIsPaid;
                objOder.PaidDate = pPaidDate;

                context.Orders.AddObject(objOder);
                int status = context.SaveChanges();
                return true;
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrders(Order order)
 {
     base.AddObject("Orders", order);
 }
 /// <summary>
 /// Create a new Order object.
 /// </summary>
 /// <param name="orderID">Initial value of the OrderID property.</param>
 /// <param name="membershipID">Initial value of the MembershipID property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="amount">Initial value of the Amount property.</param>
 /// <param name="orderDate">Initial value of the OrderDate property.</param>
 public static Order CreateOrder(global::System.String orderID, global::System.String membershipID, global::System.String description, global::System.Decimal amount, global::System.DateTime orderDate)
 {
     Order order = new Order();
     order.OrderID = orderID;
     order.MembershipID = membershipID;
     order.Description = description;
     order.Amount = amount;
     order.OrderDate = orderDate;
     return order;
 }