Esempio n. 1
0
        public void GetProcessFile()
        {
            DataTable DT = null;
            DataBase DB = new DataBase();
            DT = DB.ExcuteProcedure("DataProduct_KJ128N_Shanxi_Process");

            MyDataTable MYDT = new MyDataTable(DT, DateTime.Now.ToString("yyyyMMddHHmmss"), "process", FilePath);
            if (txtShow.Lines.Length > 27)
            {
                txtShow.Text = "";
                txtShow.Text += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "  ������������ ʵʱ���������ļ�" + Environment.NewLine;
            }
            else
            {
                txtShow.Text += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "  ������������ ʵʱ���������ļ�" + Environment.NewLine;
            }
        }
Esempio n. 2
0
        //д�ļ�����
        public void XMLToDataSetChange()
        {
            DataBase db = new DataBase();
            DataTable dtTemp = db.ExcuteProcedure("select case when StationHeadState<1 then 0 else 1 end,StationHeadNO from Station_Head_Info");

            //DataTable DS = new DataTable();
            //for(int x=0;x<9;x++)
            //{
            //    DataColumn dc = new DataColumn(x.ToString());
            //    DS.Columns.Add(dc);
            //}

            XmlDocument doc = new XmlDocument();

            doc.Load(strXMLPath);

            //�趨XML�ļ�����Ϊ����ṹ
            XmlNodeList nodelist = doc.FirstChild.NextSibling.ChildNodes;
            string strContent = string.Empty;

            //����XML���ѱ�������������м��Ҫ�任���任֮��д�뵽�ļ�����
            for (int i = 0; i < nodelist.Count; i++)
            {
                //DataRow dr = DS.NewRow();
                for (int j = 0; j < nodelist[i].ChildNodes.Count; j++)
                {

                    if (nodelist[i].ChildNodes[j].InnerText != "x" & j == 5)
                    {
                        //if (dtTemp.Select("StationHeadNO='" + nodelist[i].ChildNodes[j].InnerText.Substring(13) + "'").Length != 0)
                        //{
                        //    strContent += nodelist[i].ChildNodes[j].InnerText.ToString() + "\t"+dtTemp.Select("StationHeadNO='" + nodelist[i].ChildNodes[j].InnerText.Substring(13) + "'")[0][0].ToString() + "\t";
                        //}
                        //else
                        //{
                        //    strContent += nodelist[i].ChildNodes[j].InnerText.ToString() + "\t";
                        //}
                        strContent += dtTemp.Select("StationHeadNO='" + nodelist[i].ChildNodes[3].InnerText.Substring(13) + "'")[0][0].ToString() + "\t";

                    }
                    else
                    {
                        strContent += nodelist[i].ChildNodes[j].InnerText.ToString() + "\t";
                    }
                }
                strContent = strContent + "\r\n";
            }

            DataWrite dw = new DataWrite(XmlDocName, strDateTime, strContent,strFileRoot);
        }