Example #1
0
        public SQLOutQueryCriteriaItem Clone()
        {
            SQLOutQueryCriteriaItem item = new SQLOutQueryCriteriaItem();

            item.ThirdPartyDBPatamter.FieldID   = this.ThirdPartyDBPatamter.FieldID;
            item.ThirdPartyDBPatamter.FieldName = this.ThirdPartyDBPatamter.FieldName;
            item.ThirdPartyDBPatamter.FieldType = this.ThirdPartyDBPatamter.FieldType;

            item.Type        = this.Type;
            item.Translating = this.Translating.Clone();

            item.SourceField = this.SourceField;
            item.TargetField = this.TargetField;

            item.Singal = this.Singal;

            item.Operator = this.Operator;

            item.RedundancyFlag = this.RedundancyFlag;

            item.GWDataDBField.Table     = this.GWDataDBField.Table;
            item.GWDataDBField.FieldName = this.GWDataDBField.FieldName;
            //item.GWDataDBField.IsAuto = this.GWDataDBField.IsAuto;

            return(item);
        }
Example #2
0
        public SQLOutboundChanel Clone()
        {
            SQLOutboundChanel ch = new SQLOutboundChanel();

            ch.ChannelName = this.ChannelName;

            ch.Enable = this.Enable;

            ch.OperationName = this.OperationName;

            ch.Modified = this.Modified;

            ch.OperationType = this.OperationType;

            ch.SPName = this.SPName;

            ch.SPStatement = this.SPStatement;


            //ch.Rule.RuleID = Rule.RuleID; // do not copy RuleID
            ch.Rule.RuleName              = Rule.RuleName;
            ch.Rule.MaxRecordCount        = Rule.MaxRecordCount;
            ch.Rule.CheckProcessFlag      = Rule.CheckProcessFlag;
            ch.Rule.AutoUpdateProcessFlag = Rule.AutoUpdateProcessFlag;

            ch.Rule.QueryCriteria.Type         = Rule.QueryCriteria.Type;
            ch.Rule.QueryCriteria.SQLStatement = Rule.QueryCriteria.SQLStatement;

            //ch.Rule.QueryCriteriaRuleType = this.Rule.QueryCriteriaRuleType;
            foreach (SQLOutQueryCriteriaItem item in Rule.QueryCriteria.MappingList)
            {
                SQLOutQueryCriteriaItem i = item.Clone();
                ch.Rule.QueryCriteria.MappingList.Add(i);
            }
            foreach (SQLOutQueryResultItem item in Rule.QueryResult.MappingList)
            {
                SQLOutQueryResultItem i = item.Clone();
                ch.Rule.QueryResult.MappingList.Add(i);
            }


            return(ch);
        }
