Пример #1
0
        private void GetData()
        {
            m_Offers   = CrossDataHelper.LoadTestOffers();
            m_Requests = CrossDataHelper.LoadTestPurchseRequest();
            GetColumsVisibility();

            m_OfferHeaders = new List <OfferHeader>();
            List <CustomOffers> coList = new List <CustomOffers>();
            int offerID = 1;

            foreach (var grByTitle in m_Offers.offers.GroupBy(x => x.Title).OrderBy(x => x.Key))
            {
                Offers      offer = grByTitle.First();
                OfferHeader oh    = new OfferHeader();
                oh.HeaderNumber = offerID;
                oh.Row1         = offer.Title;
                oh.Row2         = offer.PaymentType + " " + offer.DelayDays + " дн.";
                oh.Row3         = offer.DeliveryType + " " + offer.Area;
                m_OfferHeaders.Add(oh);

                foreach (Offers o in grByTitle)
                {
                    CustomOffers co = new CustomOffers();
                    co.InitialOffer = o;
                    co.Number       = offerID;
                    coList.Add(co);
                }
                offerID++;
            }

            m_CustomRequests = new List <CustomRequests>();
            foreach (Requests rd in m_Requests.requests)
            {
                CustomRequests cr = new CustomRequests();
                var            offersByRequest = coList.Where(x => x.InitialOffer.variants.Any(y => y.requestId.Equals(rd.ID)));

                List <CustomOffers> ncoList = new List <CustomOffers>();
                foreach (CustomOffers co in offersByRequest)
                {
                    CustomOffers nco = new CustomOffers();
                    nco.InitialOffer = co.InitialOffer;
                    nco.Number       = co.Number;
                    nco.Variants     = co.InitialOffer.variants.Where(y => y.requestId.Equals(rd.ID)).ToList();
                    ncoList.Add(nco);
                }
                cr.InitialOffers.AddRange(ncoList);
                cr.InitialRequest = rd;
                m_CustomRequests.Add(cr);
            }
        }
Пример #2
0
 /// <summary>
 /// Обновление информации в источнике данных
 /// </summary>
 /// <param name="offers">Отредактированные Offers</param>
 /// <param name="requests">Отредактированные Requests</param>
 private void SetData(OffersData offers, RequestsData requests)
 {
 }