Exemplo n.º 1
0
        private void BuildPanelOrder(Test.PanelSetOrder panelSetOrder, XElement panelSetOrderElement)
        {
            List<XElement> panelOrderElements = (from poc in panelSetOrderElement.Elements("PanelOrderCollection")
                                                 select poc).ToList<XElement>();

            YellowstonePathology.Business.Panel.Model.PanelCollection panelCollection = YellowstonePathology.Business.Panel.Model.PanelCollection.GetAll();
            panelSetOrder.PanelOrderCollection.RemoveDeleted(panelOrderElements.Elements("PanelOrder"));
            foreach (XElement panelOrderElement in panelOrderElements.Elements("PanelOrder"))
            {
                string panelOrderId = panelOrderElement.Element("PanelOrderId").Value;
                Test.PanelOrder panelOrder = null;
                if (panelSetOrder.PanelOrderCollection.Exists(panelOrderId) == true)
                {
                    panelOrder = panelSetOrder.Get(panelOrderId);
                }
                else
                {
                    int panelId = Convert.ToInt32(panelOrderElement.Element("PanelId").Value);
                    YellowstonePathology.Business.Panel.Model.Panel panel = panelCollection.GetPanel(panelId);

                    panelOrder = Test.PanelOrderFactory.GetPanelOrder(panel);
                    panelSetOrder.PanelOrderCollection.Add(panelOrder);
                }

                YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriter = new YellowstonePathology.Business.Persistence.XmlPropertyWriter(panelOrderElement, panelOrder);
                xmlPropertyWriter.Write();
                BuildTestOrderRightSide(panelOrder, panelOrderElement);
            }
        }