private void InitData(string orderId)
        {
            PostCardCollectionApi.GetAllEnvelopeByOrderId(orderId, envelopeList =>
            {
                var envelopeInfos = new List <EnvelopeInfo>();

                envelopeList.ForEach(tmpEnvelope =>
                {
                    var envelope = tmpEnvelope.TranslateToEnvelope();
                    envelopeInfos.Add(envelope);
                    if (envelopeInfos.Count == 1)
                    {
                        postCardControl.DataSource = envelope.PostCards;
                    }

                    PostCardItemApi.GetPostCardByEnvelopeId(envelope.Id, postCards =>
                    {
                        if (postCards == null)
                        {
                            return;
                        }
                        //遍历明信片,对明信片进行Node绑定
                        foreach (var postCard1 in postCards)
                        {
                            var tmpPostCard = postCard1.TranlateToPostCard();
                            envelope.PostCards.Add(tmpPostCard);
                            tmpPostCard.ProductSize = envelope.ProductSize;
                        }

                        postCardControl.RefreshDataSource();
                    }, message => { XtraMessageBox.Show(message); });
                });
                envelopeListControl.DataSource = envelopeInfos;
            }, kk => { XtraMessageBox.Show(kk); });
        }
Exemplo n.º 2
0
        private void SimpleButton1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(_orderId))
            {
                XtraMessageBox.Show("订单为空,无法生成订单PDF");
            }

            PostCardCollectionApi.GetAllEnvelopeByOrderId(_orderId, result =>
            {
                // 处理每一个集合
                foreach (var envelopeResponse in result)
                {
                    //_fileInfoList.Add(envelopeResponse.GeneratePdfByteArray(message =>
                    //{
                    //    XtraMessageBox.Show(message);
                    //}));
                }
            }, failure: message => { XtraMessageBox.Show(message); });
        }