Exemple #1
0
        //保存文件数据
        void saveData()
        {
            if (isInSaveData)
            {
                return;
            }
            isInSaveData = true;
            DataTable dt0 = (DataTable)dgDoorBan.DataSource;
            DataTable dt1 = (DataTable)dgDoorShell.DataSource;
            DataTable dt2 = (DataTable)dgSize.DataSource;

            csvop.SaveCSV(dt0, Constant.DoorBanFile);
            csvop.SaveCSV(dt1, Constant.DoorShellFile);
            csvop.SaveCSV(dt2, Constant.DoorSizeFile);
            isInSaveData = false;
        }
Exemple #2
0
        public void SaveFileDemo()
        {
            DataTable dt = new DataTable();

            if (valueCol.Count > 0)
            {
                DataColumn dtcolSize = new DataColumn("尺寸");

                DataColumn dtcolCnt = new DataColumn("设定数量");


                DataColumn dtcolBarCode = new DataColumn("条码");


                dt.Columns.Add(dtcolSize);
                dt.Columns.Add(dtcolCnt);
                dt.Columns.Add(dtcolBarCode);

                //增加列
                for (int i = 0; i < (valueCol.Count - 3); i++)
                {
                    DataColumn dtcolParm = new DataColumn("参数" + (i + 1).ToString());
                    dt.Columns.Add(dtcolParm);
                }

                DataRow dr = dt.NewRow();

                for (int i = 0; i < valueCol.Count; i++)
                {
                    dr[i] = valueCol[i];
                }

                dt.Rows.Add(dr);
                string filename = Constant.SaveFileDemo;
                csvSaveDemo.SaveCSV(dt, filename);
            }
        }
Exemple #3
0
        public static void SaveFile(DataTable dt, string filename)
        {
            CsvStreamReader csvop = new CsvStreamReader();

            csvop.SaveCSV(dt, filename);
        }