/// <summary>
        /// 删除收货地址
        /// </summary>
        /// <param name="id">地址ID</param>
        public void DeleteDeliveryAddressExt(System.Guid id)
        {
            ContextSession  contextSession  = ContextFactory.CurrentThreadContext;
            DeliveryAddress deliveryAddress = DeliveryAddress.ObjectSet().Where(n => n.Id == id).FirstOrDefault();

            if (!string.IsNullOrEmpty(deliveryAddress.ToString()))
            {
                contextSession.Delete(deliveryAddress);
            }
            contextSession.SaveChange();
        }
Beispiel #2
0
        public override string ToString()
        {
            string info = $"\r\n +++ Order ID: {OrderId} +++       \r\nCustomer: {Customer.Name}\r\nTime Order: {TimeOrder}\r\nOrder Type: {OrderType}\r\nDelivery Address: {DeliveryAddress.ToString()}";

            if (delivered == true)
            {
                info += $"\r\nDelivery Time: {DeliveryTime}\r\nItems: \r\n";
            }
            else
            {
                info += "\r\nNot delivered\r\nItems: \r\n";
            }
            for (int i = 0; i < Items.Count; i++)
            {
                if (Items[i] != null)
                {
                    info += "   " + Items[i].GetInfo() + "\r\n";
                }
            }
            info += $"\r\nTotal Cost: {Cost:C}\r\n\n" + "\r\n++++++++++++++++++++++++++++++++++++\r\n";
            return(info);
        }