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;
        }
        public ServicesOfBill GetHeaderOfBill()
        {
            //second variant
            //Raw Contract data
            contractRaw = new List <string>(); //the whole list of contract detalization

            foreach (var row in billDetalizationList)
            {
                //contract's Header
                if (row.StartsWith(beginningOfFirstLineOfContract))
                {
                    break;
                }
                else
                {
                    contractRaw.Add(row);   // add rows to created new the List 'contractRaw'  and add first row
                }
            }
            Info?.Invoke(this, new TextEventArgs("В шапке счета строк: " + contractRaw.Count().ToString()));

            ServicesOfBill header = new ServicesOfBill(contractRaw.ParseServicesOfBill());

            return(header);
        }
Ejemplo n.º 3
0
 public ContractOfBill(HeaderOfContractOfBill header, ServicesOfBill services, DetalizationOfContractOfBill detalization)
 {
     Header                 = header;
     ServicesOfContract     = services;
     DetalizationOfContract = detalization;
 }
Ejemplo n.º 4
0
 public ServicesOfBill(ServicesOfBill services)
 {
     Output = services.Output;
 }