Example #1
0
        private void Save()
        {
            #region Check input
            if (this.cbFTTAR.Text.ToString() == FileInGeneralParams.InFileTreatTypeAfterRead.Move.ToString())
            {
                if (this.tbFilePathForMove.Text == this.tbFilePath.Text)
                {
                    throw new Exception("File Path is not allow identical to file path for move!");
                }
            }
            #endregion
            #region Server File parameter
            FileInGeneralParams gp = FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams;
            gp.TimerInterval          = Convert.ToInt32(this.mtbTimerInterval.Text);
            gp.FilePath               = this.tbFilePath.Text;
            gp.FilePrefix             = this.tbFilePrefix.Text;
            gp.FileSuffix             = this.tbFileSuffix.Text;
            gp.InFileMovePath         = this.tbFilePathForMove.Text;
            gp.FileTreatTypeAfterRead = (FileInGeneralParams.InFileTreatTypeAfterRead)System.Enum.Parse(typeof(FileInGeneralParams.InFileTreatTypeAfterRead), this.cbFTTAR.Text);
            #endregion

            string codePageName = ComboxLoader.GetEncoding(this.cbCodePage);
            FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams.CodePageName = codePageName;

            string FileName = Application.StartupPath + "\\" + FileInboundAdapterConfigMgt.FileName;
            if (!FileInboundAdapterConfigMgt.Save(FileName))
            {
                if (FileInboundAdapterConfigMgt.LastException != null)
                {
                    Program.log.Write(LogType.Error, "Cannot Save information to Configuration file: " + FileName);
                }
                MessageBox.Show(FileInboundAdapterConfigMgt.LastException.Message);
            }
        }
Example #2
0
        private void Initialization()
        {
            channelSet = FileInboundAdapterConfigMgt.FileInAdapterConfig.InboundChanels;
            LUTableSet = FileInboundAdapterConfigMgt.FileInAdapterConfig.LookupTables;

            FillCombox();

            #region ServerFileParameters
            FileInGeneralParams gp = FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams;
            this.mtbTimerInterval.Text  = gp.TimerInterval.ToString();
            this.tbFilePath.Text        = gp.FilePath;
            this.tbFilePrefix.Text      = gp.FilePrefix;
            this.tbFileSuffix.Text      = gp.FileSuffix;
            this.tbFilePathForMove.Text = gp.InFileMovePath;
            this.cbFTTAR.Text           = gp.FileTreatTypeAfterRead.ToString();
            #endregion
            #region Channel
            if (channelSet != null)
            {
                if (channelSet.Count != 0)
                {
                    ShowChannelSetInformation();
                }
                channelIndex = -1;     //It sign that there is no channel in the channelset
            }
            else
            {
                //Never occur as FileInAdapterConfigMgt.FileInAdapterConfig was be constuctured
                channelSet = new XCollection <FileInChannel>();
            }
            #endregion
            #region Look up tables
            if (LUTableSet != null)
            {
                if (LUTableSet.Count != 0)
                {
                    ShowLUTableSetInformation();
                }
                tableIndex = -1;     //It sign that there is no channel in the channelset
            }
            else
            {
                //Never occur as FileInAdapterConfigMgt.FileInAdapterConfig was be constuctured
                LUTableSet = new XCollection <LookupTable>();
            }
            #endregion

            string codePageName = FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams.CodePageName;
            ComboxLoader.SetEncoding(this.cbCodePage, codePageName);
        }