Пример #1
0
        public bool UpdateInvoiceOrderStatus(Model.ShopCart.Order.OrderInfo.Result lastOrderInfo, int invoiceId, bool finished, int orderId, bool complete, bool teamPayStatus)
        {
            try
            {
                var invoiceRepository = UnitOfWork.GetRepository <InvoiceRepository>();

                invoiceRepository.UpdateInvoiceStatus(invoiceId, finished);

                var orderRepository = UnitOfWork.GetRepository <OrderRepository>();

                orderRepository.UpdateOrderStatus(lastOrderInfo.Order.Received, lastOrderInfo.Order.Tx, orderId, complete);

                var invoiceDetailRepository = UnitOfWork.GetRepository <InvoiceDetailRepository>();

                var invoiceDetailList = invoiceDetailRepository.GetInvoiceDetailByInvoiceId(invoiceId);

                var teamIdList = invoiceDetailList.Select(i => i.TeamId).ToArray <int>();

                var teamRepository = UnitOfWork.GetRepository <TeamRepository>();

                teamRepository.UpdatePayStatus(teamIdList, teamPayStatus);

                return(UnitOfWork.Commit());
            }
            catch
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// url = /service/[shopid]/orders/[orderid]
        /// </summary>
        /// <returns></returns>
        public Model.ShopCart.Order.OrderInfo.Result GetOrderInfo(int orderId)
        {
            var orderInfo = new Model.ShopCart.Order.OrderInfo.Result();

            try
            {
                var url      = BaseServiceUrl + "orders/" + orderId + "?key=" + ServiceKey;
                var response = client.GetAsync(url).Result;

                if (response.IsSuccessStatusCode)
                {
                    var ser = new XmlSerializer(typeof(Model.ShopCart.Order.OrderInfo.Result));
                    orderInfo = (Model.ShopCart.Order.OrderInfo.Result)ser.Deserialize(response.Content.ReadAsStreamAsync().Result);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(orderInfo);
        }