Example #3
0
        public static bool LoadDefaultPassiveChannels(XCollection <SQLOutboundChanel> chs, string Prefix, string interfaceName)
        {
            //XCollection<SQLOutboundChanel> chs = new XCollection<SQLOutboundChanel>();
            chs.Clear();

            SQLOutboundChanel ch;
            int iFieldID = 0;
            SQLOutQueryResultItem ri;

            #region CH_Patient
            ch               = new SQLOutboundChanel();
            ch.ChannelName   = "CH_PATITENT";
            ch.SPName        = Prefix + GWDataDBTable.Patient.ToString();
            ch.OperationType = ThrPartyDBOperationType.StorageProcedure;
            ch.Modified      = false;

            #region Criteria
            SQLOutQueryCriteriaItem ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "00";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "01";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "02";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "03";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            #endregion

            #region Result

            iFieldID = 0;
            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Index))
            {
                // Third party application need to use this ID to update process flag
                //if (f.GetFullFieldName() == GWDataDBField.i_IndexGuid.GetFullFieldName()) continue;
                if (f.GetFullFieldName() == GWDataDBField.i_DataDateTime.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.i_PROCESS_FLAG.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;
                ri.Translating.Type               = TranslatingType.None;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Patient))
            {
                if (f.GetFullFieldName() == GWDataDBField.p_DATA_ID.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.p_DATA_DT.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;
                ri.Translating.Type               = TranslatingType.None;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            chs.Add(ch);
            #endregion

            ch.Rule.RuleID = GWDataDBTable.Patient.ToString();
            ch.SPStatement = RuleControl.GetOutboundSP(interfaceName, ch.Rule);

            #endregion

            #region CH_Order

            ch               = new SQLOutboundChanel();
            ch.ChannelName   = "CH_ORDER";
            ch.SPName        = Prefix + GWDataDBTable.Order.ToString();
            ch.OperationType = ThrPartyDBOperationType.StorageProcedure;
            ch.Modified      = false;

            #region Criteria
            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "10";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "11";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "12";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "13";
            ch.Rule.QueryCriteria.MappingList.Add(ci);
            #endregion

            #region Result

            iFieldID = 0;
            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Index))
            {
                // Third party application need to use this ID to update process flag
                //if (f.GetFullFieldName() == GWDataDBField.i_IndexGuid.GetFullFieldName()) continue;
                if (f.GetFullFieldName() == GWDataDBField.i_DataDateTime.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.i_PROCESS_FLAG.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Patient))
            {
                if (f.GetFullFieldName() == GWDataDBField.p_DATA_ID.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.p_DATA_DT.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Order))
            {
                if (f.GetFullFieldName() == GWDataDBField.o_DATA_ID.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.o_DATA_DT.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            chs.Add(ch);
            #endregion

            ch.Rule.RuleID = GWDataDBTable.Order.ToString();
            ch.SPStatement = RuleControl.GetOutboundSP(interfaceName, ch.Rule);

            #endregion

            #region CH_Report

            ch               = new SQLOutboundChanel();
            ch.ChannelName   = "CH_REPORT";
            ch.SPName        = Prefix + GWDataDBTable.Report.ToString();
            ch.OperationType = ThrPartyDBOperationType.StorageProcedure;
            ch.Modified      = false;

            #region Criteria
            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "30";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "31";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "32";
            ch.Rule.QueryCriteria.MappingList.Add(ci);

            ci = new SQLOutQueryCriteriaItem();
            ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet;
            ci.GWDataDBField           = GWDataDBField.i_EventType;
            ci.Operator               = QueryCriteriaOperator.Equal;
            ci.Type                   = QueryCriteriaType.Or;
            ci.SourceField            = ci.GWDataDBField.GetFullFieldName();
            ci.TargetField            = ci.GWDataDBField.GetFullFieldName();
            ci.Translating.Type       = TranslatingType.FixValue;
            ci.Translating.ConstValue = "33";
            ch.Rule.QueryCriteria.MappingList.Add(ci);
            #endregion

            #region Result

            iFieldID = 0;
            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Index))
            {
                // Third party application need to use this ID to update process flag
                //if (f.GetFullFieldName() == GWDataDBField.i_IndexGuid.GetFullFieldName()) continue;
                if (f.GetFullFieldName() == GWDataDBField.i_DataDateTime.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.i_PROCESS_FLAG.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Patient))
            {
                if (f.GetFullFieldName() == GWDataDBField.p_DATA_ID.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.p_DATA_DT.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Order))
            {
                if (f.GetFullFieldName() == GWDataDBField.o_DATA_ID.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.o_DATA_DT.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Report))
            {
                if (f.GetFullFieldName() == GWDataDBField.r_DATA_ID.GetFullFieldName())
                {
                    continue;
                }
                if (f.GetFullFieldName() == GWDataDBField.r_DATA_DT.GetFullFieldName())
                {
                    continue;
                }

                ri = new SQLOutQueryResultItem();
                ri.GWDataDBField = f;
                ri.SourceField   = f.FieldName.ToUpper();
                ri.TargetField   = f.GetFullFieldName().Replace(".", "_").ToUpper();
                ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper();

                ri.ThirdPartyDBPatamter.FieldID   = ++iFieldID;
                ri.Translating.Type               = TranslatingType.None;
                ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar;

                ch.Rule.QueryResult.MappingList.Add(ri);
            }

            chs.Add(ch);
            #endregion

            ch.Rule.RuleID = GWDataDBTable.Report.ToString();
            ch.SPStatement = RuleControl.GetOutboundSP(interfaceName, ch.Rule);

            #endregion



            return(true);
        }