Beispiel #1
0
        /// <summary>
        /// Add InvoiceLine By InvoiceLine
        /// </summary>
        /// <param name="invoiceLine"></param>
        /// <returns></returns>
        public bool AddInvoiceLine(InvoiceLine invoiceLine)
        {
            if (invoiceLine == null)
            {
                //empty item
                new LogManager().Log($"Fail to add invoice line (NULL) to invoice(Id: {InvoiceNumber})");
                return(false);
            }
            if (LineItems == null)
            {
                LineItems = new List <InvoiceLine>();
            }

            if (!LineItems.Any(i => i.InvoiceLineId == invoiceLine.InvoiceLineId))
            {
                //add
                LineItems.Add(invoiceLine);
                new LogManager().Log($"Add invoice line (Id: {invoiceLine.InvoiceLineId}) to invoice (Id: {InvoiceNumber})");
                return(true);
            }
            else
            {
                //update
                var existingItem = LineItems.Where(i => i.InvoiceLineId == invoiceLine.InvoiceLineId).First();
                LineItems.Remove(existingItem);
                LineItems.Add(invoiceLine);
                new LogManager().Log($"Update invoice line (Id: {invoiceLine.InvoiceLineId}) to invoice (Id: {InvoiceNumber})");
                return(false);
            }
        }
Beispiel #2
0
 public OrderDto(Order order)
 {
     OrderId         = order.OrderId;
     UserId          = order.UserId;
     StreetAddress   = order.StreetAddress;
     UnitDesignation = order.UnitDesignation;
     City            = order.City;
     Province        = order.Province;
     PostalCode      = order.PostalCode;
     Country         = order.Country;
     TaxEstimate     = order.TaxEstimate;
     ServiceFee      = order.ServiceFee;
     DriverTip       = order.DriverTip;
     TotalEstimate   = order.TotalEstimate;
     TotalExact      = order.TotalExact;
     CreatedDate     = order.CreatedDate;
     AcceptedById    = order.AcceptedById;
     AcceptedDate    = order.AcceptedDate;
     ApprovedDate    = order.ApprovedDate;
     CompletedDate   = order.CompletedDate;
     foreach (LineItem item in order.LineItems)
     {
         LineItems.Add(new LineItemDto(item));
     }
     foreach (OrderNote note in order.OrderNotes)
     {
         OrderNotes.Add(new OrderNoteDto(note));
     }
 }
Beispiel #3
0
 public void AddLineItem(LineItem li)
 {
     if (LineItems == null)
     {
         LineItems = new ObservableCollection <LineItem>();
     }
     LineItems.Add(li);
 }
Beispiel #4
0
        public void AddLineItem(PurchaseOrderLineItem item)
        {
            if (!IsInBudget(item))
            {
                throw new InvalidOperationException("Item exceeds budget");
            }

            LineItems.Add(item);
        }
        public void AddLineItem(LineItem lineItem)
        {
            if (LineItems.Contains(lineItem))
            {
                throw new ArgumentException("Line item already added");
            }

            LineItems.Add(lineItem);
        }
        public void AddingOneLineItemGetsCountofone()
        {
            LineItems li = new LineItems();

            SingleLineItem sli = new SingleLineItem();

            li.Add(sli);

            Assert.Equal(1, li.Count);
        }
Beispiel #7
0
        public PurchaseLineItem AddLineItem(Part part, int qty)
        {
            PurchaseLineItem lineItem = Scout.Core.Data.CreateEntity <PurchaseLineItem>(Session);

            lineItem.PurchaseOrder = this;
            lineItem.Quantity      = qty;
            lineItem.LoadPartDetails(part);
            LineItems.Add(lineItem);

            return(lineItem);
        }
Beispiel #8
0
        public void Add(CustomerOrderLine line)
        {
            line.CustomerIDs = CustomerIDs;
            line.CustomerPO  = CustomerPO;

            if (LineItems == null)
            {
                LineItems = new List <CustomerOrderLine>();
            }
            LineItems.Add(line);
        }
Beispiel #9
0
        public Result AddInvoiceLine(InvoiceLine proposedInvoiceLine)
        {
            var result = ValidInput(proposedInvoiceLine);

            if (result.Success)
            {
                LineItems.Add(proposedInvoiceLine);
            }

            return(result);
        }
