Ejemplo n.º 1
0
        private void RefreshLogs()
        {
            lstSent.Items.Clear();
            lstFailed.Items.Clear();
            if (lstTypes.SelectedItem == null)
            {
                return;
            }

            NCDataItemConfig item = lstTypes.SelectedItem as NCDataItemConfig;

            if (item == null)
            {
                return;
            }

            string type        = item.Type;
            string strDataDir  = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "DataSent");
            string strDataFail = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "DataFailed");

            // List Sent data
            string[] fileSent = Directory.GetFiles(strDataDir, string.Format("{0}*.xml", type));
            foreach (string strfile in fileSent)
            {
                lstSent.Items.Add(strfile);
            }
            // List failed data
            string[] fileFailed = Directory.GetFiles(strDataFail, string.Format("{0}*.xml", type));
            foreach (string strfile in fileFailed)
            {
                lstFailed.Items.Add(strfile);
            }
        }
Ejemplo n.º 2
0
        private string TranslateDataToNC(NCDataItemConfig item, DataTable data)
        {
            System.Xml.Xsl.XslCompiledTransform trans = new System.Xml.Xsl.XslCompiledTransform();
            trans.Load(item.XSLT);
            string strTmpDir   = Path.GetTempPath();
            string strLogDir   = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "DataSent");
            string strDataFile = Path.Combine(strTmpDir, "MES_Data.xml");
            string strXmlFile  = Path.Combine(strLogDir, string.Format("{0}_{1}.xml", item.Type, DateTime.Now.ToString("yyyyMMddHHmmssfff")));

            data.WriteXml(strDataFile);
            trans.Transform(strDataFile, strXmlFile);
            return(strXmlFile);
        }
Ejemplo n.º 3
0
        internal NCDataItemConfig[] FindDataBySubTgt(string subTgt)
        {
            XmlNodeList nodes = SelectNodes(string.Format("NCDataConfig/data[@subscribe='{0}']", subTgt));

            if (nodes == null || nodes.Count < 1)
            {
                return(null);
            }
            NCDataItemConfig[] datas = new NCDataItemConfig[nodes.Count];
            for (int i = 0; i < nodes.Count; i++)
            {
                NCDataItemConfig data = new NCDataItemConfig(nodes[i] as XmlElement);
                datas[i] = data;
            }
            return(datas);
        }
Ejemplo n.º 4
0
        public NCDataItemConfig[] GetDatas()
        {
            XmlNodeList nodes = SelectNodes("NCDataConfig/data");

            if (nodes == null || nodes.Count < 1)
            {
                return(null);
            }
            NCDataItemConfig[] datas = new NCDataItemConfig[nodes.Count];
            for (int i = 0; i < nodes.Count; i++)
            {
                NCDataItemConfig data = new NCDataItemConfig(nodes[i] as XmlElement);
                datas[i] = data;
            }
            return(datas);
        }