public static ContractOfBill SplitWholeContractToSeparatedMainParts(this List <string> theWholeContract, string[] parsers)
        {
            HeaderOfContractOfBill       header               = null;
            ServicesOfBill               services             = null;
            DetalizationOfContractOfBill billDetalizationList = null;

            List <string> partOfContract = new List <string>();

            if (theWholeContract?.Count > 0)
            {
                foreach (var row in theWholeContract)
                {
                    partOfContract.Add(row);

                    if (row.StartsWith(parsers[1])) // Start Header // "Контракт №"
                    {
                        partOfContract = new List <string>();
                        partOfContract.Add(row);
                    }
                    else if (row.StartsWith(parsers[3])) // Stop Header // "Ціновий Пакет" or "Тарифний Пакет"
                    {
                        header = new HeaderOfContractOfBill(partOfContract.ParseHeaderOfContractOfBill(parsers));

                        partOfContract = new List <string>(); //start part of Services
                    }
                    else if (row.StartsWith(parsers[7]))      // Stop Services // @"ЗАГАЛОМ ЗА КОНТРАКТОМ (БЕЗ ПДВ ТА ПФ)"
                    {
                        services = new ServicesOfBill(partOfContract.ParseServicesOfBill());

                        partOfContract = new List <string>(); //start part of Detalization
                    }
                }

                billDetalizationList = new DetalizationOfContractOfBill(partOfContract.ParseDetalizationOfContractOfBill());
            }
            if (!(header?.ContractId?.Length > 0))
            {
                return(null);
            }

            return(new ContractOfBill(header, services, billDetalizationList));  //contractOfBill;
        }
        /// <summary>
        /// Return new DetalizationOfContractOfBill which contained parsed detalization
        /// </summary>
        /// <param name="contractOfBill"></param>
        /// <param name="parsers"></param>
        /// <returns></returns>
        public static DetalizationOfContractOfBill ParseDetalizationOfContractOfBill(this List <string> list)
        {
            if (list == null || !(list?.Count > 0))
            {
                return(new DetalizationOfContractOfBill());
            }

            List <StringOfDetalizationOfContractOfBill> detalizationStrings = new List <StringOfDetalizationOfContractOfBill>();

            foreach (var stringOfDetalization in list)
            {
                detalizationStrings.Add(
                    stringOfDetalization.ParseStringOfDetalizationOfContractOfBill() //each string is detalized to object StringOfDetalizationOfContractOfBill
                    );
            }

            DetalizationOfContractOfBill detalization = new DetalizationOfContractOfBill(detalizationStrings);

            return(detalization);
        }
Beispiel #3
0
 public ContractOfBill(ContractOfBill contract)
 {
     Header                 = contract?.Header;
     ServicesOfContract     = contract?.ServicesOfContract;
     DetalizationOfContract = contract?.DetalizationOfContract;
 }
Beispiel #4
0
 public ContractOfBill(HeaderOfContractOfBill header, ServicesOfBill services, DetalizationOfContractOfBill detalization)
 {
     Header                 = header;
     ServicesOfContract     = services;
     DetalizationOfContract = detalization;
 }
Beispiel #5
0
 public DetalizationOfContractOfBill(DetalizationOfContractOfBill detalization)
 {
     Output = detalization.Output;
 }