Beispiel #10
0
 public void AddLineItem(string productName, int units, double unitPrice, string discount, double totalPrice)
 {
     LineItems.Add(new LineItem()
     {
         ProductName = productName,
         Units       = units,
         UnitPrice   = unitPrice,
         Discount    = discount,
         TotalPrice  = totalPrice
     });
 }
Beispiel #11
0
        public void Add(LineItem lineItem)
        {
            var existingLineItem = LineItems.FirstOrDefault(li => li.ProductId == lineItem.ProductId);

            if (existingLineItem != null)
            {
                existingLineItem.Quantity += lineItem.Quantity;
            }
            else
            {
                LineItems.Add(lineItem);
            }
        }
 /// <summary>
 /// Adds a list of line items to this order and validates these line items.
 /// </summary>
 /// <param name="lineItems">The list of line items</param>
 public void AddLineItems(Dictionary <BusinessProduct, int> lineItems)
 {
     Log.Information($"Adding line items {lineItems}");
     foreach (KeyValuePair <BusinessProduct, int> lineItem in lineItems)
     {
         ValidateNotTooManyLines();
         ValidateNotDuplicateProductId(lineItem.Key.Id);
         ValidateQuantityGreaterThanZero(lineItem.Key, lineItem.Value);
         ValidateQuantityBelowLimit(lineItem.Key, lineItem.Value);
         LineItems.Add(lineItem.Key, lineItem.Value);
     }
     ValidateHasLines();
 }
Beispiel #13
0
        public void CopyItemsFromSalesOrder(SalesOrder order)
        {
            foreach (SalesLineItem item in order.CartItems)
            {
                if (LineItemByPart(item.Part) == null)
                {
                    LineItems.Add(new PurchaseItemMapper().MapFrom(item));
                }
            }

            Organization  = order.Organization;
            Contact       = order.Contact;
            Shopfloorline = order.Shopfloorline;
            Program       = order.RequiredProgram;
        }
Beispiel #14
0
        public void AddProduct(int productId, int qty, double price)
        {
            var item = LineItems.FirstOrDefault(x => x.ProductId == productId);

            if (item != null)
            {
                item.Quantity += qty;
            }
            else
            {
                LineItems.Add(new OrderLineItem {
                    ProductId = productId, Quantity = qty, Price = price, OrderId = OrderId
                });
            }
        }
