Пример #1
0
        /// <summary>
        /// save this list to file
        /// </summary>
        /// <param name="filePath"></param>
        public void Save(string filePath)
        {
            string result = header.ToString() + "\r\n";

            foreach (LoadListRecord record in records)
            {
                result += record + "\r\n";
            }
            File.WriteAllText(filePath, result);
        }
Пример #2
0
        private void btnAddHeader_Click(object sender, EventArgs e)
        {
            SafeRun(delegate
            {
                // generate loadlist's save path
                string loadlistSavePath = Helper.GetCurrentDir() + tbAddHeaderLoadlistId.Text + ".txt";

                // generate dataset output path
                string outputPath = tbAddHeaderOutputDir.Text.Trim();
                if (!outputPath.EndsWith("\\"))
                {
                    outputPath += "\\";
                }
                outputPath += tbAddHeaderLoadlistId.Text + "_" + Int32.Parse(tbAddHeaderOriginId.Text).ToString("D3") + "_" + tbAddHeaderSourceName.Text + "_" + tbAddHeaderSourceDate.Text.Replace("/", "_");
                ShowMessage("Stage 3: outputpath = " + outputPath);

                // generate header
                LoadListHeader header = new LoadListHeader(outputPath, tbAddHeaderSourceDate.Text, tbAddHeaderOriginId.Text);
                string result         = header.ToString() + "\r\n" + File.ReadAllText(Config.LOADLIST_STAGE2_PATH);
                File.WriteAllText(loadlistSavePath, result);
                ShowMessage("Stage 3: loadlist saved to " + loadlistSavePath);
            });
        }