Example #1
0
 public DiscountBase(string name, List <DiscountEntry> discounts, LineItem.TaxStatus taxable, string revenueGroup)
 {
     this.Name         = name;
     this.discounts    = discounts;
     this.taxable      = taxable;
     this.revenueGroup = revenueGroup;
 }
Example #2
0
        static private LineItem.TaxStatus GetTaxable(int discountNumber)
        {
            LineItem.TaxStatus retval = LineItem.TaxStatus.TaxYes;

            string taxable = ConfigurationManager.AppSettings["Discount" + discountNumber.ToString() + "Taxable"];

            switch (taxable.ToLower())
            {
            case "taxable":
                // nothing to do here
                break;

            case "nontaxable":
                retval = LineItem.TaxStatus.TaxNo;
                break;

            case "taxincluded":
                retval = LineItem.TaxStatus.TaxIncluded;
                break;

            default:
                System.Windows.Forms.MessageBox.Show(String.Format("{0} in discount {1}, defaulting to taxable", taxable, discountNumber), "Unknown taxable state",
                                                     System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop);
                break;
            }

            return(retval);
        }
Example #3
0
        public ItemGroup(XmlNode source)
        {
            XmlNode dummyNode = source.Attributes["type"];

            this.Type = null;
            if (dummyNode != null)
            {
                this.Type = dummyNode.InnerText;
            }

            dummyNode = source.Attributes["color"];
            int hexColor = 0x00FFFFFF; // default color

            if (dummyNode != null)
            {
                hexColor = int.Parse(dummyNode.InnerText, System.Globalization.NumberStyles.AllowHexSpecifier);
            }
            this.Color = System.Drawing.Color.FromArgb(hexColor);

            this.Discounts = new List <string>();
            dummyNode      = source.Attributes["discounts"];
            if (dummyNode != null)
            {
                char[]   delimiters    = { ',' };
                string[] discountArray = dummyNode.InnerText.Split(delimiters);
                foreach (string s in discountArray)
                {
                    this.Discounts.Add(s);
                }
            }

            dummyNode         = source.Attributes["revenuegroup"];
            this.RevenueGroup = null;
            if (dummyNode != null)
            {
                this.RevenueGroup = dummyNode.InnerText;
            }

            this.Taxable = LineItem.TaxStatus.TaxYes;
            dummyNode    = source.Attributes["taxable"];
            if (dummyNode != null)
            {
                switch (dummyNode.InnerText.ToLower())
                {
                case "taxable":
                    // nothing to do here
                    break;

                case "nontaxable":
                    this.Taxable = LineItem.TaxStatus.TaxNo;
                    break;

                case "taxincluded":
                    this.Taxable = LineItem.TaxStatus.TaxIncluded;
                    break;
                }
            }
        }
Example #4
0
 public ByDollarsDiscount(string name, List <DiscountEntry> discounts, LineItem.TaxStatus taxable, string revenueGroup)
     : base(name, discounts, taxable, revenueGroup)
 {
 }
Example #5
0
 public PercentByCountDiscount(string name, List <DiscountEntry> discounts, LineItem.TaxStatus taxable, string revenueGroup)
     : base(name, discounts, taxable, revenueGroup)
 {
 }
Example #6
0
        public Item(XmlNode source, ItemGroup group)
        {
            XmlNode dummyNode = source.Attributes["name"];

            if (dummyNode != null)
            {
                this.Name = dummyNode.InnerText;
            }
            else
            {
                MessageBox.Show("Nameless item!", "ITEM LOADING", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            // Default pretty much everything from the group.
            this.Type         = group.Type;
            this.Color        = group.Color;
            this.Discounts    = new List <string>(group.Discounts);
            this.RevenueGroup = group.RevenueGroup;
            this.Taxable      = group.Taxable;

            dummyNode = source.Attributes["type"];
            if (dummyNode != null)
            {
                this.Type = dummyNode.InnerText;
            }
            else if (this.Type == null)
            {
                MessageBox.Show("Item " + this.Name + " does not have a type", "ITEM LOADING", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            dummyNode = source.Attributes["color"];
            if (dummyNode != null)
            {
                int hexColor = 0x00FFFFFF; // default color
                hexColor   = int.Parse(dummyNode.InnerText, System.Globalization.NumberStyles.AllowHexSpecifier);
                this.Color = System.Drawing.Color.FromArgb(hexColor);
            }

            dummyNode = source.Attributes["discounts"];
            if (dummyNode != null)
            {
                this.Discounts = new List <string>();
                char[]   delimiters    = { ',' };
                string[] discountArray = dummyNode.InnerText.Split(delimiters);
                foreach (string s in discountArray)
                {
                    this.Discounts.Add(s);
                }
            }

            dummyNode = source.Attributes["price"];
            if (dummyNode != null)
            {
                this.Price = decimal.Parse(dummyNode.InnerText);
            }
            else
            {
                // Normally means a variable-price item
                this.Price = 0.00M;
            }

            dummyNode = source.Attributes["revenuegroup"];
            if (dummyNode != null)
            {
                this.RevenueGroup = dummyNode.InnerText;
            }
            else if (this.RevenueGroup == null)
            {
                // One of the dialogbox items
                this.RevenueGroup = "Jarlidium";
            }

            dummyNode = source.Attributes["taxable"];
            if (dummyNode != null)
            {
                switch (dummyNode.InnerText.ToLower())
                {
                case "taxable":
                    // nothing to do here
                    break;

                case "nontaxable":
                    this.Taxable = LineItem.TaxStatus.TaxNo;
                    break;

                case "taxincluded":
                    this.Taxable = LineItem.TaxStatus.TaxIncluded;
                    break;
                }
            }
        }