Пример #1
0
        public SQLInQueryCriteriaItem(ThrPartyDBParamter param, GWDataDBField sourceField)
        {
            TargetField = param.FieldName;
            SourceField = sourceField.GetFullFieldName();

            GWDataDBField = sourceField;
            _paramter     = param;
        }
Пример #2
0
        public RdetOutQueryCriterialItem(GWDataDBField targetfield, ThrPartyDBParamter param)
        {
            TargetField = targetfield.GetFullFieldName();
            SourceField = param.FieldName;

            GWDataDBField = targetfield;
            _paramter     = param;
        }
Пример #3
0
        public SocketInQueryResultItem(ThrPartyDBParamter param, GWDataDBField sourceField)
        {
            TargetField = param.FieldName;
            SourceField = sourceField.GetFullFieldName();

            GWDataDBField = sourceField;
            _paramter     = param;
        }
Пример #4
0
        public SocketInQueryResultItem(GWDataDBField targetfield, ThrPartyDBParamter param)
        {
            TargetField = targetfield.GetFullFieldName();
            SourceField = param.FieldName;

            GWDataDBField = targetfield;
            _paramter     = param;
        }
Пример #5
0
        public RdetOutQueryResultItem(ThrPartyDBParamter param, GWDataDBField sourceField, bool redundancyFlag)
        {
            RedundancyFlag = redundancyFlag;
            TargetField    = param.FieldName;
            SourceField    = sourceField.GetFullFieldName();

            GWDataDBField = sourceField;
            _paramter     = param;
        }
Пример #6
0
        public SocketInQueryCriteriaItem(ThrPartyDBParamter param, GWDataDBField sourceField, bool redundancyFlag)
        {
            RedundancyFlag = redundancyFlag;
            TargetField    = param.FieldName;
            SourceField    = sourceField.GetFullFieldName();

            GWDataDBField = sourceField;
            _paramter     = param;
        }
Пример #7
0
 private void CheckFields(XCollection <GWDataDBField> fields)
 {
     for (int i = 0; i < listView1.Items.Count; i++)
     {
         this.listView1.Items[i].Checked = false;
         GWDataDBField dbf = (GWDataDBField)listView1.Items[i].Tag;
         foreach (GWDataDBField f in fields)
         {
             if (f.GetFullFieldName() == dbf.GetFullFieldName())
             {
                 this.listView1.Items[i].Checked = true;
             }
         }
     }
 }
Пример #8
0
        /// <summary>
        /// support [%ChannelName%] token, let channecl.name as the part of filename
        /// </summary>
        /// <param name="ch"></param>
        /// <returns></returns>
        public static string BuildOutFileName(FileOutChannel ch, DataRow dr)
        {
            if (_FileOutAdapterConfig == null)
            {
                throw new Exception("System cannot initialized!");
            }

            string sFilePath   = _FileOutAdapterConfig.OutGeneralParams.FilePath;
            string sFilePrefix = _FileOutAdapterConfig.OutGeneralParams.FilePrefix;
            string sFileSuffix = _FileOutAdapterConfig.OutGeneralParams.FileSuffix;

            string sDatetime = "";

            if (_FileOutAdapterConfig.OutGeneralParams.FileDtFormat.Trim() != "")
            {
                sDatetime = DateTime.Now.ToString(_FileOutAdapterConfig.OutGeneralParams.FileDtFormat);
            }


            if (sFilePath.Trim() == "")
            {
                sFilePath = Application.StartupPath + "\\data\\";
            }
            if (!Directory.Exists(sFilePath))
            {
                Directory.CreateDirectory(sFilePath);
            }

            sFilePath = sFilePath.Trim();
            if (sFilePath.Substring(sFilePath.Length - 1, 1) != "\\")
            {
                sFilePath = sFilePath + "\\";
            }

            #region Replace [%Table_Field%] with pValue
            //if (sFilePrefix.Trim().ToUpper() == ("[%ChannelName%]").ToUpper())
            //    sFilePrefix = ch.ChannelName;
            string pValue;   //replace value
            foreach (GWDataDBField prefield in FileOutAdapterConfig.OutGeneralParams.PreGWDataDBFields)
            {
                pValue = "";
                foreach (FileOutQueryResultItem resultItem in ch.Rule.QueryResult.MappingList)
                {
                    GWDataDBField resultField = resultItem.GWDataDBField;
                    if (resultField.GetFullFieldName().Trim().ToUpper() == prefield.GetFullFieldName().Trim().ToUpper())
                    {
                        object o = dr[resultItem.TargetField];
                        if (Convert.IsDBNull(o))
                        {
                            pValue = "";
                        }
                        else
                        {
                            pValue = Convert.ToString(o);
                        }
                        break;
                    }
                }

                //Replace [%Table_Field%] with pValue
                sFilePrefix = sFilePrefix.Replace("[%" + prefield.GetFullFieldName().Replace(".", "_") + "%]", pValue);
            }

            //Gurant no error file name
            sFilePrefix = sFilePrefix.Replace("[%", "");
            sFilePrefix = sFilePrefix.Replace("%]", "");
            #endregion

            if (sFileSuffix.IndexOf(".") < 0)
            {
                sFileSuffix = "." + sFileSuffix;
            }

            string sFileName;
            for (int i = 0; i < Int32.MaxValue; i++)
            {
                if (i == 0)
                {
                    sFileName = sFilePath + sFilePrefix + sDatetime + sFileSuffix;
                }
                else
                {
                    sFileName = sFilePath + sFilePrefix + sDatetime + i.ToString() + sFileSuffix;
                }

                if (!File.Exists(sFileName))
                {
                    return(sFileName);
                }
            }
            throw new Exception("Cannot build outfilename, extract out int32.maxvalue!");
        }