Beispiel #15
0
        public void AddItem(string sku)
        {
            var existingItem = LineItems.SingleOrDefault(lineItem => lineItem.Sku == sku);

            if (existingItem != null)
            {
                existingItem.AddOne();
            }
            else
            {
                var item     = _itemBuilder.BuildItem(sku);
                var lineItem = new LineItem(item);
                LineItems.Add(lineItem);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Populates collections within table. The tables used will be removed from
        /// the table collection.
        /// Override this method to populate your custom collection objects.
        /// </summary>
        /// <param name="tables">The tables.</param>
        /// <param name="filter">The filter.</param>
        protected override void PopulateCollections(DataTableCollection tables, string filter)
        {
            filter = String.Format("OrderFormId = '{0}'", this.OrderFormId.ToString());

            base.PopulateCollections(tables, filter);

            // Populate object collections
            DataView view = DataHelper.CreateDataView(tables["Shipment"], filter);

            // Read until we are done, since this is a collection
            foreach (DataRowView row in view)
            {
                Shipment orderShipment = (Shipment)OrderContext.Current.ShipmentClassInfo.CreateInstance();
                orderShipment.Load(row);
                orderShipment.PopulateCollectionsInternal(tables, filter);
                Shipments.Add(orderShipment);
            }

            view = DataHelper.CreateDataView(tables["LineItem"], filter);

            // Read until we are done, since this is a collection
            foreach (DataRowView row in view)
            {
                LineItem lineItem = (LineItem)OrderContext.Current.LineItemClassInfo.CreateInstance();
                lineItem.Load(row);
                lineItem.PopulateCollectionsInternal(tables, filter);
                LineItems.Add(lineItem);
            }

            // Populate object collections
            // Populates payments collection
            LoadPayments(tables, filter);

            // Load discounts
            view = DataHelper.CreateDataView(tables["OrderFormDiscount"], filter);

            // Read until we are done, since this is a collection
            foreach (DataRowView row in view)
            {
                OrderFormDiscount discount = new OrderFormDiscount();
                discount.Load(row);
                Discounts.Add(discount);
            }
        }
        /// <summary>
        /// 初始化 需要显示的回路、输出、输入信息
        /// </summary>
        private void InitViewModel()
        {
            if (_terminalInformation == null)
            {
                return;
            }


            AttachRtuId = _terminalInformation.AttachRtuId;
            RtuId       = _terminalInformation.RtuId;
            PhyId       = _terminalInformation.PhyId;
            RtuName     = _terminalInformation.RtuName;
            Remark      = _terminalInformation.Remark;

            LduCommType = _terminalInformation.RtuModel == 30910 ? "无线" : "有线";

            LineItems.Clear();
            foreach (var t in _terminalInformation.LduLines)
            {
                LineItems.Add(new LduLineViewModel(t, LoopCollectionInfo));
            }
        }
Beispiel #18
0
 /// <summary>
 /// To add line item of the record based on ZCRMInventoryLineItem class instance.
 /// </summary>
 /// <param name="newLineItem">ZCRMInventoryLineItem class instance</param>
 public void AddLineItem(ZCRMInventoryLineItem newLineItem)
 {
     LineItems.Add(newLineItem);
 }
Beispiel #19
0
 public void Add(CustomerOrderChangeLine line)
 {
     LineItems.Add(line);
 }
 public void AddFeeLineItem(string description, decimal amount, DateTimeOffset when)
 {
     LineItems.Add(new FeeLineItem(description, amount, when));
 }
Beispiel #21
0
        //This Function Create a New Invoice in the Xero System Given by Details //Add Invoice Representator  Modified Sumudu Kodikara 1/52015
        public XeroApi.Model.Invoice CreateInvoice(Repository repository, String strContactName, String[] arrOrderItems, int PaymentTerms, Decimal deDeliveryCharges, String PROMO)
        {
            if (repository == null)
            {
                //User Must Authenticate and trow an Error
                return(null);
            }

            String[] arrLineItem;

            //create Line Itmes
            XeroApi.Model.LineItems LItems = new LineItems();

            //Xero Model LineItem
            XeroApi.Model.LineItem lItem;

            /*Invoice Line Items Creation*/
            #region Invoice LineItems
            for (int i = 0; i < arrOrderItems.Length; i++)
            {
                if (!String.IsNullOrEmpty(arrOrderItems[i]))
                {
                    arrLineItem = arrOrderItems[i].Split(',');
                    if (i == 0)
                    {
                        lItem = new XeroApi.Model.LineItem {
                            Description = arrLineItem[1], ItemCode = arrLineItem[2], UnitAmount = Convert.ToDecimal(arrLineItem[5]), Quantity = Int32.Parse(arrLineItem[4]), TaxType = "OUTPUT"
                        };
                        lItem.AccountCode = "200";
                        LItems.Add(lItem);
                    }
                    if (i != 0)
                    {
                        lItem = new XeroApi.Model.LineItem {
                            Description = arrLineItem[2], ItemCode = arrLineItem[3], UnitAmount = Convert.ToDecimal(arrLineItem[6]), Quantity = Int32.Parse(arrLineItem[5]), TaxType = "OUTPUT"
                        };
                        lItem.AccountCode = "200";
                        LItems.Add(lItem);
                    }
                }
            }
            //Delivery Handling item Adding here
            lItem = new XeroApi.Model.LineItem {
                Description = "Delivery & Handling, D & H", UnitAmount = Convert.ToDecimal(deDeliveryCharges)
            };
            lItem.AccountCode = "200";
            LItems.Add(lItem);
            #endregion


            #region Promotional Items Creation

            if (!String.IsNullOrEmpty(PROMO))
            {
                String[] ProItems = PROMO.Split('|');
                String[] ProItem;
                for (int i = 0; i < ProItems.Length; i++)
                {
                    if (!String.IsNullOrEmpty(ProItems[i]))
                    {
                        ProItem = ProItems[i].Split(',');
                        if (i == 0)
                        {
                            float   ShippingCost;
                            decimal amount = 0;

                            //Add a line for promotional Item
                            lItem = new XeroApi.Model.LineItem {
                                Description = ProItem[0].ToString(), UnitAmount = Convert.ToDecimal(amount), Quantity = Int32.Parse(ProItem[2])
                            };
                            lItem.AccountCode = "200";
                            LItems.Add(lItem);
                        }
                        if (i != 0)
                        {
                            float   ShipCost;
                            decimal amount = 0;

                            //Add a line for promotional Item
                            lItem = new XeroApi.Model.LineItem {
                                Description = ProItem[1].ToString(), UnitAmount = Convert.ToDecimal(amount), Quantity = Int32.Parse(ProItem[3])
                            };
                            lItem.AccountCode = "200";
                            LItems.Add(lItem);
                        }
                    }
                }
            }

            #endregion Promotional Items Creation

            /*End Invoice Line Items Creation*/

            XeroApi.Model.Invoice deltoneInvoice = new XeroApi.Model.Invoice
            {
                Type    = "ACCREC",
                Contact = new XeroApi.Model.Contact {
                    Name = strContactName
                },
                Date            = DateTime.Today,
                DueDate         = DateTime.Today.AddDays(PaymentTerms),
                Status          = "DRAFT",
                LineItems       = LItems,
                LineAmountTypes = XeroApi.Model.LineAmountType.Inclusive
            };


            var createdInvoice = repository.Create(deltoneInvoice);

            //Check wether Validation Errors Exsists or Not
            if (createdInvoice.ValidationStatus == XeroApi.Model.ValidationStatus.ERROR)
            {
                foreach (var message in createdInvoice.ValidationErrors)
                {
                    Console.WriteLine("Validation Error: " + message.Message);
                }
                return(null);
            }

            return((XeroApi.Model.Invoice)createdInvoice);
        }
Beispiel #22
0
        //this Method Update XERO Invoice Status given by Guid
        public XeroApi.Model.Invoice UpdtateInvoice(Repository repos, String strGuid, String[] arrOrderItems, int PaymentTerms, Decimal deDeliveryCharges, String PROMO)
        {
            if (repos == null)
            {
                return(null);
            }

            String[] arrLineItem;

            //create Line Itmes
            XeroApi.Model.LineItems LItems = new LineItems();

            //Xero Model LineItem
            XeroApi.Model.LineItem lItem;

            /*Invoice Line Items Creation*/
            #region Invoice LineItems
            for (int i = 0; i < arrOrderItems.Length; i++)
            {
                if (!String.IsNullOrEmpty(arrOrderItems[i]))
                {
                    arrLineItem = arrOrderItems[i].Split(',');
                    if (i == 0)
                    {
                        lItem = new XeroApi.Model.LineItem {
                            Description = arrLineItem[1], ItemCode = arrLineItem[2], UnitAmount = Convert.ToDecimal(arrLineItem[5]), Quantity = Int32.Parse(arrLineItem[4]), TaxType = "OUTPUT"
                        };
                        lItem.AccountCode = "200";
                        LItems.Add(lItem);
                    }
                    if (i != 0)
                    {
                        lItem = new XeroApi.Model.LineItem {
                            Description = arrLineItem[2], ItemCode = arrLineItem[3], UnitAmount = Convert.ToDecimal(arrLineItem[6]), Quantity = Int32.Parse(arrLineItem[5]), TaxType = "OUTPUT"
                        };
                        lItem.AccountCode = "200";
                        LItems.Add(lItem);
                    }
                }
            }
            //Delivery Handling item Adding here
            lItem = new XeroApi.Model.LineItem {
                Description = "Delivery & Handling, D & H", UnitAmount = Convert.ToDecimal(deDeliveryCharges)
            };
            lItem.AccountCode = "200";
            LItems.Add(lItem);
            #endregion
            /*End Invoice Line Items Creation*/


            #region Promotional Item Creation

            if (!String.IsNullOrEmpty(PROMO))
            {
                String[] ProItems = PROMO.Split('|');
                String[] ProItem;
                for (int i = 0; i < ProItems.Length; i++)
                {
                    if (!String.IsNullOrEmpty(ProItems[i]))
                    {
                        ProItem = ProItems[i].Split(',');
                        if (i == 0)
                        {
                            float   ShippingCost;
                            decimal amount = 0;

                            //Add a line for promotional Item
                            lItem = new XeroApi.Model.LineItem {
                                Description = ProItem[0].ToString(), UnitAmount = Convert.ToDecimal(amount), Quantity = Int32.Parse(ProItem[2])
                            };
                            lItem.AccountCode = "200";
                            LItems.Add(lItem);
                        }
                        if (i != 0)
                        {
                            float   ShipCost;
                            decimal amount = 0;

                            //Add a line for promotional Item
                            lItem = new XeroApi.Model.LineItem {
                                Description = ProItem[1].ToString(), UnitAmount = Convert.ToDecimal(amount), Quantity = Int32.Parse(ProItem[3])
                            };
                            lItem.AccountCode = "200";
                            LItems.Add(lItem);
                        }
                    }
                }
            }


            #endregion Promotional Item Creation


            XeroApi.Model.Invoice deltoneInvoice = new XeroApi.Model.Invoice
            {
                Type            = "ACCREC",
                InvoiceID       = new Guid(strGuid),
                LineItems       = LItems,
                LineAmountTypes = XeroApi.Model.LineAmountType.Inclusive,
                Status          = "AUTHORISED"
            };

            var updatedInvoice = repos.UpdateOrCreate(deltoneInvoice);

            if (updatedInvoice.ValidationStatus == XeroApi.Model.ValidationStatus.ERROR)
            {
                foreach (var message in updatedInvoice.ValidationErrors)
                {
                    Console.WriteLine("Validation Error: " + message.Message);
                }
                return(null);
            }
            return((XeroApi.Model.Invoice)updatedInvoice);
        }
Beispiel #23
0
 public virtual void AddLineItem(LineItem lineItem)
 {
     lineItem.Order = this;
     LineItems.Add(lineItem);
 }
 public void AddItem(Product product, int quantity)
 {
     LineItems.Add(new LineItem(product, quantity));
 }
Beispiel #25
0
 public void Add(InvoicedOrderLine line)
 {
     LineItems.Add(line);
 }
Beispiel #26
0
 public void AddLineItem(ReceiptLineItem receiptLineItem)
 {
     LineItems.Add(receiptLineItem);
 }
Beispiel #27
0
        public void AddLineItem(IOrderItem item, decimal quantity = 1)
        {
            var lineitem = new LineItem(item, quantity);

            LineItems.Add(lineitem);
        }
Beispiel #28
0
 public void When(QuoteItemAdded quoteItemAdded)
 {
     LineItems.Add(LineItem.Create(quoteItemAdded.Amount, quoteItemAdded.Description).Value);
 }
        /// <summary>
        /// Draws the graph
        /// </summary>
        private void DrawGraph()
        {
            if (CanvasHeight == 0 || CanvasWidth == 0)
            {
                return;
            }

            //clear the containers
            RectangleItems.Clear();
            LineItems.Clear();
            TextItems.Clear();
            PointCollection points = new PointCollection();

            //set some stuff
            int numPoints = 100;
            int ticks     = 8;

            //get the max an min of the efficieny points
            double maxOrd = EfficiencyMeasurements.Max(e => e.Efficiency);
            double minOrd = EfficiencyMeasurements.Min(e => e.Efficiency);

            //get ordinate graph bounds that look nice
            double ordTickRange = GetTickRange(maxOrd - minOrd, ticks);
            double ordTickMag   = Math.Log10(ordTickRange) > 0 ? Math.Ceiling(Math.Log10(ordTickRange)) : Math.Floor(Math.Log10(ordTickRange));

            maxOrd = ordTickRange * Math.Round(1 + maxOrd / ordTickRange);
            minOrd = ordTickRange * (Math.Round(minOrd / ordTickRange - 1));

            double minAbsc = 0;// Properties.Settings.Default.LOWERELIMT * 0.75;
            double maxAbsc = Properties.Settings.Default.UPPERENERGY;

            //get abscissa graph bounds that look nice
            double abscTickRange = GetTickRange(maxAbsc - minAbsc, ticks);
            double abscTickMag   = Math.Log10(abscTickRange) > 0 ? Math.Ceiling(Math.Log10(abscTickRange)) : Math.Floor(Math.Log10(abscTickRange));

            maxAbsc = abscTickRange * Math.Round(maxAbsc / abscTickRange);
            minAbsc = abscTickRange * (Math.Round(minAbsc / abscTickRange));


            int       seperation = 20;
            Rectangle chart      = new Rectangle(0.2 * CanvasWidth - seperation, seperation, (int)(0.8F * CanvasWidth), (int)(0.8F * CanvasHeight));

            //Rectangle chart = new Rectangle();
            RectangleItems.Add(chart);

            //get the energy limit
            double lowE  = minAbsc;// Properties.Settings.Default.LOWERELIMT * 0.75;
            double highE = maxAbsc;

            //get the position converstion factors.
            double xconv = chart.Width / (highE - lowE);
            double xoff  = chart.Right - (xconv * highE);

            double yconv = chart.Height / (minOrd - maxOrd);
            double yoff  = chart.Bottom - (yconv * minOrd);


            //build a formatting string
            StringBuilder format = new StringBuilder("0");

            format.Append(ordTickMag >= 0 ? "" : ".");
            for (int j = 0; j < Math.Abs(ordTickMag); j++)
            {
                format.Append(0);
            }
            //loop through and add lables
            int    tickLength = 10;
            double ord = minOrd, absc = minAbsc;

            while (Math.Round(ord, (int)Math.Abs(ordTickMag)) <= maxOrd)
            {
                //draw the y-axis
                double y;// = (yconv * (ord) + yoff);
                if (Math.Abs(ord - minOrd) < 1e-6)
                {
                    y = chart.Bottom - chart.StrokeWeight / 2;
                }
                else if (Math.Abs(ord - maxOrd) < 1e-6)
                {
                    y = chart.Top + chart.StrokeWeight / 2;
                }
                else
                {
                    y = (yconv * (ord) + yoff);
                    LineItems.Add(new Line(chart.Left, y, chart.Right, y)
                    {
                        LineDashArray = { 2, 1 },
                    });
                }

                LineItems.Add(new Line(chart.Left - tickLength, y, chart.Left + tickLength, y));
                //create the label
                string    label     = (ord).ToString(format.ToString());
                ChartText labelText = new ChartText(label)
                {
                    //position the label
                    //X = chart.Left - 2 - 0.2*CanvasWidth,
                    X      = 0,
                    Y      = y + (ordTickRange * yconv) / 2,
                    Width  = chart.Left - tickLength - 2,
                    Height = Math.Abs(ordTickRange * yconv),
                    TextHorizontalAlignment = HorizontalAlignment.Right,
                    TextVerticalAlignment   = VerticalAlignment.Center
                };

                TextItems.Add(labelText);
                ord += ordTickRange;
            }
            while (Math.Round(absc, (int)Math.Abs(abscTickMag)) <= maxAbsc)
            {
                //draw the x-axis
                double x;// = (xconv * (absc) + xoff);
                if (Math.Abs(absc - minAbsc) < 1e-6)
                {
                    x = chart.Left + chart.StrokeWeight / 2;
                }
                else if (Math.Abs(absc - maxAbsc) < 1e-6)
                {
                    x = chart.Right - chart.StrokeWeight / 2;
                }
                else
                {
                    x = (xconv * (absc) + xoff);
                    LineItems.Add(new Line(x, chart.Bottom, x, chart.Top)
                    {
                        LineDashArray = { 2, 1 },
                    });
                }

                LineItems.Add(new Line(x, chart.Bottom + tickLength, x, chart.Bottom - tickLength));

                string    label     = (absc).ToString();
                ChartText labelText = new ChartText(label)
                {
                    Width  = abscTickRange * xconv,
                    Height = 0.2 * CanvasHeight - tickLength - 2 - seperation,
                    //position the label
                    X = x - (abscTickRange * xconv) / 2,
                    Y = chart.Bottom + tickLength + 2,
                    TextHorizontalAlignment = HorizontalAlignment.Center,
                    TextVerticalAlignment   = VerticalAlignment.Top
                };

                TextItems.Add(labelText);
                absc += abscTickRange;
            }

            //fill the an array of points that represents the curve
            double eJump = (highE - lowE) / numPoints;
            //CurvePoints = new Point[numPoints];
            double ene = lowE;

            for (int i = 0; i < numPoints; i++)
            {
                ene += eJump;
                double eff = data.GetEfficiency(ene);
                int    x   = Convert.ToInt32(ene * xconv + xoff);
                double y   = yoff + eff * yconv;
                if (y > chart.Bottom || double.IsNaN(y))
                {
                    y = chart.Bottom;
                }
                else if (y < chart.Top || double.IsInfinity(y))
                {
                    y = chart.Top;
                }

                points.Add(new Point(x, y));
            }
            this.CurvePoints = points;
            //make the graph thick
            //put the efficiency points on the chart
            for (int i = 0; i < EfficiencyMeasurements.Count; i++)
            {
                int x      = Convert.ToInt32(EfficiencyMeasurements[i].Energy * xconv + xoff);
                int y      = Convert.ToInt32(yoff + EfficiencyMeasurements[i].Efficiency * yconv);
                int ptSize = 2;
                RectangleItems.Add(new Rectangle(x - ptSize, y - ptSize, 2 * ptSize, 2 * ptSize));
                //add the error bars
                LineItems.Add(new Line(x, y - EfficiencyMeasurements[i].EfficiencyUncertainty * yconv,
                                       x, y + EfficiencyMeasurements[i].EfficiencyUncertainty * yconv));
            }
            WriteEfficiencyEquation();
        }