Esempio n. 1
0
 void li_DeleteItem(ucLineItem obj)
 {
     flpMain.Controls.Remove(obj);
     RecalculateTotals();
 }
Esempio n. 2
0
        private void InsertItem(ucLineItem obj)
        {
            int iIndex = flpMain.Controls.IndexOf(obj);

            ucLineItem li = ObjectFactory.GetInstance<ucLineItem>();

            li.DeleteItem += new Action<ucLineItem>(li_DeleteItem);
            li.TotalOrTaxableChanged += new Action(li_TotalChanged);
            li.InsertItem += new Action<ucLineItem>(InsertItem);
            li.LoadOrderItems(_orderItems);

            //create the list of controls to be added back in
            List<Control> addBackIn = new List<Control>();
            flpMain.Controls.Remove(btnAddItem);
            for (int i = iIndex + 1; i < flpMain.Controls.Count; i++)
            {
                addBackIn.Add(flpMain.Controls[i]);
                flpMain.Controls.RemoveAt(i);

            }

            //add the item we want to insert
            flpMain.Controls.Add(li);

            //add back in the controls that come after inserted control
            foreach (var item in addBackIn)
            {
                flpMain.Controls.Add(item);
            }

            flpMain.Controls.Add(btnAddItem);

            RecalculateTotals();
        }