Esempio n. 1
0
        public List <DTOLabelSettings> Load(string filePath)
        {
            try
            {
                List <DTOLabelSettings> _listDTO = new List <DTOLabelSettings>();
                using (XmlTextReader xmlTextReader = new XmlTextReader(filePath))
                {
                    XPathNodeIterator xpathNodeIterator = new XPathDocument(xmlTextReader, XmlSpace.Preserve).CreateNavigator().Select(XMLNodes.LABEL_SETTINGS);
                    while (xpathNodeIterator.MoveNext())
                    {
                        int    outputControl;
                        int    dataField;
                        string groupName = xpathNodeIterator.Current.GetAttribute("groupName", "");
                        //string labelName = xpathNodeIterator.Current.GetAttribute("labelName", "");
                        string objectName  = xpathNodeIterator.Current.GetAttribute("objectName", "");
                        string contentName = xpathNodeIterator.Current.GetAttribute("contentName", "");
                        int.TryParse(xpathNodeIterator.Current.GetAttribute("outputControl", ""), out outputControl);
                        int.TryParse(xpathNodeIterator.Current.GetAttribute("dataField", ""), out dataField);

                        DTOLabelSettings dto = new DTOLabelSettings(groupName, "", objectName, contentName, outputControl, dataField);
                        _listDTO.Add(dto);
                    }
                }
                return(_listDTO);
            }
            catch (FileNotFoundException)
            {
                throw new FileNotFoundException("File not found");
            }
            catch (Exception)
            {
                throw new Exception("Nieprawidłowa struktura pliku z ustawieniami etykiety.");
            }
        }
Esempio n. 2
0
        public List <DTOLabelSettings> GetDTOLabelSettings()
        {
            List <DTOLabelSettings> listDTO = new List <DTOLabelSettings>();

            foreach (var item in rjConnection.Job.VariableContents)
            {
                DTOLabelSettings dto = new DTOLabelSettings(item.GroupName, "", item.ObjectName, item.ContentName, item.OutputControl, item.DataField);
                listDTO.Add(dto);
            }

            return(listDTO);
        }