コード例 #1
0
        public void LoadJobElements()
        {
            bool hasExtraMargin = false;
            bool isTaxExempt    = false;

            foreach (var line in jobElements)
            {
                if (string.IsNullOrWhiteSpace(line) || string.IsNullOrEmpty(line))
                {
                    continue;
                }

                if (line.Equals("extra-margin", StringComparison.CurrentCultureIgnoreCase))
                {
                    hasExtraMargin = true;
                    continue;
                }

                var items = line.Split(' ');

                string  description = items[0];
                decimal cost        = Convert.ToDecimal(items[1]);

                if (items.Length > 2 && items[2].Equals("exempt", StringComparison.CurrentCultureIgnoreCase))
                {
                    isTaxExempt = true;
                }

                JobComponents newJob = new JobComponents(description, cost, isTaxExempt, hasExtraMargin);
                components.Add(newJob);
            }
        }
コード例 #2
0
        //Constructor
        public JobCalculator(JobComponents _components, List <JobComponents> _componentsList)
        {
            Debug.Assert(_components != null);     //safety
            Debug.Assert(_componentsList != null); //safety

            pComponents    = _components;
            componentsList = _componentsList;
        }