Ejemplo n.º 1
0
        private SocketInChannel FindChannel(DataSet ds)
        {
            SocketInChannel chResult = null;
            DataRow         dr       = ds.Tables[0].Rows[0];

            foreach (SocketInChannel ch in SocketInboundAdapterConfigMgt.SocketInAdapterConfig.InboundChanels)
            {
                if (ch.Rule.QueryCriteria.Type == QueryCriteriaRuleType.SQLStatement ||
                    ch.Rule.QueryCriteria.Type == QueryCriteriaRuleType.None)
                {
                    continue;
                }

                List <KKMath.LogicItem> ilist = new List <KKMath.LogicItem>();

                int i = 0;
                for (i = 0; i < ch.Rule.QueryCriteria.MappingList.Count; i++)
                {
                    SocketInQueryCriteriaItem ci = ch.Rule.QueryCriteria.MappingList[i];
                    //if ( !  KKMath.OperationIsTrue(dr[ci.ThirdPartyDBPatamter.FieldName].ToString().ToUpper() , ci.Operator , ci.Translating.ConstValue.ToUpper()))
                    //    break;

                    QueryCriteriaType type = ci.Type;
                    bool             value = KKMath.OperationIsTrue(dr[ci.ThirdPartyDBPatamter.FieldName].ToString().ToUpper(), ci.Operator, ci.Translating.ConstValue.ToUpper());
                    KKMath.LogicItem item  = new KKMath.LogicItem(value, type);
                    ilist.Add(item);
                }

                bool ret = KKMath.JoinLogicItem(ilist);
                if (ret)
                {
                    chResult = ch;
                    break;
                }

                //if (i == ch.Rule.QueryCriteria.MappingList.Count)
                //{
                //    chResult = ch;
                //    break;
                //}
            }
            return(chResult);
        }
Ejemplo n.º 2
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;
        }