Exemplo n.º 1
0
        public FChannel(FFileInConfig frm, XCollection <FileInChannel> channels)
        {
            InitializeComponent();
            parentForm   = frm;
            channelSet   = channels;
            type         = "Add";
            channel      = new FileInChannel();
            criteriaList = new XCollection <FileInQueryCriteriaItem>();
            resultList   = new XCollection <FileInQueryResultItem>();

            this.Text = "Add Channel";
            GetChannelNameSet(channels);
        }
Exemplo n.º 2
0
        private DataSet ReadData(string fname, FileInChannel ch)
        {
            // Build DataSet Schema

            DataSet   ds1   = new DataSet();
            DataTable table = new DataTable(fname);

            ds1.Tables.Add(table);

            foreach (FileInQueryResultItem item in ch.Rule.QueryResult.MappingList)
            {
                //table.Columns.Add(item.ThirdPartyDBPatamter.FieldName, typeof(System.String));
                table.Columns.Add(item.SourceField, typeof(System.String));
            }

            DataRow dr = table.NewRow();

            bool bIsValid = false;

            IniFile2 iniF = new IniFile2(fname, FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams.CodePageName);

            foreach (FileInQueryResultItem item in ch.Rule.QueryResult.MappingList)
            {
                string val = iniF.ReadValue(item.ThirdPartyDBPatamter.SectionName, item.ThirdPartyDBPatamter.FieldName, "");
                if (item.ThirdPartyDBPatamter.FileFieldFlag)
                {
                    dr[item.SourceField] = LoadFileContent(val);
                }
                else
                {
                    dr[item.SourceField] = val;
                }

                if (val.Trim() != "")
                {
                    bIsValid = true;
                }
            }
            if (bIsValid)
            {
                table.Rows.Add(dr);
            }
            else
            {
                Program.Log.Write(LogType.Error, "Invalid file format." + "File Name:" + fname + ";Channel Name:" + ch.ChannelName + "\r\n");
            }

            return(ds1);
        }
Exemplo n.º 3
0
        public FChannel(FFileInConfig frm, XCollection <FileInChannel> channels, int index)
        {
            InitializeComponent();
            parentForm   = frm;
            channelSet   = channels;
            type         = "Edit";
            channel      = channels[index];
            channelIndex = index;
            criteriaList = channel.Rule.QueryCriteria.MappingList;
            resultList   = channel.Rule.QueryResult.MappingList;

            this.Text = "Edit Channel";
            GetChannelNameSet(channels);
            ShowChannel();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Copy Channel
        /// </summary>
        /// <param name="frm"></param>
        /// <param name="channels"></param>
        /// <param name="copyChannel"></param>
        public FChannel(FFileInConfig frm, XCollection <FileInChannel> channels, FileInChannel copyChannel)
        {
            InitializeComponent();
            parentForm = frm;
            channelSet = channels;
            type       = "Add";

            channel      = copyChannel;
            criteriaList = channel.Rule.QueryCriteria.MappingList;
            resultList   = channel.Rule.QueryResult.MappingList;

            this.Text = "Add Channel";
            GetChannelNameSet(channels);
            ShowChannel();
        }
Exemplo n.º 5
0
        private void btChannelCopy_Click(object sender, EventArgs e)
        {
            int count = channelSet.Count;

            FileInChannel copyChannel = channelSet[channelIndex].Clone();

            copyChannel.ChannelName += "_copy";

            FChannel frm = new FChannel(this, channelSet, copyChannel);

            frm.ShowDialog(pMain);

            if (channelSet.Count > count)
            {  // Add successfully
                channelIndex = count;
                lstvChannel.Items[channelIndex].Selected = true;
            }
        }
Exemplo n.º 6
0
        private bool CheckCriteria(string fname, FileInChannel ch)
        {
            IniFile2 iniF = new IniFile2(fname, FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams.CodePageName);
            List <KKMath.LogicItem> ilist = new List <KKMath.LogicItem>();

            //int iMatchCount = 0;
            foreach (FileInQueryCriteriaItem item in ch.Rule.QueryCriteria.MappingList)
            {
                string sSectionName  = item.ThirdPartyDBPatamter.SectionName;
                string sFieldName    = item.ThirdPartyDBPatamter.FieldName;
                string criteriaValue = item.Translating.ConstValue;

                string v = iniF.ReadValue(sSectionName, sFieldName, "");

                QueryCriteriaType type = item.Type;
                bool             value = KKMath.OperationIsTrue(v, item.Operator, criteriaValue);
                KKMath.LogicItem i     = new KKMath.LogicItem(value, type);
                ilist.Add(i);

                //if (KKMath.OperationIsTrue(v, item.Operator, criteriaValue))
                //    iMatchCount++;
            }

            bool ret = KKMath.JoinLogicItem(ilist);

            return(ret);

            //FileInQueryCriteriaItem it = null;
            //if (ch.Rule.QueryCriteria.MappingList.Count > 0) it = (FileInQueryCriteriaItem)ch.Rule.QueryCriteria.MappingList[0];

            //if (iMatchCount == ch.Rule.QueryCriteria.MappingList.Count)
            //    return true;
            //else if (iMatchCount > 0 && it != null && it.Type == QueryCriteriaType.Or)
            //    return true;
            //else
            //    return false;
        }